Skip to content

Commit

Permalink
Deploy to Fly
Browse files Browse the repository at this point in the history
  • Loading branch information
nbudin committed Sep 12, 2023
1 parent 2d14513 commit c880fff
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 41 deletions.
49 changes: 8 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,51 +25,18 @@ jobs:
tags: |
ghcr.io/${{ github.repository }}:${{ github.event.release.name }}
ghcr.io/${{ github.repository }}:latest
heroku-release:
fly-release:
runs-on: ubuntu-latest
needs:
- docker-release
strategy:
matrix:
app:
- eventlite-annewil
- eventlite-occultopus
# - eventlite-annewil
steps:
- name: Install Heroku CLI
run: curl https://cli-assets.heroku.com/install.sh | sh
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Log into Heroku Container Registry
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:login
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Write dockerfiles
run: |
echo "FROM ghcr.io/${{ github.repository }}:${{ github.sha }}" >>Dockerfile.web
echo "FROM ghcr.io/${{ github.repository }}:${{ github.sha }}" >>Dockerfile.release
echo "CMD bundle exec bin/rails db:migrate" >>Dockerfile.release
- name: Build web image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.web
load: true
platforms: linux/amd64
tags: registry.heroku.com/${{ matrix.app }}/web
- name: Build release image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile.release
load: true
platforms: linux/amd64
tags: registry.heroku.com/${{ matrix.app }}/release
- name: Push built images
run: |
docker push registry.heroku.com/${{ matrix.app }}/web
docker push registry.heroku.com/${{ matrix.app }}/release
- name: Perform release
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only -a ${{ matrix.app }}
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
run: heroku container:release -a ${{ matrix.app }} web release
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
27 changes: 27 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# fly.toml app configuration file generated for eventlite-occultopus on 2023-09-11T18:26:40-07:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "eventlite-occultopus"
primary_region = "iad"

[build]
image = "ghcr.io/nbudin/eventlite:latest"

[deploy]
release_command = "bundle exec rake db:migrate"
strategy = "rolling"

[env]
PORT = "3000"
RAILS_LOG_TO_STDOUT = "1"
RAILS_SERVE_STATIC_FILES = "1"
SITE_DOMAIN = "occultopus.org"

[http_service]
auto_start_machines = true
auto_stop_machines = true
force_https = true
internal_port = 3000
min_machines_running = 0

0 comments on commit c880fff

Please sign in to comment.