Giter Club home page Giter Club logo

caddy-gen's People

Contributors

alexanderjulo avatar hazcod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

caddy-gen's Issues

caddy-gen can't see any containers

Hey,

I've followed your tutorial to the letter, but can't get the caddy-gen container to put the details from the app to proxy into the Caddyfile.
The env vars are properly set (LETSENCRYPTEMAIL and VIRTUAL_HOST), but any container specific information is not filled.

I've googled around and found 2 issues in docker-gen and nginx-proxy which sound very similar to what I'm experiencing.
nginx-proxy/docker-gen#196
nginx-proxy/nginx-proxy#479
However I tried the solutions (remove -only-exposed from the docker-gen command and put all containers in external network), but they're not working for me.

I am using docker-compose (with a v3 file) to orchestrate the entire thing.
Any feedback or things I can test would be much appreciated.

Here's my docker-compose file for reference (without the tweaks suggested in the two linked issues)

version: "3"
services:
  web:
    image: <my-image>
    restart: on-failure:5
    environment:
      - LOGGING_LEVEL=info
      - VIRTUAL_HOST=<my-hostname>
      - SERVER_PORT=80

  caddy-gen:
    image: alexanderjulo/caddy-gen:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - config:/etc/caddy
    links:
      - web
    environment:
      - LETSENCRYPT_EMAIL=<my-email>

  caddy:
    image: alexanderjulo/caddy
    command: caddy -restart=inproc -agree
    ports:
      - 80
      - 443
    links:
      - web
    volumes:
      - config:/srv
      - /root/ssl:/root/.caddy/letsencrypt

volumes:
  config:
    driver: local

Here's the Caddyfile that gets generated with this setup

<my-hostname> {
    tls <my-email>
    proxy / :80  {
        proxy_header Host {host}
        proxy_header X-Real-IP {remote}
        proxy_header X-Forwarded-For {remote}
        proxy_header X-Forwarded-Proto {scheme}
    }
    log stdout
}

Sending incorrect SSL cert on first load

For some reason the wrong SSL cert is being sent on the first load of a newly added domain.

screen shot 2016-12-06 at 2 50 08 pm

I've been doing some testing and it looks like it takes upwards of 60 seconds before the correct SSL cert is active. Not sure if this is an issue with Caddy, Let's Encrypt or this docker container.

Here's my test ENV.

root@DELETE-AFTER-USE:~# docker ps
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS              PORTS                                                NAMES
95f9d8808296        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   3 minutes ago       Up 3 minutes        0.0.0.0:32784->80/tcp                                big_stallman
573fce14238a        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   3 minutes ago       Up 3 minutes        0.0.0.0:32783->80/tcp                                cranky_archimedes
e31ba406a45d        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   3 minutes ago       Up 3 minutes        0.0.0.0:32782->80/tcp                                compassionate_jennings
0f3b28d64501        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   3 minutes ago       Up 3 minutes        0.0.0.0:32781->80/tcp                                tiny_hypatia
770dca341198        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   3 minutes ago       Up 3 minutes        0.0.0.0:32780->80/tcp                                angry_kirch
3e82141eb38c        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   3 minutes ago       Up 3 minutes        0.0.0.0:32779->80/tcp                                peaceful_tesla
af5974a2850d        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   3 minutes ago       Up 3 minutes        0.0.0.0:32778->80/tcp                                distracted_carson
568ae47f9baa        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   3 minutes ago       Up 3 minutes        0.0.0.0:32777->80/tcp                                zen_fermat
010ad892d362        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   9 minutes ago       Up 9 minutes        0.0.0.0:32776->80/tcp                                high_mahavira
fab979346116        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   9 minutes ago       Up 9 minutes        0.0.0.0:32775->80/tcp                                jovial_swartz
377a23d9729e        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   9 minutes ago       Up 9 minutes        0.0.0.0:32774->80/tcp                                nauseous_stallman
269373f85a8b        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   9 minutes ago       Up 9 minutes        0.0.0.0:32773->80/tcp                                berserk_lamport
59e1c69fa4c5        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   9 minutes ago       Up 9 minutes        0.0.0.0:32772->80/tcp                                thirsty_yalow
4c367f9014b2        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   9 minutes ago       Up 9 minutes        0.0.0.0:32771->80/tcp                                big_bohr
b4f1189753b0        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   9 minutes ago       Up 9 minutes        0.0.0.0:32770->80/tcp                                sick_mclean
8bb7d1e18caa        dockercloud/hello-world   "/bin/sh -c 'php-fpm "   9 minutes ago       Up 9 minutes        0.0.0.0:32769->80/tcp                                thirsty_mestorf
a1161b138590        joshix/caddy              "/bin/caddy"             12 minutes ago      Up 6 minutes        0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 2015/tcp   lonely_panini
4014a64f49fd        alexanderjulo/caddy-gen   "/bin/sh -c '/usr/loc"   14 minutes ago      Up 14 minutes                                                            jolly_bhabha

Here's what I used to create all of this.

docker run -d -e [email protected] -v ~/.caddy/:/etc/caddy -v /var/run/docker.sock:/var/run/docker.sock alexanderjulo/caddy-gen

docker run -d -l autocaddy=1 -v ~/.caddy/Caddyfile:/var/www/html/Caddyfile:ro -v sslcerts:/etc/ssl/certs -p 80:80 -p 443:443 joshix/caddy

docker run -d -e VIRTUAL_HOST=a.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=b.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=c.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=d.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=e.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=f.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=g.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=h.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=i.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=j.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=k.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=l.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=m.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=n.test.wvvw.me -P dockercloud/hello-world
docker run -d -e VIRTUAL_HOST=o.test.wvvw.me -P dockercloud/hello-world

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.