-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for Docker in production
- Loading branch information
Showing
7 changed files
with
159 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,69 @@ | ||
## Required for all environments | ||
# ----------------------------------------------------------------------------- | ||
# Required for all environments | ||
# ----------------------------------------------------------------------------- | ||
|
||
## Email address from which system emails will be sent | ||
EMAIL_FROM=[email protected] | ||
|
||
## The hostname of this instance, e.g. localhost:3000 or my-app.my-domain.com | ||
HOSTNAME=localhost:3000 | ||
|
||
## Unicode Locale string for multilingual support; at present, only en_US.UTF-8 is supported | ||
LANG=en_US.UTF-8 | ||
|
||
## The protocol this instance is served on (http or https) | ||
PROTOCOL=http | ||
|
||
## The environment for this instance; set to 'development' or 'production' | ||
RACK_ENV=development | ||
RAILS_ENV=development | ||
|
||
## Rails configurations that can be changed per this instance's needs | ||
RAILS_LOG_TO_STDOUT=enabled | ||
RAILS_SERVE_STATIC_FILES=enabled | ||
|
||
## A secure key used to encrypt passwords | ||
SECRET_KEY_BASE= | ||
|
||
## SendGrid configuration for system emails; see README for instructions | ||
SENDGRID_PASSWORD= | ||
SENDGRID_USERNAME=apikey | ||
|
||
## Required if ACTIVE_STORAGE_SERVICE: 'amazon' in config/application.yml | ||
# AWS_ACCESS_KEY_ID | ||
# AWS_BUCKET | ||
# AWS_REGION | ||
# AWS_SECRET_ACCESS_KEY | ||
# ----------------------------------------------------------------------------- | ||
# Required for production environments | ||
# ----------------------------------------------------------------------------- | ||
|
||
## Database credentials to use on this production instance | ||
# DM2_DATABASE_USER= | ||
# DM2_DATABASE_PASSWORD= | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Required for running Docker Compose in a production environment | ||
# ----------------------------------------------------------------------------- | ||
|
||
## Local filesystem mount point for PostgreSQL database. It is recommended to | ||
## change this to something persistent on your local filesystem that is regularly backed up. | ||
# DATABASE_FS_MOUNT=./tmp/prod-db | ||
|
||
## Port for the Rails backend. Should be 443 to use provided Docker image and Docker | ||
## Compose yml files. | ||
# PORT=443 | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Required if using an external PostgreSQL database | ||
# ----------------------------------------------------------------------------- | ||
|
||
## External PostgreSQL database URL | ||
## - Development env will look for or create a database called dm2_staging | ||
## - Production env will look for or create a database called dm2_production | ||
# DATABASE_URL=postgres://user:pass@hostname | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Required if ACTIVE_STORAGE_SERVICE: 'amazon' in config/application.yml | ||
# ----------------------------------------------------------------------------- | ||
|
||
## AWS credentials to use for storage | ||
# AWS_ACCESS_KEY_ID= | ||
# AWS_BUCKET= | ||
# AWS_REGION= | ||
# AWS_SECRET_ACCESS_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: bundle exec puma -p $PORT -C config/puma.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version: "3.9" | ||
services: | ||
app: | ||
volumes: | ||
- .:/opt/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: "3.9" | ||
services: | ||
db: | ||
env_file: | ||
- .env | ||
environment: | ||
POSTGRES_DB: dm2_production | ||
POSTGRES_USER: "${DM2_DATABASE_USER}" | ||
POSTGRES_PASSWORD: "${DM2_DATABASE_PASSWORD}" | ||
volumes: | ||
- "${DATABASE_FS_MOUNT}:/var/lib/postgresql/data" | ||
|
||
app: | ||
restart: always | ||
command: bash -c "rm -f tmp/pids/server.pid && cd /opt/app && foreman start -f Procfile.prod" | ||
environment: # May be overridden by values in .env | ||
DATABASE_URL: postgres://${DM2_DATABASE_USER}:${DM2_DATABASE_PASSWORD}@db | ||
RACK_ENV: production | ||
RAILS_ENV: production | ||
ports: | ||
- "443:443" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters