Config files for the bcloud (bengo's cloud) Some parts require gcloud.
BIG NOTE: This is intentionally experimental so I have some excuse to follow Docker, Kubernetes, etc. If you see me doing something wrong, or wonder about how this whole thing works, file an issue so I can learn or teach or both.
Sometimes you need to run your cloud locally. It can be hard to run a complex set of services in a standard way across e.g. OS X, Linux, and Windows.
Regardless of Host OS, If you can run (a linux vm +) docker, you can run bcloud by doing the following:
- Install Docker (if you're a Mac user, I highly recommend boot2docker) and Docker Compose.
docker-compose up
. use-d
to keep everything detached, if you don't care to watch the logs in stdout)open http://`boot2docker ip`/
(or IP of your DOCKER_HOST, if not using boot2docker) to see a running bengo-web
Wow, that was easy.
See docker-compose.yml for the service definitions.
Running a cloud locally is nice, but eventually you want to deploy to some remote hardware.
To help, this repo includes Kubernetes-compatible JSON descriptions of how to use a fleet of VMs to run the bcloud apps with replication, auto-restart, etc.
- ./pods -
- bengo-web - HTTP handler for bengo.is. Built from Docker image pulled from gcr.io/bengo-is/bengo-web
- ./services
- bengo-web - A load balancer to route the publicIp:80 (
dig bengo.is
) across all the bengo-web pods.
- bengo-web - A load balancer to route the publicIp:80 (
- ./controllers
- bengo-web-controller - Says 'always be running 3 pods of bengo-web'. If one dies, it'll be replaced within a second or two.
Why?
- kylewm.com in indiewebcamp irc: "I want it to be more like php where you can just add new little services everywhere without having to spin up a dedicated application server for each one"
./bin/deploy-public
will rsync ./public with gs://bengo/ (public link)- TODO: I could DNS to this as e.g.
storage.bengo.is
- TODO: I could DNS to this as e.g.
I'm still figuring that out. :)
The main thing I care about is a command to: 're-pull the published bengo-web gcr docker image, and recreate all the pods in the bengo-web-controller'.
Instead, I publish the container
gcloud preview docker push gcr.io/bengo-is/bengo-web
Then... I don't remember.
- I think I just killed all the bengo-web pods. Then they rebooted and had latest image.
- That sounds too simple...
- #TODO - Update the next time I deploy bengo.is src code
- Go write your app (or use someone elses)
- Publish a Docker image of it somewhere (like GCR or docker hub)
- Add to ./controllers describing how many replicas you want, and a pod template
- If this service should be publicly available on the network (and not just some e.g. job-processing pod)
- Create a ./service for it that describes the port mappings
- Via a means outside of Kubernetes (like Google Console or other gcloud commands), create a path from the public network to the k8s nodes
- TODO Elaborate/Document next time