This boilerplate is a starting point for a micro service oriented front-end and back-end application that is pure JavaScript. The front-end is a Isomorphic Universal React UI that uses Redux as a State layer. The core back-end is a Hapi API server, using Sequelize as an ORM. The environment has been containerized with Docker for development and deployment.
This repo is consolidated for ease of getting started, but the frontend
and api
portions should be broken down into seperate repos to keep teams able to work independently.
First, you will need to have a working Docker Machine setup on your local machine. You will also need a mechanism for rsync-ing files into the Docker Machine.
Head on over to https://www.docker.com/docker-toolbox and download the latest version of Docker Toolbox. This will install Virtualbox and the command line tools docker-machine
and docker-compose
We use rsync to sync code from your local machine into the docker machine for use by Docker. This allows native support for file system watchers inside the container.
The code in this repo should be sync'd to the /projects/rudder-boilerplate
folder inside the docker machine.
For OS-X users, you can easily use the docker-rsync
tool to automate this for you. There is also a provided make command make sync
in this repo to make this easy.
docker-rsync is installed via the Brew package manager for OS X.
brew update
brew tap synack/docker
brew install docker-rsync
Use Docker Machine to setup a docker host. This projects expects your Docker Machine to be named default
.
Run the following commands to setup this Docker Machine
docker-machine create -d virtualbox default
Docker will need certain env vars to be set so the docker client know how to communicate with this docker machine.
Run the following in each shell where a docker command will be run to make sure that docker communicates with the right machine:
eval "$(docker-machine env default)"
It can be handy to add the following lines to your shell profile to make sure that with each shell your Docker Machine is running, and the proper env vars are set:
docker-machine start default
eval "$(docker-machine env default)"
Find out the IP of the docker machine by running:
docker-machine ip default
Put the following entry in your /etc/hosts
file:
<machine_ip> docker.internal
Once you have completed the installation of the dependencies above. You are ready to setup the cluster.
- Pull down repo
- Run
make setup
- Run
make sync
(in one tab) - Open a new tab in Terminal and run
make up
Since Linux supports docker natively, the setup is much easier.
You can follow this tutorial to make sure they are both installed:
NOTE: Make sure you restart your machine after install.
Once you have completed the installation of the dependencies above. You are ready to setup the cluster.
-
Pull down repo to
~/Workspace/projects/rudder-boilerplate
git clone [email protected]:duro/rudder-boilerplate.git ~/Workspace/projects/rudder-boilerplate
-
Create a symlink to be used as a volume, and maintain compatibility with your OS X friends
ln -s ~/Workspace/projects /projects
-
cd ~/Workspace/projects/rudder-boilerplate
-
make setup
-
make up