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

Use new mongo image for tutorial - fixes 383 #476

Merged
merged 10 commits into from
Aug 11, 2014

Conversation

dwgebler
Copy link
Contributor

@dwgebler dwgebler commented Aug 7, 2014

use smaller clusterhq mongo image

we have a lightweight mongo image now deployed to the public docker index.

Part of #383 - need to checkout this branch and see if the tutorial is still successful when run with this Vagrantfile.

use smaller clusterhq mongo image
@exarkun exarkun added the review label Aug 7, 2014
@wallrj
Copy link
Contributor

wallrj commented Aug 7, 2014

You'll need to update the references to mongo-tutorial in the various application yaml files too.

@wallrj
Copy link
Contributor

wallrj commented Aug 7, 2014

Well it certainly reduces the size of the VMs...

[richard@drax flocker-tutorial]$ du -hs ~/VirtualBox\ VMs/* 
2.5G    /home/richard/VirtualBox VMs/flocker_default_1407231635875_47400
2.1G    /home/richard/VirtualBox VMs/flocker-tutorial_node1_1407410029699_76466
2.1G    /home/richard/VirtualBox VMs/flocker-tutorial_node2_1407410439395_10942

@wallrj
Copy link
Contributor

wallrj commented Aug 7, 2014

But when I substitute the new image name into the tutorial application YAML files, the application fails to load. See below:

(master)[richard@drax flocker-tutorial]$ ssh root@172.16.255.250 gear status mongodb-example
ctr-mongodb-example.service - Container mongodb-example
   Loaded: loaded (/var/lib/containers/units/mo/ctr-mongodb-example.service; enabled)
   Active: failed (Result: exit-code) since Thu 2014-08-07 04:53:21 PDT; 37s ago
  Process: 26523 ExecStartPre=/bin/sh -c /usr/bin/docker inspect --format="Reusing {{.ID}}" "mongodb-example-data" || exec docker run --name "mongodb-example-data" --volumes-from "mongodb-example-data" --entrypoint /bin/true "clusterhq/mongdb:latest" (code=exited, status=1/FAILURE)

Aug 07 04:53:20 node1 systemd[1]: Starting Container mongodb-example...
Aug 07 04:53:20 node1 sh[26523]: Error: No such image or container: mongodb-example-data
Aug 07 04:53:20 node1 sh[26523]: Unable to find image 'clusterhq/mongdb:latest' locally
Aug 07 04:53:20 node1 sh[26523]: Pulling repository clusterhq/mongdb
Aug 07 04:53:21 node1 sh[26523]: 2014/08/07 04:53:21 HTTP code: 404
Aug 07 04:53:21 node1 systemd[1]: ctr-mongodb-example.service: control process exited, code=exited status=1
Aug 07 04:53:21 node1 systemd[1]: Failed to start Container mongodb-example.
Aug 07 04:53:21 node1 systemd[1]: Unit ctr-mongodb-example.service entered failed state.
container_status: Unable to fetch container status logs: exit status 3
(master)[richard@drax flocker-tutorial]$ ssh root@172.16.255.250 docker images
REPOSITORY                   TAG                   IMAGE ID            CREATED             VIRTUAL SIZE
clusterhq/mongodb            latest                1ca6bee08c63        About an hour ago   32.5 MB
openshift/busybox-http-app   latest                52dd5d4a8857        3 weeks ago         2.441 MB
busybox                      buildroot-2013.08.1   d200959a3e91        9 weeks ago         2.489 MB
busybox                      ubuntu-14.04          37fca75d01ff        9 weeks ago         5.609 MB
busybox                      ubuntu-12.04          fd5373b3d938        9 weeks ago         5.455 MB
busybox                      buildroot-2014.02     a9eb17255234        9 weeks ago         2.433 MB
busybox                      latest                a9eb17255234        9 weeks ago         2.433 MB

@dwgebler
Copy link
Contributor Author

dwgebler commented Aug 7, 2014

@wallrj I think you made a typo in your substitutions :)

Aug 07 04:53:20 node1 sh[26523]: Pulling repository clusterhq/mongdb

"mongdb" should be "mongodb"

@wallrj
Copy link
Contributor

wallrj commented Aug 7, 2014

Ah ok. That was a silly mistake.

But I've now found what I think is a real problem...

(master)[richard@drax flocker-tutorial]$ ssh root@172.16.255.250 gear status mongodb-volume-example
ctr-mongodb-volume-example.service - Container mongodb-volume-example
   Loaded: loaded (/var/lib/containers/units/mo/ctr-mongodb-volume-example.service; enabled)
   Active: failed (Result: exit-code) since Thu 2014-08-07 09:12:37 PDT; 39s ago
  Process: 9131 ExecStop=/usr/bin/docker stop mongodb-volume-example (code=exited, status=1/FAILURE)
  Process: 9033 ExecStartPost=/usr/bin/gear init --post mongodb-volume-example clusterhq/mongodb:latest (code=exited, status=0/SUCCESS)
  Process: 9032 ExecStart=/usr/bin/docker run --rm --name mongodb-volume-example --volumes-from mongodb-volume-example-data -a stdout -a stderr -p 27017:27017 clusterhq/mongodb:latest (code=exited, status=14)
  Process: 9019 ExecStartPre=/usr/bin/docker rm mongodb-volume-example (code=exited, status=1/FAILURE)
  Process: 9007 ExecStartPre=/bin/sh -c /usr/bin/docker inspect --format="Reusing {{.ID}}" "mongodb-volume-example-data" || exec docker run --name "mongodb-volume-example-data" --volumes-from "mongodb-volume-example-data" --entrypoint /bin/true "clusterhq/mongodb:latest" (code=exited, status=0/SUCCESS)
 Main PID: 9032 (code=exited, status=14)

Aug 07 09:12:36 node1 docker[9032]: 2014-08-07T16:12:36.177+0000 [initandlisten]
Aug 07 09:12:36 node1 docker[9032]: 2014-08-07T16:12:36.177+0000 [initandlisten] ERROR: Insufficient free space for journal files
Aug 07 09:12:36 node1 docker[9032]: 2014-08-07T16:12:36.177+0000 [initandlisten] Please make at least 3379MB available in /data/db/journal or use --smallfiles
Aug 07 09:12:36 node1 docker[9032]: 2014-08-07T16:12:36.177+0000 [initandlisten]
Aug 07 09:12:36 node1 docker[9032]: 2014-08-07T16:12:36.178+0000 [initandlisten] SEVERE: terminate() called, printing stack (if implemented for platform):
Aug 07 09:12:36 node1 docker[9032]: Unable to collect backtrace addresses (errno:2 No such file or directory)
Aug 07 09:12:36 node1 systemd[1]: ctr-mongodb-volume-example.service: main process exited, code=exited, status=14/n/a
Aug 07 09:12:37 node1 docker[9131]: Error: No such container: mongodb-volume-example
Aug 07 09:12:37 node1 docker[9131]: 2014/08/07 09:12:37 Error: failed to stop one or more containers
Aug 07 09:12:37 node1 systemd[1]: Unit ctr-mongodb-volume-example.service entered failed state.
container_status: Unable to fetch container status logs: exit status 3

@itamarst
Copy link
Contributor

itamarst commented Aug 7, 2014

Make sure you start mongod with --noprealloc --smallfiles command line options.

@dwgebler
Copy link
Contributor Author

dwgebler commented Aug 8, 2014

Have now added noprealloc and smallfiles options to the mongodb startup on the registry image....someone please checkout this branch and try following the tutorial with it :)

@@ -1,7 +1,7 @@
"version": 1
"applications":
"mongodb-volume-example":
"image": "mongodb-tutorial"
"image": "clusterhq/mongodb"
"ports":
- "internal": 27017
"external": 27017
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to change the mount point to be /data/db rather than /data.

	modified:   tutorial/volume-application.yml
@itamarst itamarst changed the title modified: Vagrantfile Use new mongo image for tutorial - fixes 383 Aug 8, 2014
@itamarst
Copy link
Contributor

itamarst commented Aug 8, 2014

Thanks for getting this done! The new image works... except that when mongo connects it gives the following warning:

Server has startup warnings: 
2014-08-08T18:39:38.230+0000 I          [initandlisten] 
2014-08-08T18:39:38.231+0000 I          [initandlisten] ** NOTE: This is a development version (2.7.5-pre-) of MongoDB.
2014-08-08T18:39:38.232+0000 I          [initandlisten] **       Not recommended for production.
2014-08-08T18:39:38.233+0000 I          [initandlisten] 

Please rebuild the image with a stable version of MongoDB and then merge this.

@itamarst itamarst added accepted and removed accepted labels Aug 8, 2014
@dwgebler
Copy link
Contributor Author

@itamarst I had to use the cutting-edge nightly to get it to work with the buildroot/busybox image; in stable 2.6, every time I connected to the mongod inside the container via the mongo client outside the container, as soon as I exited the client, mongod would crash with a segmentation fault. Seeing as this is only for tutorial purposes, I figured we can get away with bundling the dev version. I tried numerous other solutions, different build configurations and different versions of mongo and mongod and this is the only thing that works without crashing.

@itamarst
Copy link
Contributor

Can we suppress the warning some other way, e.g. is there a command line option on server or can we patch it or something?

@dwgebler
Copy link
Contributor Author

There's no command line option I can find documented. --quiet fails to suppress warnings, so we'd have to try re-building mongod from its C++ source (see mongodb/mongo@b30db23 for a patch that does this), but I don't want to dive that deep in to the rabbit hole for what we're trying to accomplish here. It's not great having a warning, but I'm not convinced it would put people off using the tutorial - they might briefly wonder why we're using a development/unstable version of mongo in our process, but it ultimately doesn't stop any part of the tutorial working.

Really, is there anything wrong with just including a bit of text in the tutorial that says something like "To keep your downloads for the tutorial as speedy as possible, we've bundled the latest dev version of MongoDB in to a micro-sized Docker image. You should not use this for production; instead use the canonical trusted Docker MongoDB build."

@itamarst
Copy link
Contributor

That sounds fine. Put that in and merge - thank you!

Explain that we're using dev version of mongo
dwgebler added a commit that referenced this pull request Aug 11, 2014
Use new mongo image for tutorial - fixes 383
@dwgebler dwgebler merged commit 46b5c35 into master Aug 11, 2014
@dwgebler dwgebler deleted the mongo-tutorial-vagrantfile-383 branch August 11, 2014 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants