Skip to content

feat: add flyio deployment and document#1

Merged
hvn2k1 merged 2 commits into
mainfrom
flyio-deploy
Mar 24, 2026
Merged

feat: add flyio deployment and document#1
hvn2k1 merged 2 commits into
mainfrom
flyio-deploy

Conversation

@hvn2k1

@hvn2k1 hvn2k1 commented Mar 24, 2026

Copy link
Copy Markdown
Collaborator

Add Fly.io deployment support

Deploy Bucketeer to Fly.io as an alternative to the existing AWS ECS setup. Significantly cheaper (~$34/mo vs ~$79/mo on AWS)

What's included

  • Full deployment script (flyio/deploy.sh) — idempotent, handles app creation, IP allocation, secrets, image builds, database migration, and service deployment in one pass
  • 9 Fly.io apps: MySQL (self-hosted with persistent volume), Nginx, Web, API, Batch, Subscriber, HTTPStan, Batch-Cron, and a one-shot Migration runner
  • Global API — the API service gets its own public anycast IP with configurable multi-region deployment (API_REGIONS), so SDKs connect to the nearest instance
  • Upstash Redis integration via fly redis create, with a socat pre-auth proxy in each service entrypoint (Bucketeer v2.2.0 binaries lack native Redis password support)
  • Auto-generated TLS certs (make gen-certs-flyio) with .internal SANs for Fly.io's private DNS
  • Atlas database migration with automatic --baseline detection for first-time deploys
  • Single version variable (BUCKETEER_VERSION) flows through Dockerfiles (via build arg), deploy script, and migration — change it in one place to upgrade

Other changes

  • Dockerfiles refactored to use ARG BUCKETEER_VERSION instead of hardcoded tags
  • AWS Terraform consolidated bucketeer_image_tag + bucketeer_migration_tag into a single bucketeer_version variable
  • README updated with Fly.io architecture diagram (Mermaid), deployment guide, cost estimates for both platforms, and a quick-reference table for all Make targets

Make targets

Target Description
deploy-flyio Full deploy (certs + Redis + build + deploy all)
destroy-flyio Tear down all Fly apps and Redis
ip-flyio Show Nginx and API public IPs
logs-flyio Tail web service logs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class Fly.io deployment support for Bucketeer as an alternative to the existing AWS ECS/Terraform setup, including new Fly app configs, a full deploy script, and Dockerfile/version refactors to standardize image versioning.

Changes:

  • Introduces a Fly.io deployment workflow (fly.toml configs, flyio/deploy.sh, and Make targets) including MySQL-on-volume and Upstash Redis provisioning.
  • Refactors service Dockerfiles to use ARG BUCKETEER_VERSION and adds Fly-specific runtime helpers (resolve-hosts.sh, Redis auth proxy via socat).
  • Updates AWS Terraform/scripts and README documentation to align around a single Bucketeer version variable and document both deployment options.

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 23 comments.

Show a summary per file
File Description
services/web/entrypoint.sh Adds Fly DNS pre-resolution + Redis AUTH proxy setup for web service.
services/web/Dockerfile Uses BUCKETEER_VERSION for upstream image; installs socat; bundles resolve-hosts.sh.
services/subscriber/entrypoint.sh Adds Fly DNS pre-resolution + Redis AUTH proxy and config rewrite.
services/subscriber/Dockerfile Switches to BUCKETEER_VERSION upstream image for subscriber.
services/nginx/Dockerfile Makes nginx config selectable via NGINX_CONF build arg.
services/mysql/init-db/mysql_dump.sql Adds MySQL bootstrap dump for Fly MySQL container initialization.
services/mysql/Dockerfile Adds a MySQL image that seeds schema/data via init script and config.
services/batch/entrypoint.sh Adds Fly DNS pre-resolution + Redis AUTH proxy setup for batch service.
services/batch/Dockerfile Uses BUCKETEER_VERSION for upstream image; installs socat; bundles resolve-hosts.sh.
services/api/entrypoint.sh Adds Fly DNS pre-resolution + Redis AUTH proxy setup for API service.
services/api/Dockerfile Uses BUCKETEER_VERSION for upstream image; installs socat; bundles resolve-hosts.sh.
flyio/web/fly.toml Defines Fly app config for web service.
flyio/subscriber/fly.toml Defines Fly app config for subscriber service.
flyio/resolve-hosts.sh Adds helper to pre-resolve .internal hostnames into /etc/hosts.
flyio/nginx/fly.toml Defines Fly app config for nginx edge proxy.
flyio/mysql/fly.toml Defines Fly app config for MySQL w/ persistent volume.
flyio/migration/fly.toml Defines Fly app config for migration runner.
flyio/httpstan/fly.toml Defines Fly app config for HTTPStan service.
flyio/deploy.sh Adds end-to-end idempotent Fly deployment script (apps, IPs, Redis, secrets, builds, migrations, deploys).
flyio/config.env.example Adds example Fly deployment configuration (prefix/region/version/creds).
flyio/batch/fly.toml Defines Fly app config for batch service.
flyio/batch-cron/fly.toml Defines Fly app config for batch-cron service.
flyio/api/fly.toml Defines Fly app config for global anycast API service and public ports.
config/nginx/bucketeer-flyio.conf Adds Fly-specific nginx config (private DNS resolver + internal gRPC proxying).
aws/terraform-config/config.tfvars.template Updates template to use bucketeer_version instead of image/migration tags.
aws/push-ecr.sh Adds BUCKETEER_VERSION build arg support for AWS image builds.
aws/modules/vars.tf Consolidates image tag variables into single bucketeer_version.
aws/modules/ecs.tf Updates ECS task definitions to use bucketeer_version for all images incl. migration.
README.md Documents Fly architecture/costs/commands; updates AWS docs and quick reference.
Makefile Adds Fly targets for deploy/destroy/ips/logs/certs/redis provisioning.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread flyio/deploy.sh
Comment thread services/subscriber/Dockerfile
Comment thread services/batch/entrypoint.sh
Comment thread flyio/config.env.example
Comment thread README.md
Comment thread services/api/entrypoint.sh
Comment thread services/web/entrypoint.sh
Comment thread flyio/batch-cron/fly.toml
Comment thread flyio/migration/fly.toml
Comment thread flyio/resolve-hosts.sh
@hvn2k1 hvn2k1 marked this pull request as ready for review March 24, 2026 17:33
@hvn2k1 hvn2k1 merged commit 2d7fb40 into main Mar 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants