Skip to content

Commit

Permalink
Merge pull request #242 from porters-xyz/prod-deploy
Browse files Browse the repository at this point in the history
Splitting fly into fly.toml for staging and fly.prod.toml
  • Loading branch information
wtfsayo authored May 10, 2024
2 parents 7775fec + ff46ece commit a99b5ed
Show file tree
Hide file tree
Showing 14 changed files with 166 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/backend-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: cd web-portal/backend && flyctl deploy -c fly.staging.toml --remote-only
- run: cd web-portal/backend && flyctl deploy -c fly.toml --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_STAGING_API_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/frontend-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: cd web-portal/frontend && flyctl deploy -c fly.staging.toml --remote-only
- run: cd web-portal/frontend && flyctl deploy -c fly.toml --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_STAGING_API_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/proxy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: cd gateway && flyctl deploy --remote-only
- run: cd gateway && flyctl deploy -c fly.toml --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_STAGING_API_TOKEN }}
9 changes: 4 additions & 5 deletions web-portal/backend/fly.staging.toml → docs/fly.prod.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# fly.toml app configuration file generated for porters-backend-staging on 2024-04-02T17:39:45-05:00
# fly.toml app configuration file generated for porters-docs-staging on 2024-04-04T19:24:52-05:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'porters-backend-staging'
app = 'porters-docs'
primary_region = 'sea'

[build]
dockerfile = 'Dockerfile.fly'
build-target = 'production'

[http_service]
internal_port = 4000
force_https = true
internal_port = 3005
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
Expand Down
2 changes: 1 addition & 1 deletion docs/fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'porters-docs'
app = 'porters-docs-staging'
primary_region = 'sea'

[build]
Expand Down
36 changes: 36 additions & 0 deletions gateway/fly.prod.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# fly.toml app configuration file generated for porters-proxy-staging on 2024-04-03T20:23:41-05:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'porters-proxy'
primary_region = 'sea'

[build]

[deploy]
strategy = 'canary'

[env]
HOST = 'rpc.porters.xyz'
### SECRETS ###
# DATABASE_URL = ...
# PROXY_TO = ...
# REDIS_URL = ...

[http_service]
internal_port = 9000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 1
processes = ['app']

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

[[metrics]]
port = 9000
path = "/metrics"
4 changes: 4 additions & 0 deletions gateway/fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ primary_region = 'sea'

[env]
HOST = 'g.staging.porters.xyz'
### SECRETS ###
# DATABASE_URL = ...
# PROXY_TO = ...
# REDIS_URL = ...

[http_service]
internal_port = 9000
Expand Down
7 changes: 7 additions & 0 deletions services/gatewaykit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ Find source code [here](https://github.com/pokt-network/gateway-server).

Run `fly postgres attach` to get environment variable to set as
`DB_CONNECTION_URL`

Secrets required to run this application:

`API_KEY`
`DB_CONNECTION_URL`
`POKT_APPLICATIONS_ENCRYPTION_KEY`
`POKT_RPC_FULL_HOST`
36 changes: 36 additions & 0 deletions services/gatewaykit/fly.prod.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# fly.toml app configuration file generated for porters-gatewaykit-staging on 2024-04-03T13:55:40-05:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'porters-gatewaykit'
primary_region = 'sea'

[build]
image = 'ghcr.io/pokt-network/pocket-gateway-server:0.3.0-BETA'

[env]
ALTRUIST_REQUEST_TIMEOUT = '10s'
ENVIRONMENT_STAGE = 'production'
HTTP_SERVER_PORT = '8080'
POKT_RPC_TIMEOUT = '5s'
SESSION_CACHE_TTL = '75m'

[[services]]
internal_port = 8080
protocol = 'tcp'
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 1
[[services.ports]]
handlers = ["http"]
port = 8080
force_https = false
[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1

[[metrics]]
port = 8080
path = "/metrics"
20 changes: 20 additions & 0 deletions services/redis/fly.prod.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
app = 'porters-redis'

[mounts]
destination = "/data"
source = "redis_data"

[metrics]
port = 9091
path = "/metrics"

# Use the Docker image instead of building from source

[[services]]
internal_port = 6379
protocol = "tcp"
[[services.ports]]
port = 6379
[[services.tcp_checks]]
interval = 10000
timeout = 2000
25 changes: 25 additions & 0 deletions web-portal/backend/fly.prod.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
app = 'porters-backend'
primary_region = 'sea'

[build]
dockerfile = 'Dockerfile.fly'

[env]
### SECRETS ###
# DATABASE_URL = ...
# ONEINCH_API_KEY = ...
# OX_API_KEY = ...
# RPC_KEY = ...

[http_service]
internal_port = 4000
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
17 changes: 16 additions & 1 deletion web-portal/backend/fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,27 @@
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'porters-backend'
app = 'porters-backend-staging'
primary_region = 'sea'

[build]
dockerfile = 'Dockerfile.fly'

[env]
### SECRETS ###
# DATABASE_URL = ...
# ONEINCH_API_KEY = ...
# OX_API_KEY = ...
# RPC_KEY = ...

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

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'porters-frontend-staging'
app = 'porters-frontend'
primary_region = 'sea'

[build]

[build.args]
API_ENDPOINT = 'https://porters-backend-staging.fly.dev/'
API_ENDPOINT = 'https://porters-backend.fly.dev'

[http_service]
internal_port = 3000
Expand All @@ -18,9 +20,10 @@ min_machines_running = 0
processes = ['app']

[env]
# NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID = 'wallet-connect-project-id'
# NEXT_PUBLIC_RPC_ENDPOINT = 'rpc-endpoint'
# NEXT_PUBLIC_APP_URL = 'https://staging.porters.xyz'
NEXT_PUBLIC_APP_URL = 'https://porters.xyz'
### SECRETS ###
# NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID = 'wallet-connect-project-id'
# NEXT_PUBLIC_RPC_ENDPOINT = 'rpc-endpoint'

[[vm]]
memory = '1gb'
Expand Down
13 changes: 6 additions & 7 deletions web-portal/frontend/fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'porters-frontend'
app = 'porters-frontend-staging'
primary_region = 'sea'

[build]

[build.args]
NEXT_PUBLIC_API_ENDPOINT = 'https://porters-backend.fly.dev'
API_ENDPOINT = 'https://porters-backend-staging.fly.dev/'

[http_service]
internal_port = 3000
Expand All @@ -20,9 +18,10 @@ min_machines_running = 0
processes = ['app']

[env]
# NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID = 'wallet-connect-project-id'
# NEXT_PUBLIC_RPC_ENDPOINT = 'rpc-endpoint'
# NEXT_PUBLIC_APP_URL = 'https://porters.xyz'
NEXT_PUBLIC_APP_URL = 'https://staging.porters.xyz'
### SECRETS ###
# NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID = 'wallet-connect-project-id'
# NEXT_PUBLIC_RPC_ENDPOINT = 'rpc-endpoint'

[[vm]]
memory = '1gb'
Expand Down

0 comments on commit a99b5ed

Please sign in to comment.