Sunday 21 May 2017

Get nodejs working with letsencrypt through traefik

I have just begun looking at traefik as a reverse proxy for my nodejs application I am running in docker.Now I am looking into how to get letsencrypt to work with traefik. I have never tried something like this before, and I am therefore looking for a more or less step by step guide.ATM I have these different files to spin it all up with docker-compose:Dockerfile:FROM node:6.3.0 RUN mkdir -p /usr/src/app WORKDIR /usr/src/app RUN npm install -g nodemon COPY package.json /usr/src/app RUN npm install COPY . /usr/src/app EXPOSE 3000 CMD ["npm", "start"] docker-compose.yml:version: "2" services: web: build: . volumes: - .:/app ports: - "3000:3000" links: - database labels: - "traefik.port=3000" - "traefik.backend=web" - "traefik.protocol=https" - "traefik.frontend.entryPoints=https" - "traefik.frontend.rule=Host:hostname.com" database: image: mongo container_name: mongo ports: - "27017:27017" volumes_from: - mongodata command: --smallfiles --noprealloc mongodata: image: tianon/true volumes: - ./data/db:/data/db traefik: image: traefik:v1.1.1 command: --web.readonly --docker --docker.watch --docker.domain=docker.localhost --logLevel=DEBUG --entryPoints="Name:http Address::80" ports: - "80:80" - "443:443" - "8080:8080" volumes: - /var/run/docker.sock:/var/run/docker.sock - /etc/traefik/traefik.toml:/etc/traefik/traefik.toml - /etc/traefik/acme.json:/etc/traefik/acme.json traefik.toml:defaultEntryPoints = ["http", "https"] [web] address = ":8080" [entryPoints] [entryPoints.http] address = ":80" [entryPoints.https] address = ":443" [entryPoints.https.tls] [acme] email = "my@email.com" storageFile = "acme.json" entryPoint = "https" onDemand = true onHostRule = true Some of the things I am speculating is how the certificate is generated. Do I do this elsewhere or is this taken care of from traefik. When I read different guides it seems like this is taken care from by traefik, but I cannot access my site with httpsI hope this is the correct place to ask. Otherwise let me know. I am only here to learn :)

Submitted May 21, 2017 at 11:47PM by lidttilvenstre

No comments:

Post a Comment