mirror of
https://github.com/jcwimer/startup-infrastructure
synced 2026-03-24 22:34:42 +00:00
2.3 KiB
2.3 KiB
startup-infrastructure
This is an Ansible playbook that configures a Docker Swarm cluster and deploys a full set of self hosted tools for a new company. After you point a wildcard A record to the swarm, you will be able to access the following tools. The goal of this project is to create a one stop shop for self hosting your infrastructure.
Services
- Docker management GUI - Using Portainer
- Internal swarm load balancer and letsencrypt endpoint - Traefik
URLs in your environment. If you use ssl obviously these will be https Assuming your A record is *.test.com:
- http://portainer.test.com/ - Portainer
- http://swarm.test.com:8081/ - Traefik load balancer dashboard
Deploy
Requirements
- Python
- Pip
- Pipenv
- SSH access to all nodes you're deploying to.
- You will need to define and environment variable for your ssh key.
export PRIVATE_KEY="/location/of/key" - OR you will need a ssh agent running
- You will need to define and environment variable for your ssh key.
Steps
- Copy hosts.example to hosts
- Put ip addresses under the sections
- Bootstrap will be the first node in the cluster. If you are only doing a one node cluster, this is where you put your ip
- Managers are nodes used for managing a swarm cluster. Managers are recommended in 3's or 5's (bootstrap is a manager). Please see this for swarm best practices: https://docs.docker.com/engine/swarm/admin_guide/
- Workers are nodes used for running containers. You can have as many as necessary.
- Copy group_vars/all.example to group_vars/all
- This is where a lot of configuration comes in. Please see our documentation.
- Run
bash supporting-scripts/deploy.sh
Lab environment
You can easily run a lab environment with Vagrant.
Requirements
- Install Virtualbox
- Install Vagrant
- Run
vagrant up - Run
vagrant ssh client -c 'bash /vagrant/tests/files/run-test-deploy.sh' - Put the following in your
/etc/hostsfile:192.168.254.2 swarm.test.com192.168.254.2 portainer.test.com
- Now navigate to any of the services at http://servicename.test.com
Development
This project is tested with bash and Vagrant.
Requirements
- Install Virtualbox
- Install Vagrant
- Run
bash tests/vagrant-tests.sh