0% found this document useful (0 votes)
3 views26 pages

Flyio Springboot Guide

The Fly.io Deployment Guide provides a comprehensive walkthrough for deploying a Spring Boot application with PostgreSQL on the Fly.io platform, utilizing its free tier. It covers prerequisites, necessary project modifications, and the steps to create a PostgreSQL database, configure the application, and set up secrets for sensitive information. Following this guide will result in a live Spring Boot app with a public HTTPS URL and a connected PostgreSQL database.

Uploaded by

darazzfree
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views26 pages

Flyio Springboot Guide

The Fly.io Deployment Guide provides a comprehensive walkthrough for deploying a Spring Boot application with PostgreSQL on the Fly.io platform, utilizing its free tier. It covers prerequisites, necessary project modifications, and the steps to create a PostgreSQL database, configure the application, and set up secrets for sensitive information. Following this guide will result in a live Spring Boot app with a public HTTPS URL and a connected PostgreSQL database.

Uploaded by

darazzfree
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Fly.

io Deployment Guide — Spring Boot workflow-approval-system

[Link] Free Tier


Complete Deployment Guide for Spring Boot + PostgreSQL
workflow-approval-system | Java 17 | Spring Boot 3.x | PostgreSQL

Free Tier Zero Cost Auto HTTPS Global CDN


Always-free VMs + No credit card needed Built-in TLS + custom Edge deployments
Postgres for basics domains worldwide

What You Will Have After This Guide


Your Spring Boot app live on the internet with a public HTTPS URL
A free PostgreSQL database hosted on [Link] — fully connected
A repeatable deploy workflow: push changes, run one command, it goes live
Environment variables, secrets, and Spring profiles wired correctly
Practical troubleshooting commands for when things go wrong

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

1 Understanding [Link] — The Big Picture

[Link] is a platform that takes your Docker container and runs it on their global infrastructure.
Think of it like giving your app a permanent home on the internet — free of cost for small
projects. Unlike AWS which needs EC2 + RDS setup, [Link] handles all the infrastructure
automatically.

How [Link] Free Tier Works


Resource Free Allowance

VMs (Machines) 3 shared-CPU VMs

RAM 256 MB per VM

PostgreSQL 3 GB storage, 1 VM

Bandwidth 100 GB outbound/month

Custom Domain Unlimited

Deploy pipelines Unlimited

Important: [Link] free tier requires a credit card on file but will NOT charge you as long as you
stay within limits. There is a hard spending limit you can set to $0 for peace of mind.

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

2 Prerequisites & Installing flyctl

Step 1: Install the Fly CLI (flyctl)


flyctl is the command-line tool you use to manage everything on [Link] — deploying apps,
creating databases, viewing logs, and managing secrets. Install it once and you're set.

On Linux / WSL (Ubuntu)

$ curl -L [Link] | sh

# Add to your PATH permanently


$ echo 'export FLYCTL_INSTALL="/home/$USER/.fly"' >> ~/.bashrc
$ echo 'export PATH="$FLYCTL_INSTALL/bin:$PATH"' >> ~/.bashrc
$ source ~/.bashrc

# Verify installation
$ fly version
fly v0.3.x linux/amd64 ...

On macOS

$ brew install flyctl

# Verify
$ fly version

On Windows (PowerShell)

# Run in PowerShell as Administrator


$ pwsh -Command "iwr [Link] -useb | iex"

Step 2: Sign Up and Log In


1. Go to [Link] and create a free account
2. Add a credit card (required, but you will not be charged on the free tier)
3. Log in from your terminal:

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

$ fly auth login

# This opens a browser tab — log in and come back to terminal


# You should see: Successfully logged in as you@[Link]

Tip: Setting a $0 Spending Limit


In [Link] dashboard → Billing → set Hard Limit to $0 to ensure you are never charged
accidentally. The free allowances will still apply — you simply cannot exceed them.

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

3 Changes to Your Spring Boot Project

Before deploying, you need to make specific changes to your project. This section covers every
file you touch and exactly why each change is needed.

3.1 Create a Production Spring Profile


