Skip to content

Instantly share code, notes, and snippets.

@ajeetraina
Created October 28, 2016 08:38
Show Gist options
  • Save ajeetraina/1cc2213789c0ff7923d9dc06fbbc63d5 to your computer and use it in GitHub Desktop.
Save ajeetraina/1cc2213789c0ff7923d9dc06fbbc63d5 to your computer and use it in GitHub Desktop.
Testing Docker-Compose for MongoDB & Node.js
sudo docker run -d --name mdb5 mongo
adc6dda648fa206736dc5cd1a4f99319244819fdd0cb1c188902034558e6d501
sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATU
S PORTS NAMES
adc6dda648fa mongo "/entrypoint.sh mongo" 36 seconds ago Up 35
seconds 27017/tcp mdb5
$ sudo docker run -p 27017:27017 --name db --link mdb5:mdb5 mongo
2016-10-28T08:36:11.638+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=2701
7 dbpath=/data/db 64-bit host=53daf9a64452
2016-10-28T08:36:11.638+0000 I CONTROL [initandlisten] db version v3.2.10
2016-10-28T08:36:11.638+0000 I CONTROL [initandlisten] git version: 79d9b3ab5ce20f51c272b
4411202710a082d0317
2016-10-28T08:36:11.638+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3
May 2016
2016-10-28T08:36:11.638+0000 I CONTROL [initandlisten] allocator: tcmalloc
2016-10-28T08:36:11.638+0000 I CONTROL [initandlisten] modules: none
2016-10-28T08:36:11.638+0000 I CONTROL [initandlisten] build environment:
2016-10-28T08:36:11.638+0000 I CONTROL [initandlisten] distmod: debian81
2016-10-28T08:36:11.638+0000 I CONTROL [initandlisten] distarch: x86_64
2016-10-28T08:36:11.638+0000 I CONTROL [initandlisten] target_arch: x86_64
2016-10-28T08:36:11.638+0000 I CONTROL [initandlisten] options: {}
2016-10-28T08:36:11.661+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cac
he_size=3G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),
==========================
$sudo docker-compose up
npm info build /usr/src/app/node_modules/node-sass/node_modules/gaze/node_modules/globule
npm info linkStuff [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info build /usr/src/app/node_modules/node-sass/node_modules/gaze
npm info linkStuff [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info build /usr/src/app/node_modules/node-sass
npm info linkStuff [email protected]
npm info install [email protected]
> [email protected] install /usr/src/app/node_modules/node-sass
> node scripts/install.js
Start downloading binary at https://github.com/sass/node-sass/releases/download/v3.10.1/linux-x64-46_binding.node
b_1 | 2016-10-28T07:56:57.877+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
db_1 | 2016-10-28T07:56:57.877+0000 I CONTROL [initandlisten]
db_1 | 2016-10-28T07:56:57.878+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
db_1 | 2016-10-28T07:56:57.878+0000 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
db_1 | 2016-10-28T07:56:57.891+0000 I NETWORK [initandlisten] waiting for connections on port 27017
app_1 | npm info it worked if it ends with ok
app_1 | npm info using [email protected]
app_1 | npm info using [email protected]
app_1 | npm info prestart [email protected]
app_1 | npm info start [email protected]
app_1 |
app_1 | > [email protected] start /usr/src/app
app_1 | > node server.js
app_1 |
app_1 | Express server listening on port 3000
db_1 | 2016-10-28T07:56:59.351+0000 I NETWORK [initandlisten] connection accepted from 172.17.0.8:50304 #1 (1 connection now open)
db_1 | 2016-10-28T07:56:59.394+0000 I INDEX [conn1] build index on: nb6.users properties: { v: 1, unique: true, key: { email: 1 }, name: "email_1", ns: "nb6.users", background: true }
db_1 | 2016-10-28T07:56:59.394+0000 I INDEX [conn1] build index done. scanned 0 total records. 0 secs
@ajeetraina
Copy link
Author

export ip=<public_ip_goes_here>
docker swarm join --advertise-addr=$ip --token SWMTKN-1-29tx6z2k8zmsbt9z2c2ay54jc9ce2l94ixhmmagveifv3pp4fa-5e8i9gugpb9b4bmi9vrp7m5su 67.205.160.45:2377

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment