- PostgreSQL 12.3
- Elixir 1.11.2 OTP 22
- NPM 7.0.10
First fetch dependencies
mix deps.get
Fetch NPM dependencies
npm install --prefix assets/
For the database you can use docker-compose
with our docker-compose.yml file that sets it up. Otherwise you need to create a user named sponsorly_user
with password sponsorlydevelop
, give permission to create a database, and run mix ecto.create
.
Then we have to run the migrations
mix ecto.migrate
Last, we start our Phoenix server
mix phx.server
Now you can visit localhost:4000
from your browser.
For deployment we are using releases in a Dockerfile.
Part of using releases is moving the configuration to releases.exs which runs on startup instead of compilations as the other configs. This allows us to have set everything at runtime and not worry about secrets leaking to the world (or at least not so easily).
The following are the required environment variables used in configuration:
DATABASE_URL
: URL to access your prod databaseSECRET_KEY_BASE
: Secret key used by Phoenix, generate by doingmix phx.gen.secret
POSTMARK_API_KEY
: Postmark API key, only required if using Postmark for sending mailsUSE_LOCAL_ADAPTER
: set to"true"
to useBamboo.LocalAdapter
to send mails instead of Postmark, default"false"
The following are the optional environment variables used in configuration:
POOL_SIZE
: size of connections pool to database, default:10
PORT
: port used by Phoenix, default:4000
After making a deployment if you need to run migrations you can connect to the instance and use Sponsorly.Release.migrate()