Skip to content

Commit

Permalink
Deploy fitbit-challenges on Fly.io (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaldengeki authored Aug 3, 2024
1 parent a3baf79 commit aac09f9
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ jobs:
bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc run --build_tag_filters=manual --stamp --embed_label $(git rev-parse HEAD) //fitbit_challenges/api:api_image_image_dockerhub
bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc run --build_tag_filters=manual --stamp --embed_label $(git rev-parse HEAD) //fitbit_challenges/worker:image_dockerhub
bazel --bazelrc=.github/workflows/ci.bazelrc --bazelrc=.bazelrc run --build_tag_filters=manual --stamp --embed_label $(git rev-parse HEAD) //fitbit_challenges/frontend:production_cross_platform_image_dockerhub
deploy_fitbit_challenges:
needs: push_fitbit_challenges
if: ${{ github.ref == 'refs/heads/main' }}
concurrency:
group: fitbit_challenges_production
cancel-in-progress: false
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy
working-directory: fitbit_challenges/api
- run: flyctl deploy
working-directory: fitbit_challenges/frontend
push_home_api:
needs: build
if: ${{ github.ref == 'refs/heads/main' }}
Expand Down
34 changes: 34 additions & 0 deletions fitbit_challenges/api/fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# fly.toml app configuration file generated for fitbit-challenges-api on 2024-08-02T20:16:37-04:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'fitbit-challenges-api'
primary_region = 'ewr'

[build]
image = 'shaldengeki/fitbit-challenges-api:latest'

[deploy]
release_command = '/fitbit_challenges/api/migrations/binary /fitbit_challenges/api/migrations ./binary.runfiles/_main/fitbit_challenges/api/migrations/alembic.ini upgrade'

[env]
API_PORT = '5000'
FLASK_APP = 'app.py'
FLASK_DEBUG = 'false'
FRONTEND_HOST = 'fitbit.ouguo.us'
FRONTEND_PORT = ''
FRONTEND_PROTOCOL = 'https'

[http_service]
internal_port = 5000
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
processes = ['app']

[[vm]]
memory = '512mb'
cpu_kind = 'shared'
cpus = 1
26 changes: 26 additions & 0 deletions fitbit_challenges/frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# flyctl launch added from .gitignore
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
.pnp
**/.pnp.js

# testing
coverage

# production
build
**/App.css

# misc
**/.DS_Store
**/.env.local
**/.env.development.local
**/.env.test.local
**/.env.production.local

**/npm-debug.log*
**/yarn-debug.log*
**/yarn-error.log*
fly.toml
29 changes: 29 additions & 0 deletions fitbit_challenges/frontend/fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# fly.toml app configuration file generated for fitbit-challenges-frontend on 2024-08-02T20:27:45-04:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'fitbit-challenges-frontend'
primary_region = 'ewr'

[build]
image = 'shaldengeki/fitbit-challenges-frontend:latest'

[env]
REACT_APP_API_HOST = 'api.fitbit.ouguo.us'
REACT_APP_API_PORT = '443'
REACT_APP_API_PROTOCOL = 'https'
REACT_APP_PORT = '80'

[http_service]
internal_port = 80
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
processes = ['app']

[[vm]]
memory = '256mb'
cpu_kind = 'shared'
cpus = 1

0 comments on commit aac09f9

Please sign in to comment.