Flexible Dockerized Phoenix Deployments (1.2 & 1.3)

docker
deployment
phoenix
Tags: #<Tag:0x00007fc830cc81c0> #<Tag:0x00007fc830cc8080> #<Tag:0x00007fc830cc7ef0>

#21

If I were to use HAProxy instead of nginx, would it simply be making a docker-compose file, like at Step 8, but configure a HAProxy Docker instance instead in the docker-compose.yml?

I already have an ansible playbook that deploys HAProxy and I’m in the middle of adding the deployment of letsencrypt on it. So would it be possible to skip Step 8 in this guide and separately install HAProxy with ansible? Would the backend still communicate with the ansible-deployed HAProxy?


#22

I don’t really know much about Ansible but I would suspect that it either installs HAProxy to your local machine or to some kind of container/VM like Docker. Either way, you wouldn’t use the Docker network to connect your containers together since your HAProxy install wouldn’t be inside Docker. In that case, skip step 8 since you won’t need NGINX at all. Instead, check out the second note in step 6 about exposing the ports of your server container to the local host (the computer which is running Docker). Check out the Docker Compose docs here: https://docs.docker.com/compose/compose-file/#ports and use the ports: ... line in your compose file to expose the Phoenix server port to your local host. Then, you can use HAProxy to proxy port 80 traffic from the correct domain to your internal port that you exposed with Docker Compose (just like NGINX was doing).

I don’t know much about Ansible or HAProxy but I’m sure the above solution would work. Let me know if that makes sense :slight_smile:


#23

OK thanks for the guidance. WIll chip away at this.