Your [Link] currently has dev settings (local DB, debug logging). For [Link] you
need a prod profile that reads from environment variables.

Create src/main/resources/[Link]

# ─── SERVER ──────────────────────────────────────────────────


# [Link] injects PORT env variable — your app MUST listen on it
[Link]=${PORT:8080}

# ─── DATABASE ────────────────────────────────────────────────


# [Link] gives you DATABASE_URL in postgres://user:pass@host/db format
# Spring needs jdbc:postgresql:// format, so we use a workaround below
[Link]=${JDBC_DATABASE_URL}
[Link]=${DB_USER}
[Link]=${DB_PASSWORD}
[Link]-class-name=[Link]

# ─── JPA / HIBERNATE ─────────────────────────────────────────


# validate = check schema matches entities, do not modify DB
# use update for first deploy, then switch to validate
[Link]-auto=update
[Link]-platform=[Link]
[Link]-sql=false

# ─── JWT ─────────────────────────────────────────────────────


# These come from [Link] secrets — never hardcoded here
[Link]=${JWT_SECRET}
[Link]=${JWT_EXPIRATION:86400000}

# ─── LOGGING ─────────────────────────────────────────────────


[Link]=WARN
[Link]=INFO

# ─── JVM MEMORY TUNING ───────────────────────────────────────


# Keep Spring Boot within 256MB Fly free tier RAM limit
[Link]-initialization=true

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

3.2 Create the Dockerfile


[Link] builds and runs your app as a Docker container. Create this Dockerfile in the root of your
project (same level as [Link]).

File: Dockerfile (project root)

# ── STAGE 1: BUILD ───────────────────────────────────────────


# Use Maven + Java 17 to compile and package your app
FROM maven:3.9-eclipse-temurin-17 AS builder

# Set working directory inside the build container


WORKDIR /app

# Copy Maven config first (better layer caching)


# If [Link] didn't change, Maven dependencies are cached
COPY [Link] .
RUN mvn dependency:go-offline -B

# Now copy source code and build the fat JAR


COPY src ./src
RUN mvn clean package -DskipTests -B

# ── STAGE 2: RUN ─────────────────────────────────────────────


# Minimal JRE image — much smaller than full JDK
FROM eclipse-temurin:17-jre-alpine

WORKDIR /app

# Copy only the built JAR from stage 1


