evertramos / nginx-proxy-automation

Automated docker nginx proxy integrated with letsencrypt.
MIT License
2.66k stars 631 forks source link

Problems with setting up an environment (Go + MongoDB + Redis) #58

Closed kanzitelli closed 6 years ago

kanzitelli commented 6 years ago

Hello,

I am facing a problem with setting up my environment. My server is written in Golang + MongoDB + Redis and I am trying to make it work all together with your great tool.

I am also using Vsale.io (Digital Ocean analogue) as a VPS. I have cloned your repo to one folder and have other code (Go + Mongo + Redis) and different docker-compose.yml file for these containers. I have connected all of them to one network webproxy (docker network inspect shows that containers are all set), opened port :80 on Golang side but it still doesn't want to open the page even though all containers are running. Also I am using a public IP that is provided by Vsale.io in the dashboard and OS is Ubuntu 16.04.

Do you have any suggestions that I can try to fix this issue? Or maybe it would be better if I send some logs and information?

Thank you 🙂

evertramos commented 6 years ago

Hello @kanzitelli,

I always suggest that first of all you get the webproxy running and test it with out test script before going to the services containers.

After you get the webproxy up and running you start to put up your services. In your case, I would like to confirm that you have a service listening on port 80 in your container, right? so you must inform the proxy to forward it to your container. Please add the following line to your golang (which has a service to listen on port 80):

golang:
     environment:
       VIRTUAL_HOST: your.domain.com

Than you will probably be able to access it through the proxy.

Please test it and let us know.

kanzitelli commented 6 years ago

Hello @evertramos,

Thank you for the quick response! I have tried creating a new droplet on DigitalOcean to test because somehow I couldn't get proper logs from containers running on Vscale VPS. So I have followed all the steps again on the DO droplet to run test httpd:alpine and it worked for me but only for http however I have created it with -e LETSENCRYPT_HOST=your.domain.com. And no positive results for https. Then I have checked logs for each container and it came out that logs for jrcs/letsencrypt-nginx-proxy-companion container show the error: 2018-03-20 22:27:52,633:INFO:simp_le:1407: By using simp_le, you implicitly agree to the CA's terms of service: https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf ACME server returned an error: urn:acme:error:malformed :: The request message was malformed :: Error creating new authz :: Issuance for IP addresses not supported

Basically my problem is that I am using IP address instead of a real domain? I didn't know about that 🙂 So I have registered one, added it to DO and waiting for DNS addresses to be updated. And hopefully it will work!

UPD:

@evertramos I finally got all containers to run together 🎉 The problem was that I have to use a real domain name, no IPs.

Muito obrigado pela sua ajuda 🙂

evertramos commented 6 years ago

Thanks for your reply!

Yes, you must have real domains to get ssl.

De nada e ficamos à disposição.