Browse Source

Added stack.yml

Benjamin Chrobot 7 years ago
parent
commit
0a2875e917
2 changed files with 23 additions and 22 deletions
  1. 2 22
      mongo/content.md
  2. 21 0
      mongo/stack.yml

+ 2 - 22
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
 

+ 21 - 0
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