Where I keep track of the Bellow's Riddle Quest data so I can share it with my team
Steps for installing and building this app are as follows.
- Install node.js
- Check-out the git repository
After you have a git clone of the repo, run the following commands:
cd app
npm install
npm start
This will generate the build
directory which has all the combined javascript libraries.
Just stick the entire repository behind a web server and navigate to http://webserver-root/app/index.html. It's important to have the entire repository behind a web server so that javascript can fetch the json list of riddles.
Build an instance
gcloud compute instances create bellows-docker \
--image container-vm-v20140925 \
--image-project google-containers \
--zone us-central1-a \
--machine-type f1-micro
Pull the docker and start the App
docker pull <tinmanpiano/bellows-riddles-app>
docker run --name <container-name> -d -p 80:80 <tinmanpiano/bellows-riddles-app>
You need to enable http access through the firewall, but that should be all it takes to get a version running on GCE.
If you have used a private Docker Registry from https://registry.hub.docker.com (as I do in my example) and set it up to pull from Github it would rebuild every time master gets pushed. Remember, you will need to wait for the build to finish before you can pull it.
docker stop <container-name>
if stop doesn't work kill.
docker rm <container-name>
docker pull tinmanpiano/bellows-riddles-app
docker run --name <container-name> -d -p 80:80 tinmanpiano/bellows-riddles-app
One Line version (assuming you are named it bellows-dev
, and use docker registry)
sudo docker stop bellows-dev && sudo docker rm bellows-dev && sudo docker pull tinmanpiano/bellows-riddles-app && sudo docker run --name bellows-dev -d -p 80:80 tinmanpiano/bellows-riddles-app
You don't want to wait for registry to build you can make you own docker on the VM and run it yourself.
docker build -t tinmanpiano/bellows-riddles-app:dev .docker
docker run --rm --name <container-name> -p 9001:80 tinmanpiano/bellows-riddles-app:dev
This will ssh you into the Docker. Good for Debugging, but remember everything you do will magically vanish when you Kill docker.
docker run --rm -p 9001:80 -it tinmanpiano/bellows-riddles-app:dev /bin/bash
docker ps -a
will show you all current docker containers (even ones not running) you can check to make sure you aren't exploding your machine with containers. Killing a container does not remove it. It just stops it. using the flag --rm
means it will remove it's self when you kill it so you don't need to manually.
I have a Mac and Boot2Docker is easy to use to do local development. Once installed you got to your repo's root folder and run. From the following guide I have reduced it to the parts needed to run our app.
- http://viget.com/extend/how-to-use-docker-on-os-x-the-missing-guide Prolly need this to figure it out/
- https://github.com/boot2docker/boot2docker/blob/master/README.md#container-port-redirection
Requirements Homebrew XCode Devel Tools
brew update
brew install docker
brew link docker
brew install boot2docker
The Link may not be necessary. I had the Boot2Docker app installed before so I think I needed Homebrew to overwrite the link the Mac App made.
boot2docker init
boot2docker up
export DOCKER_HOST=tcp://192.168.59.103:2375
Your VM might have a different IP address—use whatever boot2docker up told you to use. You probably want to add that environment variable to your shell config.
boot2docker ssh
git clone https://github.com/Tinmen/bellows-riddles-app.git
cd /home/docker/bellows-riddles-app
docker build -t bellows-dev-serv .
docker run --rm -p 80:80 -it bellows-dev-serv
^ | I can get it to this point but then it doesn't let me see it in the browser... I get a blank page, with HTML, just no content. So something is buiding wrong somewhere...
<html><head>
<meta charset="utf-8">
<title>Bellow's Riddle Adventure</title>
<meta name="description" content="Bellow's Riddle Adventure">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<!-- Bootstrap -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="/src/styles.css">
<!-- custom fonts -->
<link href="http://fonts.googleapis.com/css?family=Quicksand:300,400,700|Pacifico" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container-fluid">
<div id="main">
</div>
</div>
<script type="text/javascript" src="build/riddles.js"></script>
</body></html>
Initial setup
boot2docker up
$(boot2docker shellinit)
docker run --rm --name dev-serv -p 9001:80 dev-serv
then next step should be, but my current terminal is stuck serving the web service so I can't run it in the same terminal.
open http://$(boot2docker ip 2>/dev/null)/
I can do it on a terminal from my machine but it just shows a blank page. Not a 404 error. Just a blank page. If I refresh then it gives me
Google Chrome's connection attempt to 192.168.59.103 was rejected. The website may be down, or your network may not be properly configured. Error code: ERR_CONNECTION_REFUSED