Skip to content

Commit

Permalink
add juicefs s3 gateway deployment readme on fly.io
Browse files Browse the repository at this point in the history
  • Loading branch information
nickpetrovic committed Jan 9, 2025
1 parent 1645b99 commit a992593
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 4 deletions.
1 change: 1 addition & 0 deletions deploy/fly-io/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
47 changes: 47 additions & 0 deletions deploy/fly-io/README.md
Original file line number Diff line number Diff line change
@@ -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
```
13 changes: 9 additions & 4 deletions deploy/fly-io/fly.toml
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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'
Expand Down Expand Up @@ -42,6 +47,6 @@ kill_signal = 'SIGTERM'
path = '/minio/health/live'

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

0 comments on commit a992593

Please sign in to comment.