Skip to content

Commit

Permalink
fix: Update Docker configs for batch image upload
Browse files Browse the repository at this point in the history
  • Loading branch information
blms committed Sep 27, 2021
1 parent 72dfc0b commit 145e12b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 16 deletions.
18 changes: 7 additions & 11 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,20 @@ RAILS_SERVE_STATIC_FILES=enabled
## A secure key used to encrypt passwords
SECRET_KEY_BASE=

## Redis URL; comment this out in Docker Compose environments
REDIS_URL=redis://localhost:6379

## Must be set to REDIS_URL
REDIS_PROVIDER=REDIS_URL

# -----------------------------------------------------------------------------
# Required for production environments
# Required for all production environments
# -----------------------------------------------------------------------------

## Database credentials to use on this production instance
# DM2_DATABASE_USER=
# DM2_DATABASE_PASSWORD=

## Database credentials to use on this production instance
# DM2_DATABASE_USER=testuser
# DM2_DATABASE_PASSWORD=testpassword

## Redis URL
# REDIS_URL=redis://localhost:6379

## Must be set to REDIS_URL
# REDIS_PROVIDER=REDIS_URL

# -----------------------------------------------------------------------------
# Required for running Docker Compose in a production environment
# -----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions Procfile.prod
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
web: bundle exec puma -p $PORT -C config/puma.rb
worker: bundle exec sidekiq -e production -C config/sidekiq.yml
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ cp .env.sample .env
cp config/application.sample.yml config/application.yml
```

**Note**: In `.env`, when using Docker Compose, you must comment out the `REDIS_URL` environment variable.

Next, there are slightly different instructions depending on whether you intend to run DM2 in a production or development environment.

#### Development environment
Expand Down
4 changes: 1 addition & 3 deletions client/craco.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ module.exports = {
const ForkTsCheckerWebpackPlugin = webpackConfig.plugins.find(
(plugin) => plugin.constructor.name === "ForkTsCheckerWebpackPlugin"
);

// If we can't find the loader then throw an error.
if (!ForkTsCheckerWebpackPlugin) {
throw new Error("could not find ForkTsCheckerWebpackPlugin");
return webpackConfig;
}

if (!pluginOptions.memoryLimit) {
Expand Down
9 changes: 8 additions & 1 deletion docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
version: "3.9"
services:
redis_db:
env_file:
- .env
volumes:
- "${DATABASE_FS_MOUNT}/redis:/data"
db:
env_file:
- .env
Expand All @@ -8,7 +13,7 @@ services:
POSTGRES_USER: "${DM2_DATABASE_USER}"
POSTGRES_PASSWORD: "${DM2_DATABASE_PASSWORD}"
volumes:
- "${DATABASE_FS_MOUNT}:/var/lib/postgresql/data"
- "${DATABASE_FS_MOUNT}/postgresql:/var/lib/postgresql/data"

app:
restart: always
Expand All @@ -17,5 +22,7 @@ services:
DATABASE_URL: postgres://${DM2_DATABASE_USER}:${DM2_DATABASE_PASSWORD}@db
RACK_ENV: production
RAILS_ENV: production
REDIS_URL: redis://redis_db:6379
REDIS_PROVIDER: REDIS_URL
ports:
- "443:443"
12 changes: 11 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
version: "3.9"
services:
redis_db:
image: redis:6-alpine
command: redis-server
ports:
- '6379:6379'
volumes:
- './tmp/redis-dev:/data'
db:
image: postgres:11.12
environment:
Expand All @@ -17,9 +24,12 @@ services:
- "3000:3000"
depends_on:
- db
- redis_db
env_file:
- .env
environment: # May be overridden by values in .env
DATABASE_URL: postgres://dm2_dev_user:dm2_dev_password@db
RACK_ENV: development
RAILS_ENV: development
RAILS_ENV: development
REDIS_URL: redis://redis_db:6379
REDIS_PROVIDER: REDIS_URL

0 comments on commit 145e12b

Please sign in to comment.