Monitoring vagrant
This vagranfile was defined to support the local development of the monitoring components of the piacere project. During intensive debugging of the deployment this avoids lots of git command that: take time, imply many infrastructure requirements (vpn, server, gitlab, ...).
It create a machine with docker compose that maps into the folder /monitoring-vagrant
Prerequisites
In order to use this vagrantfile you need virtualbox and vagrant.
Notes
Here we define some particularities of this vagrantifle
- This vagrant file is configured to save the image in a relative ../../vm folder to the location of this vagrantfile.
- This repo is heavily based in submodules, it may happen that you need to contact the repo owner for additional permissions on the included subfolders
- This vagrant file requires some environment variables to be defined in the host machine, they are listed in env.erb. The first two should be provided by someone, others can have any non-empty value.
- CA_API_KEY
- SMTP_API_KEY
- PORTAINER_PASSWORD
- INFLUXD_PASSWORD
- INFLUXD_TOKEN
- GRAFANA_ADMIN_PASSWORD
- The local environment is configured to user the following domains: monitoring.piacere.tri.dev, influxdb.monitoring.piacere.tri.dev, portainer.monitoring.piacere.tri.dev, agent.monitoring.piacere.tri.dev, portainer.monitoring.piacere.tri.dev. These domains should be added into the hosts file (in windows %WINDIR%\System32\drivers\etc\hosts elevated rights are required to edit it) of the host to support the resolution of addresses. The should point to the virtualbox ip i.e. 192.168.56.1 (usually in windows)
How to create
To create the machine clone this repo, go into the folder and execute vagrant up.
git clone --recurse-submodules https://git.code.tecnalia.com/piacere/private/t61-runtime-monitoring-and-self-healing-preparation/monitoring/monitoring-vagrant/-/tree/master
cd monitoring-vagrant
vagrant up
This will automatically install ansible and run a playbook that:
- process env.erb and stores under the ansible folder as .env
- install docker
- docker compose
- copy .env under git/monitoring-deploy/.local/.env
- will configure .profile to load git/monitoring-deploy/.local/.env as environment variables when login into the vm
How to run an docker compose
To run a docker compose, you will need to login into the machine, cd to the docker compose, source environment variables, build and deploy
vagrant ssh
once inside, for example to run monitoring vagrant for development
cd /monitoring-vagrant/git/monitoring-deploy
echo force linux EOL in case of
sed -i 's/\r//g' .local/develop/.env
set -a; source .local/develop/.env; set +a
.local/develop/build.sh
.local/develop/deploy.sh
How to access
Once we sucessfully deploy the docker-compose, we will be able to access the services at: