inhumantsar.dockerautoproxy

dockerautoproxy

What is it?

This tool uses the jwilder/nginx-proxy Docker image to automatically set up a reverse proxy in Docker Swarm.

How does it work?

Using the Role

The image configures itself automatically, so you don’t need to do much beforehand. You can check the settings in defaults/main.yml.

It uses the alpine image by default. If you prefer, you can change nginx_version to latest to use a debian:jesse version instead.

A network named nginx_proxy_net is created, and your containers that need proxying must connect to this network.

Using Nginx Proxy

To proxy a container, you need to do two things: Open the necessary port and specify a virtual host.

You can open ports in the Dockerfile using EXPOSE, in the command line with --expose, or in the Docker Compose file with expose.

You need to set a virtual host by using an environment variable called VIRTUAL_HOST.

Advanced Features

Custom nginx Configurations

You can load custom nginx configurations by sharing a directory from the host with the dockerautoproxy_config_path variable. If the path doesn’t exist on the host, it will be created.

SSL Certificates

You can either generate SSL certificates automatically or provide your own. By default, the certificates are kept in a shared data volume between containers. To store them in a specific directory on the host, use the dockerautoproxy_certs_path.

To automatically create SSL certificates, set the Ansible variable dockerautoproxy_ssl_companion to true. This will start a second container to handle SSL certificate creation through Let's Encrypt. To do this for a service, set the container's environment variables LETSENCRYPT_HOST and LETSENCRYPT_EMAIL. For example:

$ docker run -d \
    --name example-app \
    -e "VIRTUAL_HOST=example.com,www.example.com,mail.example.com" \
    -e "LETSENCRYPT_HOST=example.com,www.example.com,mail.example.com" \
    -e "[email protected]" \
    tutum/apache-php
Informazioni sul progetto

Sets up a dynamic Nginx reverse proxy on Docker Swarm

Installa
ansible-galaxy install inhumantsar.dockerautoproxy
Licenza
bsd-3-clause
Download
103
Proprietario