Hi,
I use nginx-proxy on my docker with 2 websites.
I want set my websites on HTTPS protocol with letsEncrypt.
i set in my docker-compose on nginx proxy:
letsencrypt-nginx-proxy-companion:
restart: always
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt-nginx-proxy-companion
volumes_from:
- nginx
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./volumes/proxy/certs:/etc/nginx/certs:rw"
environment:
- NGINX_DOCKER_GEN_CONTAINER=nginx-gen
and on my docker-compose website:
sample-website:
restart: always
image: sample-website
build: ./samples/website
container_name: sample-website
volumes:
- "./volumes/nginx-sample-website/conf.d/:/etc/nginx/conf.d"
- "./volumes/config/sample-website/config.js:/usr/share/nginx/html/config.js"
environment:
- VIRTUAL_HOST=samplewebsite.example.com
- VIRTUAL_NETWORK=nginx-proxy
- VIRTUAL_PORT=80
- LETSENCRYPT_HOST=sample.example.com
- [email protected]
My address is a gmail domaine.
i look a logs and i get:
2017/10/04 15:15:57 Contents of /app/letsencrypt_service_data did not change. Skipping notification '/app/update_certs'
2017/10/04 15:15:57 Received event die for container a6182eccc345
2017/10/04 15:15:58 Received event start for container a6182eccc345
2017-10-04 15:16:00,318:INFO:simp_le:1213: Generating new account key
ACME server returned an error: urn:acme:error:invalidEmail :: The provided email for a registration was invalid :: Error creating new registration :: not a valid e-mail address
Do you have a solution for this ? Thank you !
@Algodrill If you can share the external IP address you are running docker-compose from I can check the Let's Encrypt server-side logs to determine what email address was being rejected. That might make it easier to determine how to fix the problem.
@Algodrill Thanks for sending your IP address.
The server is receiving an invalid contact value:
mailto:\u003cno value\u003e.
(Edit: I opened an issue on Boulder - we should send the received invalid value back when rejecting it to make this sort of troubleshooting easier: https://github.com/letsencrypt/boulder/issues/3146)
@buchdag Do you know why the LETSENCRYPT_EMAIL @Algodrill is trying to set isn't being respected? I'm guessing the "no value" string is some kind of default from the templating? (I'm out of my areas of expertise here).
Another thought is that simp_le should probably try to validate that the contact email being provided is valid before using it for a new-reg request.
@cpu I wasn't able to reproduce letsencrypt-nginx-proxy-companion getting an empty LETSENCRYPT_EMAIL but I was using a working nginx/docker-gen/le-companion stack, without more information I can't say wether @Algodrill stack is properly configured or not.
You guessed correctly, if the letsencrypt_service_data ends up with an empty mail variable it means docker-gen was unable to get it from the to be proxyed container or that something went wrong with the template. Never encountered this case though.
Another thought is that simp_le should probably try to validate that the contact email being provided is valid before using it for a new-reg request.
Agreed, thanks for the suggestion.
@Algodrill can you share your entire docker-compose file for the nginx-proxy ?
Which versions of docker-gen, letsencrypt-nginx-proxy-companion, docker and docker-compose are you using ?
Aside from this mail issue you might not get certificate with this config anyway as the env variable VIRTUAL_NETWORK does not exist in nginx-proxy, so what you were trying to do with it won't work. If you were trying to attach your proxyed container to an existing nginx-proxy docker network, you should either add this to your docker-compose file:
networks:
default:
external:
name: nginx-proxy
or this:
sample-website:
[existing config]
networks:
- nginx-proxy
networks:
nginx-proxy:
external: true
Of course
version: '2'
services:
nginx-proxy:
restart: always
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- /srv/docker/nginx/certs:/etc/nginx/certs:ro
- /etc/nginx/vhost.d
- /usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
environment:
- DEFAULT_HOST=nodeapp.local
nginx-proxy-companion:
image: jrcs/letsencrypt-nginx-proxy-companion:latest
container_name: nginx-proxy-companion
volumes:
- "./volumes/proxy/certs:/etc/nginx/certs:rw"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
volumes_from:
- nginx-proxy
restart: always
environment:
- NGINX_DOCKER_GEN_CONTAINER=nginx-proxy
networks:
default:
external:
name: nginx-proxy
You need my docker-compose of my website?
Thanks again for help me ^^
You need my docker-compose of my website?
Yep, will be useful too. Don't forget to remove personal info like domains and mail adresses.
version: '2'
services:
db:
image: mysql:latest
volumes:
- db_data:/var/lib/mysql
container_name:website-db
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
restart: always
networks:
- external-foo
php:
build:
context: php7-fpm
args:
TIMEZONE: ${TIMEZONE}
volumes:
- ${SYMFONY_APP_PATH}:/var/www/symfony
- ./logs/symfony:/var/www/symfony/app/logs
container_name: website-php
networks:
- external-foo
links:
- db
nginx:
build: nginx
ports:
- 8081:8081
volumes_from:
- php
volumes:
- ./logs/nginx/:/var/log/nginx
container_name: website-nginx
environment:
- VIRTUAL_HOST=website.com
- LETSENCRYPT_HOST=website.com
- LETSENCRYPT_MAIL=default.[email protected]
networks:
- external-foo
networks:
external-foo:
external:
name: nginx-proxy
volumes:
db_data: {}
I see in your original post your wrote "LETSENCRYPT_EMAIL", but in the docker-compose.yml, you wrote "LETSENCRYPT_MAIL". Shouldn't it be EMAIL too?
Maybe that's why?
Because I had the same invalid email error and the typo in that variable was a cause.
@funaz is correct LETSENCRYPT_MAIL won't work.
Fixed by 1bb6e861bfc669fc4707dfad3bd8ca88a01cb566.