Skip to content

Fly launch sequence #35

@ndrean

Description

@ndrean

This app uses 2 databases: PostgreSQL & SQLite.

1️⃣ "pre-launch" to auto-detect Postgres: this will provision a PG app

fly launch --no-deploy -y

2️⃣ Setup volumes

Check if the Pg app is created:

fly pg list

NAME           	OWNER   	STATUS  	LATEST DEPLOY
liveview-pwa-db	personal	deployed

Set LOGICAL to PG conf:

fly pg config update --wal-level logical -a liveview-pwa-db -y

❗️ You get by default a "dev" machine with 256MB. You may need to upgrade the PG machine for a 512MB one. I got teh machine_id (2874469f1dde98) from the Fly desktop:

fly machine update 2874469f1dde98 --vm-memory 512 -a liveview-pwa-db

Set a volume to persist the SQLite file:

fly volumes create db --size 1 --region bog -y

3️⃣ Reconfigure "fly.toml"

❗️The "fly.toml" is updated by Fly. Paste the following (the IPV6 ERL flags are important):

# [deploy]
#   release_command = '/app/bin/migrate'

[env]
DATABASE_PATH = '/data/db/main.sqlite3'
MIX_ENV = 'prod'
PHX_HOST = 'liveview-pwa.fly.dev'
PORT = '8080'
ECTO_IPV6 = 'true'
ERL_AFLAGS = '-proto_dist inet6_tcp'

[[mounts]]
source = 'db'
destination = '/data'
auto_extend_size_threshold = 80
auto_extend_size_increment = '1GB'
auto_extend_size_limit = '10GB'

🚀 Deploy

fly deploy

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions