Tab 1.
1. join org account
- - may be required to authorize account by signing up with credit card even when joining an already authorized main account.
- ( 5$ - may be refunded).
2. two ways to init
- command line.
- github connector.
3. command line tool
- install flyctl.
- https://fly.io/docs/flyctl/install.
- fly machine · Fly Docs.
4. login
- flyctl auth login (activate the correct browser window prior or copy link).
5. create app
- flyctl launch.
2. fly launch --org <organization-id>3. Config file
- fly.toml.
- org cannot be specified here.
- 6. scale.
1. Specify number of machines (additional can be suspended - reducing billing)
- fly scale count 1.
- suspended cpu & ram is not billed.
3. RootFS is billed at (only when suspended - not while running where it is covered by normal charge)
- $0.15 per GB per month for used RootFS storage, prorated by time.
4. region
- you can have parallel servers in different regions closer to user.
7. deploy
- deploy.
2. redeply
2. redeply 1. fly deploy --image registry.fly.io/<prveious_image_id>3. config only
3. config only 1. fly deploy --config fly.toml --image registry.fly.io/<app_name>:deployment-__4. without depot
1. fly deploy --depot=false8. Status
1. fly status
- shows image & machines table.
9. Image
- fly image show.
10. Config
1. fly config show
- shows detailed - including config json (NOT yaml as .toml).
2. fly config save
- save current config to fly.toml.
11. Custom domain
1. add dns records
- A record (ipv4) shared and AAAA (ipv6) record.
- the AAAA record is used by fly.io to connect to your app.
- CNAME is the alternate route.
12. SSL
12. SSL 4. fly certs add <domain>- go to the certificate tab of the page.
- create certificate for the domain/subdomain.
- use wild card only when necessary.
- add acme_challenge dns record for certificate issuance.
13. CDN
- https://fly.io/docs/networking/understanding-cloudflare.
- disable cloudflare proxy till the issuance of the certificate.
- if using cloudflare proxy - delete A record as it conflicts, keep only AAAA record with strict https.
14. Scale
14. Scale 1. fly scale count <n_machines> –region <region_code>- https://fly.io/docs/reference/regions.
- CI/CD.
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/.
**name.** Fly Deploy.
## on
### push
### branches
- production.
## jobs
### deploy
**name.** Deploy app.
### runs-on
ubuntu-latest
### concurrency: deploy-group
# optional: ensure only one action runs at a time.
### steps
**- uses.** Actions/checkout@v4.
### - name: create .env file
### run: |
echo "NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}" > .env
**- uses.** Superfly/flyctl-actions/setup-flyctl@master.
- run: flyctl deploy --remote-only
Env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
3. Note that the env variables required at build time for docker build has to be passed as arg to the Dockerfile.
4. get api key from app page.
ARG NEXT_PUBLIC_API_URL.
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
# write Vite env file so the value is inlined into the client build.
RUN printf "NEXT_PUBLIC_API_URL=%s\n" "$NEXT_PUBLIC_API_URL" > .env.production.
## 16. builder
### 1. the docker image is built of fly.io builder machines
1. this can be selected - capacity and region.
2. may have to be changed if no builder is found while deploying due to capacity exhaustion in the region.
## 17. suspend
1. suspended machines resume functioning within sub-second (to < 3-5 seconds range) range - allowing https responses to complete.
2. this can be helpful to run to seldom used apps - to run at near zero cost, and be always available.
### 3. config
## [http_service]
Auto_stop_machines = 'suspend'.
Auto_start_machines = true.
Min_machines_running = 1.
# i.e. not suspended but actually running.
Processes = ['app'].
## 18. docker stage
1. specify which stage of the docker is to be served by.
2. in fly.toml.
## [build]
build-target = "release"
## in Dockerfile
FROM base AS release.
## 19. capacity
Size = 'shared-cpu-1x'.
Memory = '512mb'.
Cpu_kind = 'shared'.
Cpus = 1.
Min memory is constrained to machine size.
And factored by no. of cpus.
## 20. monitoring
1. Manged grafana.
## 21. db
1. tunnel (for local connection - to say debug).
2. (better to keep of separate port than default).
flyctl proxy 5433 -a
## 22. pricing
1. Fly.io Resource Pricing · Fly Docs.
## 23. issues
### 1. stuck machines
1. machines getting stuck - displayed ‘red’ for no apparent reason,.
**2. could be out of memory - TODO.** Need to investigate.
3. kill fixes, ?no way to auto restart?
## 24. Terminal
1. fly ssh console.
25. sftp.
## 26. fly ssh sftp shellogs
### 1.
Fly logs.
## 27. Restart
- Restart 1. flyctl machine kill <machine_id> [ -a app_name ]
1. works on stuck machines.
- Restart 2. flyctl machine <start|stop|restart|kill> <machine_id>
### 3. policy
1. https://fly.io/docs/machines/guides-examples/machine-restart-policy.
### 2. default
### 1. on-failure
Try up to 10 times to automatically restart the Machine if it exits with a non-zero exit code, before letting it stop.
[[restart]].
policy = "<never | always | on-failure>"Retries = 10.
Processes = ["app"].
## 28. Health Check
1. fly.io expects the web process be bound to 0.0.0.0.Updated:
2026 Aug 19

