Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for docker-compose that start Mongo + Hippo #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '2'
services:
mongodb:
image: mongo
restart: always
container_name: mongocrypto
environment:
- MONGO_INITDB_ROOT_USERNAME=crypto-admin
- MONGO_INITDB_ROOT_PASSWORD=crypto-admin
- MONGO_DATA_DIR=/data/db
- MONGO_LOG_DIR=/dev/null
volumes:
- ./mongo.docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
- ./data/db:/data/db
ports:
- 27017:27017
command: '--auth'

hippo:
depends_on:
- mongodb
image: tsavo/hippo:latest
restart: always
working_dir: /app
environment:
- HIPPO_DB_URL=mongocrypto
- HIPPO_DB_NAME=cryptomarket
- HIPPO_DB_USERNAME=crypto-rw
- HIPPO_DB_PASSWORD=crypto-rw
volumes:
- .:/app
command: mvn install exec:exec
links:
- mongodb:mongocrypto
5 changes: 5 additions & 0 deletions mongo.docker-entrypoint-initdb.d/init-db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
db = db.getSiblingDB('admin');
db.auth( { user: 'crypto-admin', pwd: 'crypto-admin' });

db = db.getSiblingDB('cryptomarket');
db.createUser({ user: 'crypto-rw', pwd: 'crypto-rw', roles: [ { role: "dbOwner", db: "cryptomarket" } ] });
3 changes: 1 addition & 2 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/bin/bash
docker run -d -v $PWD:/app -w /app tsavo/hippo:latest mvn install exec:exec

docker-compose up -d