diff --git a/deploy/fly-io/.gitignore b/deploy/fly-io/.gitignore new file mode 100644 index 000000000..4c49bd78f --- /dev/null +++ b/deploy/fly-io/.gitignore @@ -0,0 +1 @@ +.env diff --git a/deploy/fly-io/README.md b/deploy/fly-io/README.md new file mode 100644 index 000000000..c5c3859a3 --- /dev/null +++ b/deploy/fly-io/README.md @@ -0,0 +1,47 @@ +# Deploy JuiceFS S3 Gateway on fly.io + +JuiceFS S3 Gateway is MinIO backed by a JuiceFS mount. There are two main reasons you may want this. + +1. To browse files managed with JuiceFS using a web client in this case MinIO +1. To use multipart uploads and range downloads in order to get the most of your bandwidth + +## Deploying the gateway + +### Prepare your secrets + +The app will need a few secrets. Take a look at [start.sh](./start.sh) to see what's available. Here's how you can create this. + +```shell +cat <<'EOF' | tee > .env +TAILSCALE_AUTHKEY="my-tailscale-authkey" +JUICEFS_NAME="my-filesystem" +JUICEFS_REDIS_URI="rediss://username:password@hostname:6379/0" +JUICEFS_BUCKET="https://fly.storage.tigris.dev/my-bucket-name" +JUICEFS_ACCESS_KEY="my-access-key" +JUICEFS_SECRET_KEY="my-secret-key" +MINIO_ROOT_USER="my-username" +MINIO_ROOT_PASSWORD="my-password" +EOF +``` + +### Launch and deploy the fly app + +This will modify the [fly.toml](./fly.toml) file in-place. It will also prompt you to confirm the configuration. + +```shell +fly launch --org my-org --name my-deployment --no-deploy --copy-config --yes +``` + +This will import the secrets you created earlier, deploy the app, and scale it to 1 instance. + +```shell +cat .env | fly secrets import +fly deploy +fly scale count 1 --max-per-region=1 --region=iad +``` + +# Deleting the deployment + +```shell +fly app destroy --yes my-deployment +``` diff --git a/deploy/fly-io/fly.toml b/deploy/fly-io/fly.toml index 37cedbffb..59e427f2a 100644 --- a/deploy/fly-io/fly.toml +++ b/deploy/fly-io/fly.toml @@ -1,4 +1,9 @@ -app = 'data-stage-beam-cloud' +# fly.toml app configuration file generated for my-deployment on 2025-01-09T10:06:05-05:00 +# +# See https://fly.io/docs/reference/configuration/ for information about how to use this file. +# + +app = 'my-deployment' primary_region = 'iad' kill_signal = 'SIGTERM' @@ -13,8 +18,8 @@ kill_signal = 'SIGTERM' [http_service] internal_port = 9000 force_https = true - auto_start_machines = true auto_stop_machines = 'off' + auto_start_machines = true [http_service.concurrency] type = 'requests' @@ -42,6 +47,6 @@ kill_signal = 'SIGTERM' path = '/minio/health/live' [[vm]] - cpus = 2 - cpu_kind = 'shared' memory = '2gb' + cpu_kind = 'shared' + cpus = 2