Skip to content

Instantly share code, notes, and snippets.

@carlogilmar
Created October 30, 2019 00:18
Show Gist options
  • Save carlogilmar/b0a1c4a76154821c7eea8201bb313bda to your computer and use it in GitHub Desktop.
Save carlogilmar/b0a1c4a76154821c7eea8201bb313bda to your computer and use it in GitHub Desktop.
Docker
Steps
1. mix release.init
2. Create config/releases.exs
```
import Config
secret_key_base = System.fetch_env!("SECRET_KEY_BASE")
app_port = System.fetch_env!("APP_PORT")
app_hostname = System.fetch_env!("APP_HOSTNAME")
db_user = System.fetch_env!("DB_USER")
db_password = System.fetch_env!("DB_PASSWORD")
db_host = System.fetch_env!("DB_HOST")
config :demo, DemoWeb.Endpoint,
http: [:inet6, port: String.to_integer(app_port)],
secret_key_base: secret_key_base
config :demo,
app_port: app_port
config :demo,
app_hostname: app_hostname
# Configure your database
config :demo, Demo.Repo,
username: db_user,
password: db_password,
database: "demo_prod",
hostname: db_host,
pool_size: 10
```
3. Create a .env file
```
APP_PORT=4000
APP_HOSTNAME=localhost
DB_USER=postgres
DB_PASSWORD=pass
DB_HOST=localhost
SECRET_KEY_BASE=Y0uRvErYsecr3TANDL0ngStr1ng
```
4. modify config/prod.ex
```
config :demo, DemoWeb.Endpoint, server: true
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment