This a code repository template. You can fork it and use it as a base for your service(s) or download it and fit it into your existing repository.
This is the start of the journey with your stack.
This stack is meant to be used with Docker and docker-compose to provide teams with a standard way to have :
You could have one single service code base in the code folder but you could also have more and use this as a single repository setup for all your services and possibly infrastructure too.
We see it as a way to get everything the team needs into a single place with git versionning it all. And if you use git-appraise then you even get code reviews within.
One or more services code bases. It comes with a basic Dockerfile using a simple hello world sinatra app. You can replace it with what ever you want.
Technical documentation for the service(s) and possibly including your team code of conduct, team charter, coding style, deployment and release processes documentation, ...
Docker is a handy way to get services dependencies running. The default docker-compose.yml
included in this repository comes with a few services :
haproxydata
folder check it out to figure out how to extend for more servicespgdata
folder so that you don't lose everything upon each stop and start of the containerdocumentation
folder, they will appear automatically in your doc web host.HaProxy is used to simplify your life here : no specific port to remember, you can use hostnames, if you adjust the configuration in a few files.
While a bit intimidating it's actually fairly straight forward. The haproxydata
folder contains an example to start from.
If you want a web service and the documentation to be pointed to with using hostnames such as web.myteam.local and doc.myteam.local you should have the following :
global
log /dev/log local0
log /dev/log local1 notice
daemon
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
frontend web
bind *:8000
mode http
acl web hdr_sub(host) -i web.myteam.local
acl doc hdr_sub(host) -i doc.myteam.local
use_backend web if web
use_backend documentation if doc
option httpclose
default_backend documentation
backend web
timeout server 4h
balance leastconn
server web1 172.17.0.1:3000
backend documentation
timeout server 4h
balance leastconn
server doc1 172.17.0.1:4000
So alter the hostnames according to your needs.
It's good to note that the ip address used for the backends are the one of the docker host. So depending on your settings you might want to change that too.
Once you have made the changes in the haproxy config file you want to edit your /etc/hosts file and add entries pointing to the right place :
0.0.0.0 myteam.local web.myteam.local doc.myteam.local
Finally, if you want everything to stay on doc.example.org.local you will want to change the _config.yml
file in the documentation
folder.
title: Documentation
email: [email protected]
description: >- # this means to ignore newlines until "baseurl:"
This is the internal documentation for the ChangeMe team
baseurl: "/" # the subpath of your site, e.g. /blog
url: "http://doc.myteam.local:8000"
markdown: kramdown
theme: just-the-docs
plugins:
- jekyll-feed
search_enabled: false
url
should be set correctly depending on the hostname you decided to use for the documentation part. The port should be the one you picked for the haproxy service, which is 8000 by default.
At the very least you need to edit the /etc/hosts so that it includes the myteam.local
, web.myteam.local
and doc.myteam.local
entries. With just that done you can run docker-compose up
and the defaults will work. Head to http://myteam.local:8000
and you will land on the documentation host.