To start your Phoenix server in development:
- Install dependencies with
mix deps.get - Start Phoenix endpoint with
mix phx.server
Now you can visit localhost:4000 from your browser.
We use distillery and docker for deploy.
- Build the release
make build - Deploy it to the registry
make push
Once in the server you can run the following commands
~/bespiral/bespiral/bin/bespiral remote_consoleto attach to the running process~/bespiral/bespiral/bin/bespiral foregroundto run it and keep the output locked to the current session~/bespiral/bespiral/bin/bespiral startto start it on the background~/bespiral/bespiral/bin/bespiral consolefor a IEx session
To run migrations you can run:
~/bespiral/bespiral/bin/bespiral migrateFor running migrations~/bespiral/bespiral/bin/bespiral seedFor adding seeding
docker build -t 'bespiral/backend:latest' .
The default env will be development, if you want to build it for prod:
docker build -t 'bespiral/backend:latest' --build-arg "MIX_ENV=prod" .
docker run -t 'bespiral/backend:latest'
If you are running in prod env you'll also need to set the database env variables:
docker run -e "DB_HOST=example.host" -e "DB_PORT=5432" -e "DB_USER=user" -e "DB_PASSWORD=123" -e "BESPIRAL_WALLET_PASSWORD=kw123" -t 'bespiral/backend:latest'
# OR
docker run --env-file=env_file_path -t 'bespiral/backend:latest'If you are using docker-compose:
version: '3'
services:
x:
image: 'someimage:latest'
env_file: env_file_path
-- or
environment:
- BESPIRAL_WALLET_PASSWORD=123
- DB_HOST=example.host
- DB_PORT=5432
- DB_USER=user