Skip to content

Instantly share code, notes, and snippets.

@fipar
Created June 27, 2015 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fipar/570d4dbad37c51ad523c to your computer and use it in GitHub Desktop.
Save fipar/570d4dbad37c51ad523c to your computer and use it in GitHub Desktop.
simple-todo meteor app using tokumx, on mac.

These are instructions on getting the simple-todo test app from the meteor tutorial (link below) running on a Mac and using TokuMX instead of MongoDB. It was written in response to this request: https://www.percona.com/blog/2015/05/08/mongodb-percona-tokumxse-experimental-build-rc5-available/#comment-10864682

Prerequsites:

I ran this on OS/X 10.10.3, Darwin 14.3.0

Follow https://www.meteor.com/tutorials/blaze/creating-an-app

  • ‘Creating an app’
  • ‘Templates’
  • ‘Collections’

Update the js file as described, but do not follow the ‘Inserting tasks from the console’ instructions, as we won’t be using the builting mongodb.

If not yet started, start boot2docker:

boot2docker up

Make sure you export the three variables DOCKER_HOST, DOCKER_CERT_PATH and DOCKER_TLS_VERIFY

After this, you can test that this is running as expected by running docker ps:

telecaster:simple-todos fernandoipar$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

And also by testing the hello world image

telecaster:simple-todos fernandoipar$ docker run hello-world
Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (Assuming it was not already locally available.)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

For more examples and ideas, visit:
 http://docs.docker.com/userguide/

Now you’re ready to start a tokumx container.

First, make sure you disable transparent hugepages on the docker host, as tokumx won’t run with that enabled:

telecaster:tokumx fernandoipar$ boot2docker ssh
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.3.1, build master : 9a31a68 - Fri Oct 31 03:14:34 UTC 2014
Docker version 1.3.1, build 4e9bbfa
docker@boot2docker:~$ sudo su -
Boot2Docker version 1.3.1, build master : 9a31a68 - Fri Oct 31 03:14:34 UTC 2014
Docker version 1.3.1, build 4e9bbfa
root@boot2docker:~# echo never > /sys/kernel/mm/transparent_hugepage/enabled

Then start the container:

telecaster:simple-todos fernandoipar$ docker run -p 27017:27017 -d ankurcha/tokumx mongod --bind_ip 0.0.0.0
06ed9f55375e271641731899caa90afffd9d9b99ff37dc9094c13300539903d3
telecaster:simple-todos fernandoipar$ docker ps
CONTAINER ID        IMAGE                    COMMAND                CREATED             STATUS              PORTS                                 NAMES
06ed9f55375e        ankurcha/tokumx:latest   "mongod --bind_ip 0.   15 seconds ago      Up 12 seconds       28017/tcp, 0.0.0.0:27017->27017/tcp   jovial_mclean

Test that you can connect to tokumx (you’ll need the mongo client installed on your OS/X machine):

telecaster:simple-todos fernandoipar$ mongo --host $(boot2docker ip)

The VM's Host only interface IP address is:

MongoDB shell version: 2.6.5
connecting to: 192.168.59.103:27017/test
> db.isMaster()
{
	"ismaster" : true,
	"maxBsonObjectSize" : 16777216,
	"maxMessageSizeBytes" : 48000000,
	"localTime" : ISODate("2015-06-27T21:45:15.796Z"),
	"ok" : 1
}

Now you’re almost ready to start the meteor app against tokumx. You just need to set this environment variable:

export MONGO_URL="mongodb://$(boot2docker ip)/meteor"

Insert a sample task on the collection:

telecaster:simple-todos fernandoipar$ mongo --host $(boot2docker ip)

The VM's Host only interface IP address is:

MongoDB shell version: 2.6.5
connecting to: 192.168.59.103:27017/test
> use meteor
switched to db meteor
> db.tasks.insert({ text: "Hello world!", createdAt: new Date() });
Cannot use commands write mode, degrading to compatibility mode
WriteResult({ "nInserted" : 1 })
>
bye

Now you should be ready to star the app:

telecaster:simple-todos fernandoipar$ meteor run
[[[[[ ~/tmp/simple-todos ]]]]]

=> Started proxy.
=> Started your app.

=> App running at: http://localhost:3000/

At this point, if you open the mongo client again and start inserting task documents into the collection (the meteor.tasks namespace), you should see those tasks appear in the page (without the need for any reload, just give it a few seconds and it should update on its own).

@fipar
Copy link
Author

fipar commented Jun 27, 2015

Forgot to add that, once you're done testing, you can stop the container by running docker stop with the corresponding container id (the one you get from 'docker ps'). You can also just stop boot2docker (boot2docker down), which is more drastic, but will also stop the container.

@mnaseersj
Copy link

@fipar

Right now if anybody had asked me, I could walk on water lol <<<>>> just got everything working.

There were some bumps along the way but mostly because of my lack of experience. Google was instrumental in getting me out of trouble!

I am hoping to go over everything again and this time make sure I understand most of what I've covered above and I would be extremely grateful if you would allow me to pop any questions, down the road - in relation to this tutorial and TokuMXse and Meteor.

Here is a Google Drive link to my notes that I made around your instructions, and any feedback is most welcome :

https://drive.google.com/file/d/0B-9aDclxPBguVHdzYXk2a3hiRm8/view?usp=sharing

Kind Regards,
Naseer.

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