-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial draft #2
Changes from 3 commits
ce3b53a
a6b8277
32605b0
f25c5ef
8abbeb5
8231325
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#Template from https://docs.docker.com/registry/recipes/nginx/ | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
|
||
upstream docker-registry { | ||
server registry:5000; | ||
} | ||
|
||
## Set a variable to help us decide if we need to add the | ||
## 'Docker-Distribution-Api-Version' header. | ||
## The registry always sets this header. | ||
## In the case of nginx performing auth, the header is unset | ||
## since nginx is auth-ing before proxying. | ||
map $upstream_http_docker_distribution_api_version $docker_distribution_api_version { | ||
'' 'registry/2.0'; | ||
} | ||
|
||
server { | ||
listen 443 ssl; | ||
server_name docker.cdot.systems; | ||
|
||
# SSL | ||
ssl_certificate /etc/nginx/conf.d/domain.crt; | ||
ssl_certificate_key /etc/nginx/conf.d/domain.key; | ||
|
||
# Recommendations from https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html | ||
ssl_protocols TLSv1.1 TLSv1.2; | ||
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; | ||
ssl_prefer_server_ciphers on; | ||
ssl_session_cache shared:SSL:10m; | ||
|
||
# disable any limits to avoid HTTP 413 for large image uploads | ||
client_max_body_size 0; | ||
|
||
# required to avoid HTTP 411: see Issue #1486 (https://github.com/moby/moby/issues/1486) | ||
chunked_transfer_encoding on; | ||
|
||
location /v2/ { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to make sure I understand. We will push our image to |
||
# Do not allow connections from docker 1.5 and earlier | ||
# docker pre-1.6.0 did not properly set the user agent on ping, catch "Go *" user agents | ||
if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) { | ||
return 404; | ||
} | ||
|
||
# To add basic authentication to v2 use auth_basic setting. | ||
auth_basic "Registry realm"; | ||
auth_basic_user_file /etc/nginx/conf.d/nginx.htpasswd; | ||
|
||
## If $docker_distribution_api_version is empty, the header is not added. | ||
## See the map directive above where this variable is defined. | ||
add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always; | ||
|
||
proxy_pass http://docker-registry; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be docker.cdot.systems? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, we probably don't need the |
||
proxy_set_header Host $http_host; # required for docker client's sake | ||
proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_read_timeout 900; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#https://docs.docker.com/registry/deploying/#deploy-your-registry-using-a-compose-file | ||
services: | ||
TDDR marked this conversation as resolved.
Show resolved
Hide resolved
|
||
nginx: | ||
image: "nginx:alpine" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
ports: | ||
humphd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- 5043:443 | ||
restart: unless-stopped | ||
links: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need this, since our registry is named |
||
- registry:registry | ||
volumes: | ||
- ./auth:/etc/nginx/conf.d | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @manekenpix where should we put our files in the host? It might make sense to have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had thought the same thing originally, but after going back and looking at the documentation I saw this. So I decided to go with the current folder structure. I can create and move it back to a config folder though? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the easiest way to do this is to mimic the layout of what we'll pass in within our repo:
This way you can look at the overlays we have in our repo, and understand quickly where they end-up in the container.
|
||
- ./auth/nginx.conf:/etc/nginx/nginx.conf:ro | ||
|
||
# SSL certificate management for nginx | ||
certbot: | ||
image: certbot/certbot | ||
container_name: 'certbot' | ||
volumes: | ||
- ../../certbot/conf:/etc/letsencrypt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar question here, we need to determine our local path There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe somewhere in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, |
||
- ../../certbot/www:/var/www/certbot | ||
restart: always | ||
# This will check if your certificate is up for renewal every 12 hours as recommended by Let’s Encrypt | ||
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'" | ||
TDDR marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
registry: | ||
restart: always | ||
image: registry:2 | ||
environment: | ||
REGISTRY_HTTP_TLS_CERTIFICATE: /certs/domain.crt | ||
REGISTRY_HTTP_TLS_KEY: /certs/domain.key | ||
REGISTRY_AUTH: token | ||
REGISTRY_AUTH_TOKEN_REALM: Registry Realm | ||
REGISTRY_AUTH_TOKEN_SERVICE: Token services | ||
REGISTRY_AUTH_TOKEN_ISSUER: Registry token issuer | ||
REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE: /root/certs/bundle | ||
volumes: | ||
- /telescope/data:/var/lib/registry | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should figure out where in the host we're going to put our stuff. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you say There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct, so it would be:
Such that the container will overlay |
||
- /telescope/certs:/certs | ||
- /telescope/auth:/auth |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# https://docs.docker.com/registry/configuration/ | ||
|
||
version: 0.1 | ||
log: | ||
level: debug | ||
fields: | ||
service: registry | ||
storage: | ||
cache: | ||
blobdescriptor: inmemory | ||
filesystem: | ||
rootdirectory: /mnt/docker0storage/registry | ||
http: | ||
addr: 443:5000 # https://docs.docker.com/registry/configuration/#letsencrypt | ||
host: docker.cdot.systems | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we change it to ${DOMAIN} like what @manekenpix suggested in one of the other file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we do, we'll have to use |
||
tls: | ||
certificate: /path/to/x509/public | ||
key: /path/to/x509/private | ||
letsencrypt: | ||
cachefile: /path/to/cache-file | ||
email: [email protected] | ||
#hosts: [myregistryaddress.org] | ||
headers: | ||
X-Content-Type-Options: [nosniff] | ||
auth: | ||
token: | ||
realm: token-realm | ||
service: token-service | ||
issuer: registry-token-issuer | ||
rootcertbundle: /root/certs/bundle | ||
# redis: | ||
# addr: localhost:6379 | ||
# password: asecret | ||
# db: 0 | ||
# dialtimeout: 10ms | ||
# readtimeout: 10ms | ||
# writetimeout: 10ms | ||
# pool: | ||
# maxidle: 16 | ||
# maxactive: 64 | ||
# idletimeout: 300s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use a variable here, in case we decide to move it somewhere else.