Added stack.yml

This commit is contained in:
Benjamin Chrobot 2018-01-27 08:47:01 -05:00
parent 739ae9a6b9
commit 0a2875e917
No known key found for this signature in database
GPG Key ID: 100723669260F64D
2 changed files with 23 additions and 22 deletions

View File

@ -34,29 +34,9 @@ $ docker run -it --link some-%%REPO%%:mongo --rm %%IMAGE%% sh -c 'exec mongo "$M
```
... where `some-mongo` is the name of your original `mongo` container.
## ... via `docker-compose`
## %%STACK%%
Example `docker-compose.yml` for `mongo`:
```
version: '2.1'
services:
db:
image: %%IMAGE%%
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: MongoRootUser
MONGO_INITDB_ROOT_PASSWORD: AMuchStrongerPassword
app:
build: ./app
ports:
- 80:80
links:
- db
```
Run `docker stack deploy -c stack.yml %%REPO%%` (or `docker-compose -f stack.yml up`), wait for it to initialize completely, and visit `http://swarm-ip:8081`, `http://localhost:8081`, or `http://host-ip:8081` (as appropriate).
## Container shell access and viewing Mongo logs

21
mongo/stack.yml Normal file
View File

@ -0,0 +1,21 @@
# Use root/example as user/password credentials
version: '3.1'
services:
mongo:
image: mongo
# image: %%IMAGE%%
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
mongo-express:
image: mongo-express
restart: always
ports:
- 8081:8081
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: example