diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..db41592 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,13 @@ +name: deploy +on: + push: + branches: [main] +jobs: + main: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: superfly/flyctl-actions/setup-flyctl@master + - run: flyctl deploy --local-only + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} diff --git a/compose.yml b/compose.yml index b685061..293a44d 100644 --- a/compose.yml +++ b/compose.yml @@ -5,9 +5,7 @@ services: restart: unless-stopped ports: ["8080:8080"] environment: - PGRST_DB_URI: postgresql://postgres:${POSTGRES_PASSWORD}@/postgres?host=/var/run/postgresql - PGRST_DB_SCHEMA: public - PGRST_DB_ANON_ROLE: anon + DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD}@/postgres?host=/var/run/postgresql volumes: - postgres_socket:/var/run/postgresql depends_on: [db] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 97f26e2..2b7562f 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,4 +1,7 @@ #!/bin/sh set -e -dbmate --url "${PGRST_DB_URI}" --wait up +dbmate --wait up +export PGRST_DB_URI="${PGRST_DB_URI:-${DATABASE_URL}}" +export PGRST_DB_SCHEMA="${PGRST_DB_SCHEMA:-public}" +export PGRST_DB_ANON_ROLE="${PGRST_DB_ANON_ROLE:-anon}" exec "$@" diff --git a/fly.toml b/fly.toml new file mode 100644 index 0000000..e50a67a --- /dev/null +++ b/fly.toml @@ -0,0 +1,38 @@ +# fly.toml file generated for quot on 2022-08-28T22:39:37+09:00 + +app = "quot" +kill_signal = "SIGINT" +kill_timeout = 5 +processes = [] + +[env] + +[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"