The Keystoner
repository contains a sample KeystoneJS application, and supporting files for dockerizing it.
The docker-compose files were tested against a system running Mac OS X (10.11.3), with the Docker Toolbox.
KeystoneJS
requires:
- Yeoman (yo)
- MongoDB
$ git clone git@github.com:robertoriv/keystoner.git keystoner
$ cd keystoner
$ docker-compose -f docker-compose-byoi.yml up
# grab some coffee?
$ git clone git@github.com:robertoriv/keystoner.git keystoner
$ cd keystoner
$ docker-compose up
$ curl -I http://<docker_vm_ip|localhost>/assets/images/logo.svg 2>/dev/null | head -n 1 | cut -d$' ' -f2
200
$ curl -I http://<docker_vm_ip|localhost>/ 2>/dev/null | head -n 1 | cut -d$' ' -f2
200
$ open http://<docker_vm_ip|localhost>/
-
nginx - Used as a front-end to the app. nginx will proxy-pass requests to the app running in a container on port
3000
. In addition to proxy-passing the app request, it also hosts all the files/folders in the nginx/assets directory. Those files will be served by nginx rather than the app. The docker image for nginx consists of the offical nginx image with some added configuration. nginx is listening on port80
. -
MongoDB - MongoDB serves as the data store for the application. This image is an unmodified official MongoDB image. (More on that later.)
-
Keystone Demo - A basic KeystoneJS demo app.
Looking at the docs for MongoDB's official image, I noticed that it said that, when running on VirtualBox, you can't mount a local folder on the host machine.
WARNING: because MongoDB uses memory mapped files it is not possible to use it through vboxsf to your host (vbox bug). VirtualBox shared folders are not supported by MongoDB (see docs.mongodb.org and related jira.mongodb.org bug). This means that it is not possible with the default setup using Docker Toolbox to run a MongoDB container with the data directory mapped to the host.
I decided to just ship an unmodified version of the image, which means that it will start with a blank slate. Not sure how you guys handle data migrations across environments, but this could prove to be a problem.
When I mounted the app folder in the container to make it easier to see changes, it started complaining because my dev box had the dependencies installed for a different version of node. There was no image that matched my current version (installed with brew
). I commented out the mount.