Skip to content

Self-hosting with Fly.io

Deploying to Fly.io to self-host Privatefolio on the edge using the official Docker image from GitHub Container Registry (GHCR). Privatefolio includes a fly.toml configuration file for easy deployment on this cloud provider.

Before we get started you must have Fly.io CLI installed:

Terminal window
flyctl version
# v0.3.112

If you don’t have it, get it from Fly.io.

You must also have a Fly.io account (Sign up).

Terminal window
fly auth login

Navigate to the root directory of the Privatefolio repository where fly.toml is located. Run:

Terminal window
fly launch --no-deploy
  • You will be asked if you wish to copy this configuration file to the new app. Answer y (yes).
  • This command reads the fly.toml file and sets up the application on Fly.io based on the configuration.
  • --no-deploy: We skip the initial deploy because we want to ensure the volume is created first.

The fly.toml specifies a volume mount for data persistence. Create the volume before the first deploy:

Terminal window
fly volumes create privatefolio-data --size 1
  • --size 1: Specifies the volume size in GB (1 GB is usually sufficient to start).
  • You will be prompted to choose a region for the volume. Select the same region as your app for optimal performance.
Terminal window
fly deploy
  • This command uses the pre-built image specified in fly.toml from GHCR and deploys it to the Fly.io platform.
  • It respects the settings in fly.toml, including environment variables (PORT=5555), volume mounts (privatefolio-data to /app/data), and service configuration (HTTP service on the internal port).

After deployment, fly deploy will output the public URL for your application (e.g., https://privatefolio.fly.dev). The app will be available at this URL.

Visit your Fly.io app URL in your browser to access Privatefolio.

This is the configuration file for the Fly.io app.

// [!include ~/../../fly.toml]

All data is stored in the /app/data directory inside the container, which is mounted to a persistent volume called privatefolio-data. This ensures that your data is persisted even if the app is redeployed or restarted.

To backup your data, you can use Fly.io volume commands:

Terminal window
fly volumes list # List all volumes
fly volumes show privatefolio-data # View volume details

To view logs from your Fly.io app:

Terminal window
fly logs -a <your-app-name>

To follow the logs in real-time:

Terminal window
fly logs -f -a <your-app-name>

To upgrade to the latest version of Privatefolio, run:

Terminal window
fly deploy

Fly.io will pull the latest image from GHCR and deploy the new version.

Use flyctl to manage your deployed app:

  • App status: fly status -a <your-app-name>
  • Machine status: fly machine list -a <your-app-name>
  • Logs: fly logs -a <your-app-name>
  • SSH access: fly ssh console -a <your-app-name>
  • Scale: fly scale count 2 -a <your-app-name> (increase instances)

To delete all personal data and remove your Fly.io deployment:

Terminal window
# Delete the app (this also removes associated volumes)
fly apps destroy <your-app-name>
# Or manually delete volume first, then app
fly volumes destroy privatefolio-data -a <your-app-name>
fly apps destroy <your-app-name>