From 45ca5cae8642136339a6de851b3981e1aa8ec23c Mon Sep 17 00:00:00 2001 From: m5r Date: Fri, 27 Aug 2021 22:32:34 +0800 Subject: [PATCH] deploy to fly --- .github/workflows/main.yml | 20 +++++++--------- fly.dev.toml | 48 ++++++++++++++++++++++++++++++++++++++ fly.prod.toml | 48 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 12 deletions(-) create mode 100644 fly.dev.toml create mode 100644 fly.prod.toml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3125d32..c112001 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,13 +46,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 16 - - run: npm i -g @railway/cli - - run: railway up + - uses: superfly/flyctl-actions@master env: - RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN_DEV }} + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + with: + args: "deploy -c ./fly.dev.toml" deploy_prod: if: github.ref == 'refs/heads/production' @@ -61,11 +59,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: 16 - - run: npm i -g @railway/cli - - run: railway up + - uses: superfly/flyctl-actions@master env: - RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN_PROD }} + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + with: + args: "deploy -c ./fly.prod.toml" # TODO: on pull_request, deploy 24hour-long deployment at {commit_short_hash}.shellphone.app, provision db and seed data diff --git a/fly.dev.toml b/fly.dev.toml new file mode 100644 index 0000000..5ecef8d --- /dev/null +++ b/fly.dev.toml @@ -0,0 +1,48 @@ +app = "shellphone-dev" + +kill_signal = "SIGINT" +kill_timeout = 5 +processes = [] + +[build] + builder = "heroku/buildpacks:20" + +[build.args] + QUIRREL_BASE_URL = "dev.shellphone.app" + +[env] + AWS_SES_REGION = "eu-central-1" + AWS_SES_FROM_EMAIL = "mokhtar@fss.dev" + QUIRREL_API_URL = "https://queue.mokhtar.dev" + QUIRREL_BASE_URL = "dev.shellphone.app" + APP_BASE_URL = "dev.shellphone.app" + +[experimental] + allowed_public_ports = [] + auto_rollback = true + +[[services]] + http_checks = [] + internal_port = 3000 + processes = ["app"] + protocol = "tcp" + script_checks = [] + + [services.concurrency] + hard_limit = 25 + soft_limit = 20 + type = "connections" + + [[services.ports]] + handlers = ["http"] + port = 80 + + [[services.ports]] + handlers = ["tls", "http"] + port = 443 + + [[services.tcp_checks]] + grace_period = "1s" + interval = "15s" + restart_limit = 6 + timeout = "2s" diff --git a/fly.prod.toml b/fly.prod.toml new file mode 100644 index 0000000..df5edd4 --- /dev/null +++ b/fly.prod.toml @@ -0,0 +1,48 @@ +app = "shellphone-prod" + +kill_signal = "SIGINT" +kill_timeout = 5 +processes = [] + +[build] + builder = "heroku/buildpacks:20" + +[build.args] + QUIRREL_BASE_URL = "www.shellphone.app" + +[env] + AWS_SES_REGION = "eu-central-1" + AWS_SES_FROM_EMAIL = "mokhtar@fss.dev" + QUIRREL_API_URL = "https://queue.mokhtar.dev" + QUIRREL_BASE_URL = "www.shellphone.app" + APP_BASE_URL = "www.shellphone.app" + +[experimental] + allowed_public_ports = [] + auto_rollback = true + +[[services]] + http_checks = [] + internal_port = 3000 + processes = ["app"] + protocol = "tcp" + script_checks = [] + + [services.concurrency] + hard_limit = 25 + soft_limit = 20 + type = "connections" + + [[services.ports]] + handlers = ["http"] + port = 80 + + [[services.ports]] + handlers = ["tls", "http"] + port = 443 + + [[services.tcp_checks]] + grace_period = "1s" + interval = "15s" + restart_limit = 6 + timeout = "2s"