From c9f0e254a0f54aba50addecc6bffe85ba5f60dfd Mon Sep 17 00:00:00 2001 From: Carlos Wu Fei Date: Mon, 16 Nov 2020 22:08:17 +0000 Subject: [PATCH] Improvements on setup --- .gitignore | 1 + README.md | 6 ++++-- docker-compose.yml | 13 ++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index c8f41e68..e5deaa98 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ node_modules/ .dockerenv coverage/ build/ +mongo_data .DS_Store .env.local diff --git a/README.md b/README.md index 7a43cba8..138cb4e8 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ## Running front-end web app -1. Run `npm run install:clean` and `npm install` +1. Run `npm run install:clean` 2. Run `npm start` 3. Attach vscode debugger if needed @@ -23,9 +23,11 @@ 4. Copy `scp docker-compose.yml @:/var/www/binbot.carloswu.com` In production: 5. `docker pull carloswufei/binbot` -6. `docker-compose up -d` +6. If `.env.prod` is modified, scp to remote server and replace `.env` in production with new `.env.prod` +7. `docker-compose up -d` ## Test production 1. Run `docker build --tag binbot .` 2. Run `docker-compose up` + diff --git a/docker-compose.yml b/docker-compose.yml index f438d866..e2884cf7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,14 +2,17 @@ version: '3.7' services: db: image: mongo:latest - container_name: binbot-db + container_name: binbot_db + restart: on-failure + env_file: .env environment: - MONGO_INITDB_ROOT_USERNAME: root - MONGO_INITDB_ROOT_PASSWORD: rootpassword + MONGO_INITDB_ROOT_USERNAME: ${MONGO_AUTH_USERNAME} + MONGO_INITDB_ROOT_PASSWORD: ${MONGO_AUTH_PASSWORD} + MONGO_INITDB_DATABASE: ${MONGO_APP_DATABASE} ports: - 27018:27017 volumes: - - mongodb_data_container:/data/db + - ./mongo_data:/data/db api: image: carloswufei/binbot @@ -24,4 +27,4 @@ services: - 8008:8006 volumes: - mongodb_data_container: + mongo_data: