Created
February 12, 2015 21:46
-
-
Save buth/9fcef2c106e3cc630c16 to your computer and use it in GitHub Desktop.
Revisions
-
buth created this gist
Feb 12, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ [Unit] Description=mongodb Requires=docker.service After=docker.service [Service] Restart=always RestartSec=5s TimeoutStartSec=0 KillMode=none ExecStartPre=-/usr/bin/docker kill mongodb ExecStartPre=-/usr/bin/docker rm mongodb ExecStartPre=/usr/bin/mkdir -p /data/mongodb ExecStartPre=/usr/bin/docker pull mongo:2.6 ExecStart=/opt/bin/context exec -g mongodb docker run -e KEY --rm -m 1g --name=mongodb -v /data/mongodb:/data/db -v /etc/mongodb:/etc/mongodb:ro -p 27017:27017 mongo:2.6 sh -c 'touch /keyfile; chmod 600 /keyfile; chown mongodb:mongodb /keyfile; echo $KEY | fold -w 64 > /keyfile; exec mongod --replSet rs0 --keyFile /keyfile' ExecStop=/usr/bin/docker stop mongodb