Skip to content

Commit

Permalink
feat: added production config for FE
Browse files Browse the repository at this point in the history
  • Loading branch information
nroh555 committed Oct 20, 2024
1 parent 95816bb commit fd285a4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/deploy.production.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Fly Deploy Production

on:
push:
branches:
- master
on: [workflow_dispatch]

jobs:
deploy-web:
Expand All @@ -12,7 +9,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only --config fly.production.toml --build-arg VITE_FIREBASE_PROJECT_ID=${{ secrets.VITE_FIREBASE_PROJECT_ID }} --build-arg VITE_REACT_APP_API_KEY=${{ secrets.VITE_REACT_APP_API_KEY }} --build-arg VITE_REACT_APP_AUTH_DOMAIN=${{ secrets.VITE_REACT_APP_AUTH_DOMAIN }} --build-arg VITE_REACT_APP_STORAGE_BUCKET=${{ secrets.VITE_REACT_APP_STORAGE_BUCKET }} --build-arg VITE_REACT_APP_MESSAGING_SENDER_ID=${{ secrets.VITE_REACT_APP_MESSAGING_SENDER_ID }} --build-arg VITE_REACT_APP_APP_ID=${{ secrets.VITE_REACT_APP_APP_ID }} --build-arg VITE_REACT_APP_MEASUREMENT_ID=${{ secrets.VITE_REACT_APP_MEASUREMENT_ID }}
- run: flyctl deploy --remote-only --config fly.production.toml --build-arg VITE_FIREBASE_PROJECT_ID=${{ secrets.VITE_FIREBASE_PROJECT_ID }} --build-arg VITE_REACT_APP_API_KEY=${{ secrets.VITE_REACT_APP_API_KEY }} --build-arg VITE_REACT_APP_AUTH_DOMAIN=${{ secrets.VITE_REACT_APP_AUTH_DOMAIN }} --build-arg VITE_REACT_APP_STORAGE_BUCKET=${{ secrets.VITE_REACT_APP_STORAGE_BUCKET }} --build-arg VITE_REACT_APP_MESSAGING_SENDER_ID=${{ secrets.VITE_REACT_APP_MESSAGING_SENDER_ID }} --build-arg VITE_REACT_APP_APP_ID=${{ secrets.VITE_REACT_APP_APP_ID }} --build-arg VITE_REACT_APP_MEASUREMENT_ID=${{ secrets.VITE_REACT_APP_MEASUREMENT_ID }} --build-arg VITE_REACT_APP_SERVER_URL=${{ secrets.VITE_REACT_APP_SERVER_URL_PRODUCTION }}
working-directory: ./frontend
env:
FLY_API_TOKEN: ${{ secrets.FLY_PRODUCTION_API_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only --config fly.staging.toml --build-arg VITE_FIREBASE_PROJECT_ID=${{ secrets.VITE_FIREBASE_PROJECT_ID }} --build-arg VITE_REACT_APP_API_KEY=${{ secrets.VITE_REACT_APP_API_KEY }} --build-arg VITE_REACT_APP_AUTH_DOMAIN=${{ secrets.VITE_REACT_APP_AUTH_DOMAIN }} --build-arg VITE_REACT_APP_STORAGE_BUCKET=${{ secrets.VITE_REACT_APP_STORAGE_BUCKET }} --build-arg VITE_REACT_APP_MESSAGING_SENDER_ID=${{ secrets.VITE_REACT_APP_MESSAGING_SENDER_ID }} --build-arg VITE_REACT_APP_APP_ID=${{ secrets.VITE_REACT_APP_APP_ID }} --build-arg VITE_REACT_APP_MEASUREMENT_ID=${{ secrets.VITE_REACT_APP_MEASUREMENT_ID }}
- run: flyctl deploy --remote-only --config fly.staging.toml --build-arg VITE_FIREBASE_PROJECT_ID=${{ secrets.VITE_FIREBASE_PROJECT_ID }} --build-arg VITE_REACT_APP_API_KEY=${{ secrets.VITE_REACT_APP_API_KEY }} --build-arg VITE_REACT_APP_AUTH_DOMAIN=${{ secrets.VITE_REACT_APP_AUTH_DOMAIN }} --build-arg VITE_REACT_APP_STORAGE_BUCKET=${{ secrets.VITE_REACT_APP_STORAGE_BUCKET }} --build-arg VITE_REACT_APP_MESSAGING_SENDER_ID=${{ secrets.VITE_REACT_APP_MESSAGING_SENDER_ID }} --build-arg VITE_REACT_APP_APP_ID=${{ secrets.VITE_REACT_APP_APP_ID }} --build-arg VITE_REACT_APP_MEASUREMENT_ID=${{ secrets.VITE_REACT_APP_MEASUREMENT_ID }} --build-arg VITE_REACT_APP_SERVER_URL=${{ secrets.VITE_REACT_APP_SERVER_URL_STAGING }}
working-directory: ./frontend
env:
FLY_API_TOKEN: ${{ secrets.FLY_STAGING_API_TOKEN }}
Expand Down
5 changes: 2 additions & 3 deletions frontend/Dockerfile.staging → frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ARG VITE_REACT_APP_STORAGE_BUCKET
ARG VITE_REACT_APP_MESSAGING_SENDER_ID
ARG VITE_REACT_APP_APP_ID
ARG VITE_REACT_APP_MEASUREMENT_ID
ARG VITE_REACT_APP_SERVER_URL

ENV VITE_FIREBASE_PROJECT_ID=${VITE_FIREBASE_PROJECT_ID}
ENV VITE_REACT_APP_API_KEY=${VITE_REACT_APP_API_KEY}
Expand All @@ -42,9 +43,7 @@ ENV VITE_REACT_APP_STORAGE_BUCKET=${VITE_REACT_APP_STORAGE_BUCKET}
ENV VITE_REACT_APP_MESSAGING_SENDER_ID=${VITE_REACT_APP_MESSAGING_SENDER_ID}
ENV VITE_REACT_APP_APP_ID=${VITE_REACT_APP_APP_ID}
ENV VITE_REACT_APP_MEASUREMENT_ID=${VITE_REACT_APP_MEASUREMENT_ID}

# Set server URL
ENV VITE_REACT_APP_SERVER_URL="https://wdcc-vps-api-staging.fly.dev"
ENV VITE_REACT_APP_SERVER_URL=${VITE_REACT_APP_SERVER_URL}

# Build the app with environment variables
RUN yarn run build
Expand Down
19 changes: 19 additions & 0 deletions frontend/fly.production.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
app = 'wdcc-vps'
primary_region = 'syd'

[build]
# dockerfile contains build time non-sensitive env vars
dockerfile = "Dockerfile"

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

[[vm]]
cpu_kind = 'shared'
cpus = 1
memory_mb = 1024
2 changes: 1 addition & 1 deletion frontend/fly.staging.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ primary_region = 'syd'

[build]
# dockerfile contains build time non-sensitive env vars
dockerfile = "Dockerfile.staging"
dockerfile = "Dockerfile"

[http_service]
internal_port = 80
Expand Down

0 comments on commit fd285a4

Please sign in to comment.