COPY --from=builder /app/target/*.jar [Link]

# Create non-root user for security


RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring

# PORT env variable is injected by [Link] at runtime


# We expose it here for documentation, actual binding is via ENV
EXPOSE 8080

# JVM flags to fit within 256MB free tier memory


# -Xmx192m = max heap 192MB
# -XX:+UseSerialGC = use single-threaded GC (better for small containers)
# -[Link]=prod = activate our prod profile
ENTRYPOINT ["java", "-Xmx192m", "-XX:+UseSerialGC", \ "-
[Link]=prod", "-jar", "[Link]"]

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

3.3 Create .dockerignore


This tells Docker to skip unnecessary files during build, making builds faster and the image
smaller.

File: .dockerignore (project root)

.git
.gitignore
*.md
target/
.mvn/
mvnw*
.idea/
*.iml
.vscode/
docker-compose*.yml
*.env
*.[Link]

3.4 Update [Link] — Verify Java Version


Make sure your [Link] explicitly targets Java 17. [Link] will use whatever the Dockerfile
specifies, but this keeps things consistent.

<!-- In [Link], inside <properties> block -->


<properties>
<[Link]>17</[Link]>
<[Link]>17</[Link]>
<[Link]>17</[Link]>
</properties>

<!-- Also ensure Spring Boot Maven Plugin is present -->


<build>
<plugins>
<plugin>
<groupId>[Link]</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

File Structure After All Changes


workflow-approval-system/
[Link]
Dockerfile <-- NEW

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

.dockerignore <-- NEW


src/main/resources/
[Link] (keep as-is for local dev)
[Link] <-- NEW (used on [Link])

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

4 Creating the Free PostgreSQL Database on [Link]

[Link] has its own managed Postgres service. You create it once, and it runs on the free tier
permanently. The database runs inside Fly's network, so your Spring Boot app connects to it
internally (no public internet roundtrip).

Step 1: Create the Postgres Cluster


# Replace 'workflow-db' with any name you want
# This creates a free single-node Postgres cluster
$ fly postgres create --name workflow-db

# You will be prompted to choose:


# Organization: personal
# Region: pick closest to your users (e.g., lax, ams, sin)
# Configuration: Development (single node, free tier)

# After creation, [Link] prints something like:


# Postgres cluster workflow-db created
# Username: postgres
# Password: <RANDOM_PASSWORD> <-- SAVE THIS NOW
# Hostname: [Link]
# DSN: postgres://postgres:<PASS>@[Link]

IMPORTANT: Save Your Database Password


[Link] shows the database password ONCE at creation time.
Copy it immediately and save it somewhere safe (a password manager).
If you lose it, you will need to reset the password via: fly postgres connect -a workflow-db

Step 2: Understand Internal vs External Connection


Connection Type URL Format

Internal (private) [Link]

External (public) fly-proxy to your DB

Step 3: Create the Application Database


By default, Fly Postgres creates only a 'postgres' superuser database. Create a dedicated
database for your app:

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

# Connect to the Postgres cluster


$ fly postgres connect -a workflow-db

# You are now inside psql — run these SQL commands:


postgres=# CREATE DATABASE workflow_approval;
postgres=# CREATE USER workflow_user WITH PASSWORD 'your_strong_password_here';
postgres=# GRANT ALL PRIVILEGES ON DATABASE workflow_approval TO workflow_user;
postgres=# \q

# Back in terminal

Step 4: Verify the Database is Running


$ fly status -a workflow-db

# Should show:
# App = workflow-db
# Status = running
# Machines = 1 total, 1 started

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

5 Initializing Your Spring Boot App on [Link]

Step 1: Run fly launch in Your Project Root


# Navigate to your project
$ cd /path/to/workflow-approval-system

# Initialize the [Link] app — this creates [Link] config file


$ fly launch --no-deploy

# You will be asked:


# App name: workflow-approval-system (or leave blank for auto-name)
# Region: choose closest to you
# Would you like to set up a Postgresql database? → NO (we already created it)
# Would you like to deploy now? → NO

# This creates [Link] in your project root

Step 2: Edit [Link] — Full Configuration


[Link] is the heart of your [Link] deployment. Replace the generated content with this carefully
configured version:

File: [Link] (project root)

# App name must match what you chose in fly launch


app = 'workflow-approval-system'
primary_region = 'lax' # Change to your chosen region

[build]
# Use our Dockerfile for building
dockerfile = 'Dockerfile'

[env]
# Non-secret environment variables
# [Link] automatically sets PORT, so Spring Boot picks it up
SPRING_PROFILES_ACTIVE = 'prod'
JAVA_OPTS = '-Xmx192m -XX:+UseSerialGC'

# JDBC URL using internal [Link] hostname


# workflow-db = your postgres cluster name
# workflow_approval = database name you created
JDBC_DATABASE_URL =
'jdbc:postgresql://[Link]/workflow_approval'
DB_USER = 'workflow_user'

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

# JWT expiration in milliseconds (24 hours = 86400000)


JWT_EXPIRATION = '86400000'

[http_service]
# [Link] routes external HTTPS traffic to your app on port 8080
internal_port = 8080
force_https = true
auto_stop_machines = false # Keep alive on free tier
auto_start_machines = true
min_machines_running = 0

[http_service.concurrency]
type = 'requests'
hard_limit = 25
soft_limit = 20

[[vm]]
# Free tier machine size
cpu_kind = 'shared'
cpus = 1
memory_mb = 256

[checks]
[[Link]]
port = 8080
type = 'http'
interval = '30s'
timeout = '10s'
# Adjust this path to your app's health endpoint
# Spring Boot Actuator: /actuator/health
# Or use any public endpoint that returns 200
path = '/actuator/health'

Region Codes Reference


lax = Los Angeles | ord = Chicago | iad = Virginia
ams = Amsterdam | fra = Frankfurt | sin = Singapore
nrt = Tokyo | syd = Sydney | gru = Sao Paulo
Pick the region closest to your primary users for lowest latency.

Step 3: Add Spring Boot Actuator (for Health Checks)


[Link] needs a health check endpoint to know your app is running. Add Actuator to [Link] if
you don't have it:

<!-- Add to [Link] <dependencies> -->


<dependency>
<groupId>[Link]</groupId>

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

Then in [Link], expose the health endpoint without authentication:

# In [Link] — add these lines


[Link]=health
[Link]-details=never

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

6 Setting Secrets — Sensitive Environment Variables

Secrets are encrypted environment variables stored securely by [Link]. They are injected at
runtime and never visible in logs or [Link]. Use secrets for passwords, JWT keys, and anything
sensitive.

Set All Secrets at Once


# Replace each value with your actual secrets
# Run this ONCE — it sets all secrets in one command

$ fly secrets set \


DB_PASSWORD='your_strong_database_password_here' \
JWT_SECRET='your_very_long_random_jwt_secret_at_least_256_bits' \
-a workflow-approval-system

# Verify secrets are set (values are never shown)


$ fly secrets list -a workflow-approval-system

# Should show:
# NAME DIGEST CREATED AT
# DB_PASSWORD sha256:abc... 2024-01-01T00:00:00Z
# JWT_SECRET sha256:def... 2024-01-01T00:00:00Z

Generating a Secure JWT Secret


# Generate a cryptographically secure 256-bit (32-byte) random secret
# Option 1: Using OpenSSL (Linux/Mac/WSL)
$ openssl rand -hex 64

# Option 2: Using Python


$ python3 -c "import secrets; print(secrets.token_hex(64))"

# Copy the output and use it as JWT_SECRET above

Variable Where Set Value Type Why This Way

JDBC_DATABASE_ [Link] [env] Internal DB URL Not secret — internal


URL hostname only

DB_USER [Link] [env] Database username Not secret —


username alone is
harmless

DB_PASSWORD fly secrets Database password Secret — must be

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

encrypted

JWT_SECRET fly secrets Random hex string Secret —


compromise = all
tokens invalid

JWT_EXPIRATION [Link] [env] Milliseconds number Not secret — just a


config value

SPRING_PROFILES [Link] [env] 'prod' Not secret — tells


_ACTIVE Spring which profile

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

7 First Deployment — Step by Step

You are now ready to deploy. This section walks through the entire first deployment with what to
expect at each stage.

Step 1: Attach the Database to Your App


This command creates a DATABASE_URL secret in your app that links to the Postgres cluster:

$ fly postgres attach workflow-db -a workflow-approval-system

# This outputs something like:


# The following secret was added to workflow-approval-system:
# DATABASE_URL=postgres://workflow_user:...@[Link]/
workflow_approval

# Note: We're using JDBC_DATABASE_URL in our properties file,


# so this DATABASE_URL attachment is informational — confirm your
# JDBC_DATABASE_URL in [Link] matches the connection details above

Step 2: Run the Deployment


# From your project root (where [Link] lives)
$ fly deploy -a workflow-approval-system

# What happens (you will see this output):

# ==> Building image


# --> Pushing image done
#
# ==> Creating release
# --> release v2 created
#
# ==> Deploying to machines
# --> Machine e784...: starting
# --> Machine e784...: started
#
# Visit your newly deployed app at [Link]

Step 3: Verify the App is Running


# Check overall status

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

$ fly status -a workflow-approval-system

# Check live logs (most useful for debugging)


$ fly logs -a workflow-approval-system

# Test the health endpoint


$ curl [Link]
# Expected: {"status":"UP"}

First Deploy Is the Slowest


The first deployment builds your Docker image from scratch, downloads all Maven
dependencies, and compiles. This can take 3-8 minutes.
Subsequent deploys are much faster (1-3 min) because Docker layer caching skips unchanged
steps.
The Maven dependencies layer is only re-downloaded if [Link] changes.

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

8 Deploying Changes — The Day-to-Day Workflow

Every time you make changes to your code and want them live, this is the exact workflow you
follow. It is the same command every time: fly deploy.

Standard Deploy Workflow


# 1. Make your code changes locally
# 2. Test them locally (mvn spring-boot:run with dev profile)
# 3. Commit to git (optional but good practice)
$ git add .
$ git commit -m "feat: add approval workflow endpoint"

# 4. Deploy to [Link]
$ fly deploy
# ([Link] in current directory is auto-detected)

# 5. Monitor the deployment


$ fly logs

# 6. Verify live
$ curl [Link]

Types of Changes and What They Trigger


Change Type Files Changed What [Link] Does Deploy Time

Code only .java files Rebuilds from 'COPY ~2-3 min


src' layer

New dependency [Link] Re-downloads all ~4-6 min


deps + rebuild

Config only application- Rebuilds from 'COPY ~2-3 min


[Link] src' layer

Env var / secret [Link] or fly secrets Restarts existing ~30 sec
set machine (no build)

Dockerfile change Dockerfile Full rebuild from ~5-8 min


scratch

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

Updating Secrets After Initial Deploy


# Updating a single secret triggers an automatic restart
$ fly secrets set JWT_SECRET='new_secret_value' -a workflow-approval-system

# Update multiple secrets at once


$ fly secrets set \
JWT_SECRET='new_value' \
DB_PASSWORD='new_password' \
-a workflow-approval-system

# Remove a secret
$ fly secrets unset OLD_VARIABLE -a workflow-approval-system

Updating Environment Variables in [Link]


# 1. Edit [Link] — change any value in [env] section
# 2. Deploy to apply the change
$ fly deploy

# Example: Change JWT expiration to 7 days


# In [Link] [env]:
# JWT_EXPIRATION = '604800000'
# Then: fly deploy

Rolling Back to a Previous Version


# List all releases
$ fly releases -a workflow-approval-system

# Shows: VERSION STATUS CREATED AT


# v5 deployed 2 hours ago
# v4 deployed 1 day ago <-- want to roll back here

# Deploy a specific image from a previous release


$ fly deploy --image [Link]/workflow-approval-system:deployment-04

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

9 Database Management — Connecting & Migrating

Connecting to the Database from Terminal


# Direct psql access via fly proxy
$ fly postgres connect -a workflow-db

# You are now in psql inside the [Link] network


postgres=# \c workflow_approval -- switch to your database
postgres=# \dt -- list all tables
postgres=# SELECT * FROM users LIMIT 5;
postgres=# \q -- exit

Connecting with a GUI Tool (DBeaver / pgAdmin)


To use a GUI database tool, you need to proxy the connection to your local machine. Open a
terminal and run:

# This creates a tunnel from localhost:5432 → [Link] DB


# Keep this terminal open while using your GUI tool
$ fly proxy 5432 -a workflow-db

# In DBeaver / pgAdmin, use these connection settings:


# Host: localhost
# Port: 5432
# Database: workflow_approval
# Username: workflow_user
# Password: (the password you set during DB creation)

Running Database Migrations


If you're using Flyway or Liquibase, your migrations run automatically on app startup via Spring
Boot's auto-configuration. Make sure migration files are in the right place:

# Flyway migration files location:


src/main/resources/db/migration/
V1__Create_users_table.sql
V2__Create_workflow_table.sql
V3__Add_approval_status.sql

# When fly deploy runs, Spring Boot starts, Flyway detects


# new migration files, and applies them automatically.

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

# Check migration status from logs:


$ fly logs -a workflow-approval-system | grep -i flyway

DDL Auto Configuration for Production


In [Link], after your FIRST successful deploy:
Change: [Link]-auto=update
To: [Link]-auto=validate
This prevents Hibernate from modifying your production schema and forces you to use proper
migrations.

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

10 Troubleshooting — Common Errors & Fixes

Viewing Logs
# Live logs (follow mode)
$ fly logs -a workflow-approval-system

# Search for errors only


$ fly logs -a workflow-approval-system | grep ERROR

# Check a specific machine's logs


$ fly machine list -a workflow-approval-system # get machine ID
$ fly logs -a workflow-approval-system -m <machine-id>

Common Errors and Their Fixes

Error / Symptom Cause & Fix

OOMKilled / Out of Memory JVM heap too large. Check Dockerfile ENTRYPOINT has -
Xmx192m. Also enable [Link]-initialization=true in
[Link]

Connection refused to DB Verify JDBC_DATABASE_URL in [Link] uses .internal


hostname. Run: fly postgres connect -a workflow-db to test DB is
reachable

Port binding error [Link] must be ${PORT:8080} in [Link]


— [Link] assigns the PORT variable dynamically

Health check failing Check /actuator/health returns 200. Verify spring-boot-starter-


actuator is in [Link] and endpoint is exposed

App starts then crashes Run: fly logs to see Java exceptions. Usually missing env
immediately variable. Check fly secrets list and [Link] [env]

JWT authentication errors JWT_SECRET is not set or too short. Minimum 256 bits (64 hex
chars). Run: fly secrets set JWT_SECRET='...'

413 Request Too Large Add to [Link] [http_service]: max_request_body_size = '10MB'.


Adjust as needed

Deploy stuck at 'Waiting for Health check path in [Link] is wrong, or app is crashing before
machine' health check. Run fly logs immediately after deploy.

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

Useful Diagnostic Commands


# SSH into your running machine
$ fly ssh console -a workflow-approval-system

# Check env variables inside the machine


$ fly ssh console -a workflow-approval-system -C 'env | grep -E "DB|JWT|PORT|
SPRING"'

# Restart the app without a new deployment


$ fly machines restart -a workflow-approval-system

# Check resource usage


$ fly machine status <machine-id> -a workflow-approval-system

# Destroy and recreate if something is broken beyond repair


$ fly machines destroy <machine-id> -a workflow-approval-system
$ fly deploy # This recreates the machine

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

11 Custom Domain & HTTPS (Optional)

[Link] gives you a free subdomain like [Link] with automatic HTTPS.
If you want a custom domain (e.g., [Link]), follow these steps.

Setting Up a Custom Domain


4. Add a certificate for your domain:

$ fly certs add [Link] -a workflow-approval-system

# [Link] outputs DNS records you need to add:


# Type: CNAME
# Name: [Link]
# Value: [Link]

5. Add the CNAME record in your DNS provider (Cloudflare, Route53, GoDaddy, etc.)
6. Wait 5-15 minutes for DNS propagation
7. Verify the certificate is issued:

$ fly certs show [Link] -a workflow-approval-system


# Status should show: Verified

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

12 Quick Reference Cheatsheet

Most-Used Commands
Command What It Does

fly deploy Build and deploy the current code to production

fly logs -a <app> View live application logs

fly status -a <app> Check if app and machines are running

fly secrets set KEY=val Add or update an encrypted environment variable

fly secrets list -a <app> List all secret names (values hidden)

fly postgres connect -a <db> Open psql shell directly in the DB cluster

fly proxy 5432 -a <db> Tunnel DB port to localhost for GUI tools

fly ssh console -a <app> SSH into the running application machine

fly machines restart -a <app> Restart app without redeploying

fly releases -a <app> List all deployment history

fly scale memory 512 -a Increase memory (may cost money above free tier)
<app>

Complete File Checklist

Files You Must Create or Modify


CREATE: Dockerfile (root of project)
CREATE: .dockerignore (root of project)
CREATE: [Link] (root, via fly launch)
CREATE: src/main/resources/[Link]
MODIFY: [Link] (add Actuator if missing)
KEEP: src/main/resources/[Link] (local dev, unchanged)

Environment Variables Reference


Variable Name Set In

PORT Auto by [Link]

Page | Deepsan's Deployment Docs


[Link] Deployment Guide — Spring Boot workflow-approval-system

SPRING_PROFILES_AC [Link] [env]


TIVE

JDBC_DATABASE_URL [Link] [env]

DB_USER [Link] [env]

DB_PASSWORD fly secrets

JWT_SECRET fly secrets

JWT_EXPIRATION [Link] [env]

Your app is now live at:


[Link]
Free, HTTPS-enabled, globally accessible.

Page | Deepsan's Deployment Docs

You might also like