You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
app = "{{getenv "FLY_APP_NAME"}}" # Replace FLY_APP_NAME with the name of your appkill_signal = "SIGINT"kill_timeout = 5primary_region = "{{getenv "FLY_APP_REGION"}}" # # Replace FLY_APP_REGION with the region. See a list of regions here: https://fly.io/docs/reference/regions/[experimental]auto_rollback = trueprivate_network = true # Allows server to connect to the database[build]image = "ghcr.io/permify/permify:latest"[env]CODER_ACCESS_URL = "https://{{getenv "FLY_APP_NAME"}}.fly.dev" # Replace FLY_APP_NAME with the name of your appCODER_HTTP_ADDRESS = "0.0.0.0:3000"#CODER_VERBOSE = "true" # Uncomment this if you want to see more logsCODER_TELEMETRY_INSTALL_SOURCE = "fly.io"[[services]]protocol = "tcp"internal_port = 3000processes = ["app"][[services.ports]]port = 80handlers = ["http"]force_https = true[[services.ports]]port = 443handlers = ["tls", "http"][services.concurrency]type = "connections"hard_limit = 25
This is a Makefile that runs it:
OS_NAME=$(shell uname)# Github CI detection. See: https://docs.github.com/en/actions/learn-github-actions/variablesCI_GITHUB=$(CI)# flyctl binaryFLYCTL_BIN_NAME=flyctl
ifeq ($(shell uname),Windows)
FLYCTL_BIN_NAME=flyctl.exe
endifFLYCTL_BIN_WHICH=$(shell which $(FLYCTL_BIN_NAME))FLYCTL_BIN_WHICH_VERSION=$(shell$(FLYCTL_BIN_NAME) version)## Variables for fly deployment are held in .env files, so that the Makefile is generic.# devs variables# NOTE: This can be .gitignored or not, depending on how you like to manage secrets, etc.-include .env
## ci variables# For debugging; toggle this to pretend your inside github ci, so that you can locally check things work .#CI_GITHUB=TRUEifeq ($(CI_GITHUB),TRUE)
-include .env-ci
endifexportFLY_APP_NAME:=$(FLY_APP_NAME)exportFLY_APP_NAME_DB:=$(FLY_APP_NAME_DB)exportFLY_APP_REGION:=$(FLY_APP_REGION)exportPG_CONNECTION_URL:=$(PG_CONNECTION_URL)print:
@echo ""
@echo "- os"
@echo "OS_NAME: $(OS_NAME)"
@echo "CI_GITHUB: $(CI_GITHUB)"
@echo ""
@echo "- flyctl tool"
@echo "FLYCTL_BIN_NAME: $(FLYCTL_BIN_NAME)"
@echo "FLYCTL_BIN_WHICH: $(FLYCTL_BIN_WHICH)"
@echo "FLYCTL_BIN_WHICH_VERSION: $(FLYCTL_BIN_WHICH_VERSION)"
@echo ""
$(MAKE) print-env
print-env:
@echo ""
@echo "- variables used by fly"
@echo "FLY_APP_NAME: $(FLY_APP_NAME)"
@echo "FLY_APP_NAME_DB: $(FLY_APP_NAME_DB)"
@echo "FLY_APP_REGION: $(FLY_APP_REGION)"
@echo "PG_CONNECTION_URL: $(PG_CONNECTION_URL)"
@echo ""ci-run:
# This is called by github CI. currently just a smoke test deployment.
$(MAKE) print
$(MAKE) 0-deploy-setup
$(MAKE) print
$(MAKE) 0-deploy-setup-del
$(MAKE) print
$(MAKE) 10-deploy-destroy-all
0-deploy-setup:
# install the flyctl# see: https://fly.io/docs/hands-on/install-flyctlifeq ($(shell uname),Windows)
pwsh -Command "iwr https://fly.io/install.ps1 -useb | iex"
endififeq ($(shell uname),Darwin)
brew install flyctl
endififeq ($(shell uname),Linux)
brew install flyctl
endif0-deploy-setup-del:
# deletes flyctl.ifeq ($(shell uname),Windows)
# Not sure as i dont use windows ..endififeq ($(shell uname),Darwin)
brew uninstall flyctl
endififeq ($(shell uname),Linux)
brew uninstall flyctl
endif1-deploy-auth:
# signup or login. Its manages both...$(FLYCTL_BIN_NAME) auth signup
2-deploy-list:
# list what you already have deployed.$(FLYCTL_BIN_NAME) apps list
$(FLYCTL_BIN_NAME) postgres list
3-deploy-create:
$(FLYCTL_BIN_NAME) postgres create --name $(FLY_APP_NAME_DB) --region $(FLY_APP_REGION)$(FLYCTL_BIN_NAME) apps create --name $(FLY_APP_NAME) --region $(FLY_APP_REGION)$(FLYCTL_BIN_NAME) postgres attach --app $(FLY_APP_NAME)$(FLY_APP_NAME_DB)# copy PG_CONNECTION_URL to Makefile...4-deploy-secrets:
$(FLYCTL_BIN_NAME) secrets set CODER_PG_CONNECTION_URL=$(PG_CONNECTION_URL) --app $(FLY_APP_NAME)5-deploy-run:
# Create a fly.toml from the env variables.# If your starting new then copy the .env-template to .env and change the variables# https://github.com/hairyhenderson/gomplate
go install github.com/hairyhenderson/gomplate/v4/cmd/gomplate@latest
gomplate -f fly-template.toml -o fly.toml
$(FLYCTL_BIN_NAME) deploy --app $(FLY_APP_NAME)
6-deploy-update:
# it will pull the latest version of Coder and deploy it.$(FLYCTL_BIN_NAME) deploy --app $(FLY_APP_NAME)7-deploy-scale:
# scale to 1 gb memory if oyu want.$(FLYCTL_BIN_NAME) scale memory 1024 --app $(FLY_APP_NAME)8-deploy-sentry:
# capture erros# https://fly.io/docs/reference/sentry/$(FLYCTL_BIN_NAME) ext sentry create
9-deploy-sentry-ls:
# opens the sentry web gui to list and errors ...$(FLYCTL_BIN_NAME) apps errors
### Destroy 10-deploy-destroy-all: 11-deploy-destroy-app 12-deploy-destroy-db
# deletes the app and db11-deploy-destroy-app:
$(FLYCTL_BIN_NAME) postgres detach --app $(FLY_APP_NAME)$(FLY_APP_NAME_DB)$(FLYCTL_BIN_NAME) apps destroy $(FLY_APP_NAME)12-deploy-destroy-db:
$(FLYCTL_BIN_NAME) apps destroy $(FLY_APP_NAME_DB)
this is the .env file for config of deployment:
# The unique name of the app.
FLY_APP_NAME=temp-pemrify-server
# The unique name of your postres db.
FLY_APP_NAME_DB=temp-pemrify-server-postres
# The region you want to deploy to# See a list of regions here: https://fly.io/docs/reference/regions/
FLY_APP_REGION=lhr
# The connection string that the server needs to connect to the postres db.# This is generated at runtime, and so will update the .env at that time.
PG_CONNECTION_URL=DATABASE_URL=postgres://temp_server:utH7QQvcleHd7Mn@temp-pemrify -server-postres.flycast:5432/temp_ pemrify _server?sslmode=disable
The text was updated successfully, but these errors were encountered:
Fly has a semi managed Postresql, and so just needs the docker file like ghcr.io/permify/permify:latest
https://fly.io/docs/hands-on/sign-up/
https://fly.io/docs/hands-on/install-flyctl
Fly.io Postresql: https://fly.io/docs/postgres/getting-started/what-you-should-know/
This is a fly yaml template:
This is a Makefile that runs it:
this is the .env file for config of deployment:
The text was updated successfully, but these errors were encountered: