This directory includes Ansible playbooks to setup an Nginx webserver on Ubuntu as proxy for the VersionEye App and API Docker containers. On Ubuntu Ansible can be installed like this:
sudo apt-get install ansible
This directory includes 2 different roles for Nginx. There is a simple nginx
role which installs an
Nginx on port 80 with a configuration to forward requests to localhost:8080
(VersionEye Web App) and to
localhost:9090
(VersionEye API). Beside that there is another role called nginx_ssl
, which is a bit
more complex but it includes everything to spin up an Nginx with SSL certificates.
To be able to execute this Ansible playbooks you need to checkout/clone this repository and navigate in your console into this directory. Ansible is always looking for the playbooks in the current directory.
Some little changes are needed before this plyabook can be executed.
- Configure the IP address of your Host (VersionEye server) in the hosts file.
- Configure the server name in the nginx config.
Execute the playbook:
ansible-playbook setup_remote_nginx.yml
If you wanna execute the playbook on the Host itself, means on localhost, than please use this playbook:
ansible-playbook setup_locale_nginx.yml
First of all configure the IP address of your Host (VersionEye server) in the hosts file. That is mandatory if you run the remote playbooks. If you execute Ansible on the VersionEye server you don't have to adjust the hosts file.
This playbook assumes that you create your own self signed SSL certifaces like described in this blog post and the cert files are placed in this places:
/etc/ssl/certs/nginx-selfsigned.crt;
/etc/ssl/private/nginx-selfsigned.key;
If you have already other certifaces please place them at the directories described above or adjut the paths in this playbooks. To create your own self signed certificate run this command on the server:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt
Now adjust the server_name in the default.conf#L15-L16 and default.conf#L21 file. If there is no Domain registred for your server, simply use the public IP address of the server. Then run the playbook to update the Nginx configuraiton:
ansible-playbook setup_remote_nginx_ssl.yml
If you want to execute the playbook on the Host/Server itself, means on localhost, than please use this playbook:
ansible-playbook setup_locale_nginx_ssl.yml
After this there should be a success message from Ansible and you should be able to access the Server like this https://<IP_OR_DOMAIN>/
.