Skip to content

Commit

Permalink
Automated Deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
maennchen committed Feb 28, 2022
1 parent 0776e32 commit 16a6705
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 27 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/branch_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ name: "Main Branch"

# Secrets:
# * CACHE_VERSION - Set to `date +%s`, set new when the cache should be busted
# * FLY_API_TOKEN - API Token for Deployment

jobs:
detectToolVersions:
Expand Down Expand Up @@ -38,4 +39,13 @@ jobs:
nodeVersion: "${{ needs.detectToolVersions.outputs.nodeVersion }}"
dockerTag: "${{ github.ref_name }}"
secrets:
CACHE_VERSION: "${{ secrets.CACHE_VERSION }}"
CACHE_VERSION: "${{ secrets.CACHE_VERSION }}"

deploy:
name: "Deploy"

needs: ['build']

uses: maennchen/athena/.github/workflows/part_deploy.yml@main
secrets:
FLY_API_TOKEN: "${{ secrets.FLY_API_TOKEN }}"
30 changes: 30 additions & 0 deletions .github/workflows/part_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
workflow_call:
secrets:
FLY_API_TOKEN:
required: true

name: "Deploy"

jobs:
fly_deploy:
name: "Deploy to Fly.io"

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Pull Image"
run: docker pull ghcr.io/${{ github.repository }}:${GITHUB_SHA}
# Secrets are maintained manually using flyctl
- uses: superfly/flyctl-actions@1.3
with:
args: "deploy -i ghcr.io/${{ github.repository }}:${GITHUB_SHA}"
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
14 changes: 1 addition & 13 deletions .github/workflows/tag-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,4 @@ jobs:
secrets:
CACHE_VERSION: "${{ secrets.CACHE_VERSION }}"

deploy:
name: "Deploy"

needs: ['build']

uses: maennchen/athena/.github/workflows/part_deploy.yml@main
with:
environment: staging
version: "${{ github.ref_name }}"
secrets:
JM_GITLAB_TOKEN: ${{ secrets.JM_GITLAB_TOKEN }}
JM_GITLAB_REF: ${{ secrets.JM_GITLAB_REF }}
JM_GITLAB_URL: ${{ secrets.JM_GITLAB_URL }}
# TODO: Add Deployment
14 changes: 1 addition & 13 deletions .github/workflows/tag-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,4 @@ jobs:
secrets:
CACHE_VERSION: "${{ secrets.CACHE_VERSION }}"

deploy:
name: "Deploy"

needs: ['build']

uses: maennchen/athena/.github/workflows/part_deploy.yml@main
with:
environment: production
version: "${{ github.ref_name }}"
secrets:
JM_GITLAB_TOKEN: ${{ secrets.JM_GITLAB_TOKEN }}
JM_GITLAB_REF: ${{ secrets.JM_GITLAB_REF }}
JM_GITLAB_URL: ${{ secrets.JM_GITLAB_URL }}
# TODO: Add Deployment
51 changes: 51 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# fly.toml file generated for athena on 2022-02-28T21:49:58+01:00

app = "athena"

kill_signal = "SIGTERM"
kill_timeout = 5
processes = []

[build]
image = "ghcr.io/maennchen/athena:main"

[deploy]
release_command = "/app/bin/migrate"

[env]
EXTERNAL_HOST = "athena.fly.dev"
EXTERNAL_PORT = "443"
EXTERNAL_SCHEME = "https"
LOG_LEVEL = "info"
PORT = "4000"
BASIC_AUTH_USERNAME = "admin"

[experimental]
allowed_public_ports = []
auto_rollback = true

[[services]]
http_checks = []
internal_port = 4000
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 = 0
timeout = "2s"

0 comments on commit 16a6705

Please sign in to comment.