-
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 4 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,60 @@ | ||
#Template from https://docs.docker.com/registry/recipes/nginx/ | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
## 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 ${DOMAIN}; | ||
|
||
# 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/ { | ||
# 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. | ||
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. NOTE: for testing on the box, we could remove this completely. And when we do token-based/oauth, we won't need it. |
||
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://registry:${PORT}; | ||
TDDR marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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,41 @@ | ||
# https://docs.docker.com/registry/configuration/ | ||
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. Where is this file used? it seems we're not passing its path as argument anywhere. 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. What's the answer to this question? Can we remove it? If it's going to be used it would be in the docker-compose file below, but you have it commented out. 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 was unsure of the volume naming convention for it, and it would seem that the default configuration is adequate for what we have so far. I'm not sure this config file is needed? 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. The only thing we really need from this is to configure auth. Before we can use this for real, we need to have auth. In a follow-up we need:
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. @TDDR delete this file until we need it. |
||
|
||
version: 0.1 | ||
log: | ||
level: debug | ||
TDDR marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
tls: | ||
certificate: /path/to/x509/public | ||
key: /path/to/x509/private | ||
letsencrypt: | ||
cachefile: /path/to/cache-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. This section seems wrong. Do we need to do any SSL stuff in here, since nginx is handling it? I doubt it. |
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#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:stable-alpine" | ||
ports: | ||
humphd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- 443:443 | ||
restart: unless-stopped | ||
volumes: | ||
- ./config/etc/nginx/conf.d:/etc/nginx/conf.d | ||
|
||
# SSL certificate management for nginx | ||
certbot: | ||
image: certbot/certbot | ||
container_name: 'certbot' | ||
volumes: | ||
- ./config/etc/letsencrypt:/etc/letsencrypt | ||
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: | ||
- /mnt/docker0storage/registry:/var/lib/registry | ||
TDDR marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
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.
@manekenpix where will certbot put these?
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.
We're setting
/etc/letsencrypt
below, but I don't know where under there it puts things.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.
This should probably be like what we do for telescope's front-end, here.
I think we'll have to change the docker file to match this.