diff --git a/mongo/content.md b/mongo/content.md index 77ac77eab..f43f23c5c 100644 --- a/mongo/content.md +++ b/mongo/content.md @@ -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 diff --git a/mongo/stack.yml b/mongo/stack.yml new file mode 100644 index 000000000..fb08f72bc --- /dev/null +++ b/mongo/stack.yml @@ -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