Starting point for turning a single VM into a containerized cloud development suite or lightweight container hosting environment. You can also just take the bones and basically do whatever you want with it.
Deploy any number of docker containers to almost any flavor Linux VM, as long as it supports docker
and docker-compose
your golden (although some may prove more difficult than others). Currently this repo is being developed on a Ubuntu 18.04 LTS Minimal VM on GCE (n1-standard-2).
All the monthly fees for git, logging, monitoring, error monitoring, alerting, CI, etc etc really start to add up don't they... Well cancel a bunch of monthly fees with me, plus you don't even need to spend 100s of hours debugging to get it all working.
- Portainer (gui)
- ELK Stack (logging)
- Grafana/Prometheus (monitoring)
- Gitea (git)
- Sentry (errors)
- Mattermost (chat)
- NGINX (proxy)
- LetsEncrypt (safety)
- Code Server (editor)
- Bit (code)
That is the goal anyways, its all containerized so add or subtract as you see fit.
Unfortunatly this setup with the SSL provisioning is not localhost friendly, also I am not actively supporting installing or running this on anything except a linux VM or if you are slick and run linux as your everyday OS you can get it working locally pretty easily. If you want to try it on Windows be my guest but I bet it won't be fun.
-
On your host VM install
docker
anddocker-compose
, if you can't get this going probably this stack is not what your looking for anyways. -
On the host make sure /etc/sysctl.conf has vm.max_map_count set to at least 262144 -
vm.max_map_count=262144
-
Point all the subdomains you will be using to the public IP of your host VM, these are examples of what you may want to use.
- kibana.example.com
- cadvisor.example.com
- alertmanager.example.com
- portainer.example.com
- grafana.example.com
- prometheus.example.com
- sentry.example.com
- Go through all the compose.yml files in the root directory and find-replace your configured domains for NGINX/SSLs and email address for LetsEncrypt if you want emails from them about alerts on your SSLs.
find -type f -name "*-compose.yml" | xargs sed -i "s/example.com/yourdomain.com/g"
find -type f -name "*-compose.yml" | xargs sed -i "s/[email protected]/[email protected]/g"
- (Optional) Setup / change / remove / add proxy configurations in the proxy/conf.d folder, they will all be mounted inside your NGINX container and used.
- Install the proxy
docker-compose -f proxy-compose.yml up -d
- Install the logging
docker-compose -f logging-compose.yml up -d
** Optional ** Setup basic auth for kibana
sudo sh -c "echo -n '[username]:' >> /var/lib/docker/volumes/dockerize-your-dev_htpasswd/_data/kibana.example.com"
sudo sh -c "openssl passwd -apr1 >> /var/lib/docker/volumes/dockerize-your-dev_htpasswd/_data/kibana.example.com"
- Install the monitoring
docker-compose -f monitoring-compose.yml up -d
** Optional ** Setup basic auth for cadvisor, alertmanager, and prometheus
sudo sh -c "echo -n '[username]:' >> /var/lib/docker/volumes/dockerize-your-dev_htpasswd/_data/cadvisor.example.com"
sudo sh -c "openssl passwd -apr1 >> /var/lib/docker/volumes/dockerize-your-dev_htpasswd/_data/cadvisor.example.com"
sudo sh -c "echo -n '[username]:' >> /var/lib/docker/volumes/dockerize-your-dev_htpasswd/_data/alertmanager.example.com"
sudo sh -c "openssl passwd -apr1 >> /var/lib/docker/volumes/dockerize-your-dev_htpasswd/_data/alertmanager.example.com"
sudo sh -c "echo -n '[username]:' >> /var/lib/docker/volumes/dockerize-your-dev_htpasswd/_data/prometheus.example.com"
sudo sh -c "openssl passwd -apr1 >> /var/lib/docker/volumes/dockerize-your-dev_htpasswd/_data/prometheus.example.com"
- Install the docker GUI
docker-compose -f gui-compose.yml up -d
- Visit Portainer configured URL to setup your admin account UN and PW
- Generate a secret key. Add it to sentry/.env as SENTRY_SECRET_KEY
echo -e "\nSENTRY_SECRET_KEY=$(docker-compose run --rm sentry-base sentry config generate-secret-key)" >> sentry/sentry.env
- Build the database. Use the interactive prompts to create a user account
docker-compose -f sentry-compose.yml run --rm sentry-base sentry upgrade
- Start it
docker-compose -f sentry-compose.yml up -d
** To Upgrade **
Use the following steps after updating sentry Dockerfile:
docker-compose -f sentry-compose.yml run --rm sentry-web upgrade
docker-compose -f sentry-compose.yml up -d
sudo sh -c "echo -n '[username]:' >> /var/lib/docker/volumes/dockerize-your-dev_htpasswd/_data/${VIRTUAL_HOST}"
sudo sh -c "openssl passwd -apr1 >> /var/lib/docker/volumes/dockerize-your-dev_htpasswd/_data/${VIRTUAL_HOST}"
https://github.com/jwilder/nginx-proxy
https://github.com/buchdag/letsencrypt-nginx-proxy-companion-compose
https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion