Skip to content

Commit

Permalink
autosleep pr apps
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaellaude committed Oct 23, 2024
1 parent 358a37e commit efc1e4a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/fly-deploy-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
run: |
app="${{ github.event.repository.name }}-${{ github.event.number }}-api"
db_name="${{ github.event.repository.name }}-${{ github.event.number }}-db"
config="fly.toml"
config="fly-pr.toml"
# Check if the app exists
if flyctl apps list | grep -q "$app"; then
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
DATABASE_URL="postgresql://postgres:${{ secrets.FLY_PR_PG_PASSWORD }}@${{ steps.fork-db.outputs.name }}.flycast:5432/districtr_v2_api?sslmode=disable&options=-csearch_path%3Dpublic"
flyctl deploy \
--config fly.toml --app "${{ github.event.repository.name }}-${{ github.event.number }}-api" \
--config fly-pr.toml --app "${{ github.event.repository.name }}-${{ github.event.number }}-api" \
--strategy immediate '--ha=false' --vm-cpu-kind shared --vm-cpus 1 --vm-memory 256
working-directory: backend

Expand All @@ -118,7 +118,7 @@ jobs:
run: |
app="${{ github.event.repository.name }}-${{ github.event.number }}-app"
api_app="${{ github.event.repository.name }}-${{ github.event.number }}-api"
config="fly.toml"
config="fly-pr.toml"
# Check if the app exists
if flyctl apps list | grep -q "$app"; then
Expand All @@ -142,7 +142,7 @@ jobs:
if: github.event.action != 'closed'
run: |
app_name="${{ github.event.repository.name }}-${{ github.event.number }}-app"
config="fly.toml"
config="fly-pr.toml"
flyctl secrets set \
-a "${{ github.event.repository.name }}-${{ github.event.number }}-app" \
Expand Down
17 changes: 17 additions & 0 deletions app/fly-pr.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
app = 'districtr-v2-pr-frontend'
primary_region = 'ewr'

[build]

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

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
32 changes: 32 additions & 0 deletions backend/fly-pr.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
app = 'districtr-v2-pr-api'
primary_region = 'ewr'

[env]
BACKEND_CORS_ORIGINS = 'http://localhost:3000'
DOMAIN = 'http://localhost'
ENVIRONMENT = 'production'
PROJECT_NAME = 'Districtr v2 backend – PR test app'
R2_BUCKET_NAME = 'districtr-v2-dev'
VOLUME_PATH = '/data'

[[mounts]]
source = 'gerrydb_views'
destination = '/data'
initial_size = '10gb'
processes = ['app']

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

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1

[deploy]
release_command = "alembic upgrade head"

0 comments on commit efc1e4a

Please sign in to comment.