2
0

114 lines
3.9 KiB
YAML

# Node.js with MongoDB and Mongo-Express tool.
#
# Provides a JavaScript runtime environment with MongoDB backend.
# Assumes a suitable JS application in nodejs-apps volume.
#
services:
#
# https://hub.docker.com/_/node
# https://github.com/nodejs/docker-node
#
nodejs:
image: node:latest
restart: unless-stopped
# Choose a suitable Linux account here.
# Must have R/W access to the nodejs-apps volume.
user: "1001"
# The application defines the port(s) to expose.
# Take a look the possible public port collision.
ports:
- 8201:8080
links:
- mongodb
volumes:
- /etc/localtime:/etc/localtime:ro
- ./storage/volumes/nodejs-apps:/home/node/app
environment:
TZ: Europe/Budapest
NODE_ENV: production
NPM_CONFIG_CACHE: /home/node/app/node_modules/.cache
NPM_CONFIG_LOGLEVEL: info
#
# Environment variables to control the docker-skeleton's
# external backup. The Node.JS image doesn't interpret them.
# You may specify the relevant folders for the backup utility.
# By default it backups the entire nodejs-apps folder.
DS_BACKUP_FOLDERS: ''
# These folders below will be excluded from the backup.
DS_BACKUP_EXCLUDES: ''
# You may specify the relevant MongoDB database(s) as well.
DS_BACKUP_DATABASES: ''
#
# Starting the application via npm and package.json:
#command: sh -c "cd /home/node/app && npm install && npm start"
# Starting a single file application (testing only):
command: node /home/node/app/helloworld.js
extra_hosts:
- "host.docker.internal:host-gateway"
labels:
com.centurylinklabs.watchtower.enable: true
#
# https://hub.docker.com/_/mongo
# https://github.com/docker-library/mongo
#
mongodb:
image: mongo:latest
restart: unless-stopped
# Choose a suitable Linux account here.
# Must have R/W access to the mongodb-data volume.
user: "1001"
volumes:
- ./storage/volumes/mongodb-data:/data/db
environment:
MONGO_INITDB_DATABASE: admin
# Sets the DBA (root) credentials below.
MONGO_INITDB_ROOT_USERNAME: admin
# It is highly recommended to change this to a strong random password.
# https://passwordsgenerator.net/
MONGO_INITDB_ROOT_PASSWORD: secret-1
# Sets the DBA (root) credentials below.
extra_hosts:
- "host.docker.internal:host-gateway"
labels:
com.centurylinklabs.watchtower.enable: true
#
# https://hub.docker.com/_/mongo-express
# https://github.com/mongo-express/mongo-express
# https://github.com/mongo-express/mongo-express-docker
#
mongoxp:
image: mongo-express
restart: unless-stopped
# Take a look the possible public port collision.
ports:
- 8202:8081
links:
- mongodb
environment:
# Override the default value set in the docker-entrypoint.sh:
# https://github.com/mongo-express/mongo-express-docker/issues/21
ME_CONFIG_MONGODB_URL: fake,fake
ME_CONFIG_MONGODB_SERVER: mongodb
ME_CONFIG_MONGODB_PORT: 27017
ME_CONFIG_SITE_BASEURL: /mongoxp/
# We don't use SSL behind a local reverse proxy.
ME_CONFIG_SITE_SSL_ENABLED: false
ME_CONFIG_SITE_SSL_CRT_PATH: ''
ME_CONFIG_SITE_SSL_KEY_PATH: ''
# We use the root account here.
ME_CONFIG_MONGODB_ENABLE_ADMIN: true
# Must match MONGO_INITDB_ROOT_* credentials.
ME_CONFIG_MONGODB_ADMINUSERNAME: admin
ME_CONFIG_MONGODB_ADMINPASSWORD: secret-1
# It is recommended to use at least a basic authentication.
ME_CONFIG_BASICAUTH: true
ME_CONFIG_BASICAUTH_USERNAME: admin
# It is highly recommended to change this to a strong random password.
# https://passwordsgenerator.net/
ME_CONFIG_BASICAUTH_PASSWORD: secret-2
ME_CONFIG_OPTIONS_EDITORTHEME: ambiance
extra_hosts:
- "host.docker.internal:host-gateway"
labels:
com.centurylinklabs.watchtower.enable: true