-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hotfix: add deployment script for prod
- Loading branch information
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Fly Deploy PRODUCTION | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
deploy: | ||
name: Deploy API | ||
runs-on: ubuntu-latest | ||
environment: api | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Fail if branch is not main | ||
if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' | ||
run: | | ||
echo "This workflow should not be triggered with workflow_dispatch on a branch other than main" | ||
exit 1 | ||
- name: Create GitHub deployment | ||
uses: chrnorm/deployment-action@v2 | ||
id: deployment | ||
with: | ||
token: "${{ github.token }}" | ||
environment-url: https://api.devfaq.pl | ||
environment: api | ||
|
||
- name: Prepare flyctl | ||
uses: superfly/flyctl-actions/setup-flyctl@master | ||
|
||
- name: Deploy to fly.io | ||
run: flyctl deploy --config apps/api/fly.production.toml --remote-only -e GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) -e GIT_COMMIT_HASH=$(git rev-parse HEAD) | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | ||
|
||
- name: Update deployment status (success) | ||
if: success() | ||
uses: chrnorm/deployment-status@v2 | ||
with: | ||
token: "${{ github.token }}" | ||
environment-url: ${{ steps.deployment.outputs.environment_url }} | ||
deployment-id: ${{ steps.deployment.outputs.deployment_id }} | ||
state: "success" | ||
|
||
- name: Update deployment status (failure) | ||
if: failure() | ||
uses: chrnorm/deployment-status@v2 | ||
with: | ||
token: "${{ github.token }}" | ||
environment-url: ${{ steps.deployment.outputs.environment_url }} | ||
deployment-id: ${{ steps.deployment.outputs.deployment_id }} | ||
state: "failure" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# fly.toml file generated for devfaq-api on 2022-11-19T13:46:34+01:00 | ||
|
||
app = "devfaq-api-production" | ||
kill_signal = "SIGINT" | ||
kill_timeout = 5 | ||
processes = [] | ||
|
||
[env] | ||
PORT = "8080" | ||
|
||
[build] | ||
dockerfile = "Dockerfile" | ||
|
||
[deploy] | ||
release_command = "pnpm --filter=api exec prisma migrate deploy" | ||
|
||
[experimental] | ||
allowed_public_ports = [] | ||
auto_rollback = true | ||
|
||
[[services]] | ||
http_checks = [] | ||
internal_port = 8080 | ||
processes = ["app"] | ||
protocol = "tcp" | ||
script_checks = [] | ||
[services.concurrency] | ||
hard_limit = 25 | ||
soft_limit = 20 | ||
type = "connections" | ||
|
||
[[services.ports]] | ||
force_https = true | ||
handlers = ["http"] | ||
port = 80 | ||
|
||
[[services.ports]] | ||
handlers = ["tls", "http"] | ||
port = 443 | ||
|
||
[[services.tcp_checks]] | ||
grace_period = "1s" | ||
interval = "15s" | ||
restart_limit = 0 | ||
timeout = "2s" |