Skip to content
Permalink
Browse files

feat: Allows sharing of network (#16937)

build(docker): Expose mailhog port.

build(Docker): Improve wording.

build(docker): Mailhog and network changes.

    * Add mailhog container to shared network to enable connectivity
    * Configure project name for docker compose in .env sample file,
        without it the basename of the repo directory is used, which
        makes it unreachable for other services
    * Set mailhog host to mailhog (instead of localhost) if MAILHOG_HOST
      env var is set
    * Expose 1025 to enable local troubleshooting

build(docker): Update README to reflect compose changes.
  • Loading branch information...
ojongerius authored and raisedadead committed Mar 30, 2018
1 parent 1d9eca3 commit ef37c3bee2126100fca649e11df23b666a0fb829
Showing with 75 additions and 45 deletions.
  1. +0 −2 .gitignore
  2. +15 −11 CONTRIBUTING.md
  3. +20 −0 docker-compose-shared.yml
  4. +37 −0 docker-compose.yml
  5. +0 −31 sample.docker-compose.yml
  6. +1 −0 sample.env
  7. +2 −1 server/datasources.development.js
@@ -56,5 +56,3 @@ public/css/main*
webpack-bundle-stats.html
server/rev-manifest.json
google-credentials.json

docker-compose.yml
@@ -288,26 +288,30 @@ node seed
npm run develop
```

### Setup freeCodeCamp via Docker
### Setup freeCodeCamp using Docker
#### Isolated
Use this if you just want to work on freeCodeCamp.

You need to have [docker](https://docs.docker.com/install/) and [docker-compose](https://docs.docker.com/compose/install/) installed before executing commands below.
You will need to have [docker](https://docs.docker.com/install/) and [docker-compose](https://docs.docker.com/compose/install/) installed before executing the commands below.

Create docker-compose.yml from sample file
Setup:
```bash
cp sample.docker-compose.yml docker-compose.yml
docker-compose run --rm freecodecamp npm install
docker-compose run --rm freecodecamp npm run only-once
```

Setup and run project:
Run:
```bash
# Setup project
docker-compose run --rm node npm install
docker-compose run --rm node npm run only-once
```
```bash
# Run project
docker-compose up
```

#### Shared
Use this if you want to work on other services that will run alongside
of freeCodeCamp, using the database directly. An example is the [open-api](https://github.com/freeCodeCamp/open-api) project.

```bash
docker-compose -f docker-compose.yml -f docker-compose-shared.yml up
```

### Make Changes

@@ -0,0 +1,20 @@
# Docker Compose over ride file for FreeCodeCamp
#
# Run with:
# docker-compose -f docker-compose.yml -f docker-compose-shared.yml up
#
version: "3"
services:
db:
networks:
- shared
mailhog:
networks:
- shared
freecodecamp:
networks:
- shared

networks: # Used by by other projects like open-api
shared:
driver: bridge
@@ -0,0 +1,37 @@
# Docker Compose file for FreeCodeCamp
#
# Bootstrap with:
# docker-compose run --rm server npm install
# docker-compose run --rm server npm run only-once
#
# Run with:
# docker-compose up
#
version: "3"
services:
freecodecamp:
image: node:8.9.4
depends_on:
- db
- mailhog
environment:
- MAILHOG_HOST=mailhog
- MONGOHQ_URL=mongodb://db:27017/freecodecamp
volumes:
- .:/app
working_dir: /app
command:
- npm
- run
- develop
ports:
- "3000:3000"
db:
image: mongo:3.2.6
ports:
- "27017:27017"
mailhog:
image: mailhog/mailhog
ports:
- "1025:1025"
- "8025:8025"

This file was deleted.

Oops, something went wrong.
@@ -1,3 +1,4 @@
COMPOSE_PROJECT_NAME=freecodecamp
MONGOHQ_URL='mongodb://localhost:27017/freecodecamp'

OPBEAT_FRONTEND_ORG_ID=stuff
@@ -10,7 +10,7 @@ if (!process.env.SES_ID) {
connector: 'mail',
transport: {
type: 'smtp',
host: 'localhost',
host: process.env.MAILHOG_HOST || 'localhost',
secure: false,
port: 1025,
tls: {
@@ -26,4 +26,5 @@ if (!process.env.SES_ID) {
} else {
debug('using AWS SES to deliver emails');
}

module.exports = ds;

0 comments on commit ef37c3b

Please sign in to comment.
You can’t perform that action at this time.