Pet project to track information about electricity outages.
- install NodeJS, nvm, fly console
nvm usenpm ci- see https://fly.io/docs
- create fly apps with
electrobotandelectrobotstgnames - crate
pg-electro-botandpg-electro-bot-stgfly Postgres clusters for prod and stg envs - attach apps to corresponding Postgres clusters
- set secrests for prod and stg envs (see apps/electro-bot/.env.example)
- set values in apps/electro-bot/.env (see apps/electro-bot/.env.example and fly.toml)
npm start
npm run migrate:electro-botto apply migrationsnpx knex migrate:make some_migration_nameto create new migration
Staging: fly proxy 5433 -a pg-electro-bot-stg, production: fly proxy 5433 -a pg-electro-bot.
TODO: this is tmp solution that causes downtime during deployment, come up with normal flow.
!Always deploy staging env first (this minimizes prod downtime since all images are already built).
Staging:
fly --config fly.stg.toml scale count 0fly --config fly.stg.toml deployfly --config fly.stg.toml scale count 1
Production:
fly scale count 0fly deployfly scale count 1
Staging: fly apps restart electrobotstg, production: fly apps restart electrobot.
Staging: fly --config fly.stg.toml logs, production: fly logs.
Do this when no space left on builder device:
fly apps list | grep builderfly apps destroy <name>
npm run gendoc