Skip to content

Commit 4eb0089

Browse files
committed
feat(registry): use store component for filesystem layers
fix(registry): fix S3 calling format chore(registry): remove repositories data directory fix(registry): bump log level back down to info fix(registry): add boto_bucket option chore(registry): bump commit sha to latest fix(registry): bump to upstream, include repository-import functionality
1 parent 893414a commit 4eb0089

6 files changed

Lines changed: 69 additions & 13 deletions

File tree

registry/Dockerfile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ RUN useradd -s /bin/bash registry
2727
# add the docker registry source from github
2828
RUN git clone https://github.com/deis/docker-registry /docker-registry && \
2929
cd /docker-registry && \
30-
git checkout f93804c && \
30+
git checkout 94e7707 && \
3131
chown -R registry:registry /docker-registry
3232

3333
# install boto configuration
@@ -38,16 +38,11 @@ RUN cd /docker-registry && pip install -r requirements/main.txt
3838
RUN pip install /docker-registry/depends/docker-registry-core
3939

4040
# Install registry
41-
RUN pip install file:///docker-registry#egg=docker-registry[bugsnag]
41+
RUN pip install file:///docker-registry#egg=docker-registry[bugsnag,newrelic,cors]
4242

4343
ENV DOCKER_REGISTRY_CONFIG /docker-registry/config/config.yml
4444
ENV SETTINGS_FLAVOR deis
4545

46-
# create data volume
47-
RUN mkdir -p /data/repositories && chown -R registry:registry /data
48-
ENV STORAGE_PATH /data
49-
VOLUME /data
50-
5146
# define the execution environment
5247
WORKDIR /app
5348
CMD ["/app/bin/boot"]

registry/bin/boot

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export ETCD_TTL=${ETCD_TTL:-10}
1818
# run.sh requires $REGISTRY_PORT
1919
export REGISTRY_PORT=${PORT:-5000}
2020

21+
export BUCKET_NAME=${BUCKET_NAME:-registry}
22+
2123
# wait for etcd to be available
2224
until etcdctl --no-sync -C $ETCD ls >/dev/null 2>&1; do
2325
echo "waiting for etcd at $ETCD..."
@@ -34,15 +36,16 @@ function etcd_set_default {
3436
# seed initial service configuration if necessary
3537
etcd_set_default protocol http
3638
etcd_set_default secretKey ${REGISTRY_SECRET_KEY:-`openssl rand -base64 64 | tr -d '\n'`}
39+
etcd_set_default bucketName ${BUCKET_NAME}
3740

3841
# wait for confd to run once and install initial templates
3942
until confd -onetime -node $ETCD -config-file /app/confd.toml; do
4043
echo "registry: waiting for confd to write initial templates..."
4144
sleep $(($ETCD_TTL/2)) # sleep for half the TTL
4245
done
4346

44-
# reset filesystem permissions for data container
45-
test -d /data && chown registry:registry /data
47+
# ensure registry bucket exists
48+
/app/bin/create_bucket ${BUCKET_NAME}
4649

4750
# spawn the service in the background
4851
cd /docker-registry

registry/conf.d/config.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ gid = 0
66
mode = "0644"
77
keys = [
88
"/deis/cache",
9-
"/deis/registry"
9+
"/deis/registry",
10+
"/deis/store/gateway",
1011
]
1112
check_cmd = "/app/bin/check {{ .src }}"
1213
reload_cmd = "/app/bin/reload"

registry/conf.d/create_bucket.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[template]
2+
src = "create_bucket"
3+
dest = "/app/bin/create_bucket"
4+
uid = 0
5+
gid = 0
6+
mode = "0755"
7+
keys = [
8+
"/deis/store/gateway",
9+
]

registry/templates/config.yml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
common: &common
33
# Default log level is info
44
loglevel: _env:LOGLEVEL:info
5+
# Enable the debugging /_versions endpoint
6+
debug_versions: _env:DEBUG_VERSIONS:false
57
# By default, the registry acts standalone (eg: doesn't query the index)
68
standalone: _env:STANDALONE:true
79
# The default endpoint to use (if NOT standalone) is index.docker.io
@@ -53,6 +55,20 @@ common: &common
5355
# Enable bugsnag (set the API key)
5456
bugsnag: _env:BUGSNAG
5557

58+
# CORS support is not enabled by default
59+
cors:
60+
origins: _env:CORS_ORIGINS:["null"]
61+
methods: _env:CORS_METHODS
62+
headers: _env:CORS_HEADERS:[Content-Type]
63+
expose_headers: _env:CORS_EXPOSE_HEADERS
64+
supports_credentials: _env:CORS_SUPPORTS_CREDENTIALS
65+
max_age: _env:CORS_MAX_AGE
66+
send_wildcard: _env:CORS_SEND_WILDCARD
67+
always_send: _env:CORS_ALWAYS_SEND
68+
automatic_options: _env:CORS_AUTOMATIC_OPTIONS
69+
vary_header: _env:CORS_VARY_HEADER
70+
resources: _env:CORS_RESOURCES
71+
5672
local: &local
5773
<<: *common
5874
storage: local
@@ -71,6 +87,24 @@ s3: &s3
7187
s3_access_key: {{ or (.deis_registry_s3accessKey) "" }}
7288
s3_secret_key: {{ or (.deis_registry_s3secretKey) "" }}
7389

90+
# Ceph Object Gateway Configuration
91+
# See http://ceph.com/docs/master/radosgw/ for details on installing this service.
92+
ceph-s3: &ceph-s3
93+
<<: *common
94+
storage: s3
95+
s3_region: ~
96+
s3_bucket: {{ .deis_registry_bucketName }}
97+
s3_encrypt: false
98+
s3_secure: false
99+
storage_path: /registry
100+
s3_access_key: {{ .deis_store_gateway_accessKey }}
101+
s3_secret_key: {{ .deis_store_gateway_secretKey }}
102+
boto_bucket: {{ .deis_registry_bucketName }}
103+
boto_host: {{ .deis_store_gateway_host }}
104+
boto_port: {{ .deis_store_gateway_port }}
105+
boto_debug: 0
106+
boto_calling_format: boto.s3.connection.OrdinaryCallingFormat
107+
74108
# Google Cloud Storage Configuration
75109
# See:
76110
# https://developers.google.com/storage/docs/reference/v1/getting-startedv1#keys
@@ -139,8 +173,6 @@ elliptics:
139173
elliptics_logfile: _env:ELLIPTICS_LOGFILE:/dev/stderr
140174
elliptics_addr_family: _env:ELLIPTICS_ADDR_FAMILY:2
141175

142-
143-
144176
# This is the default configuration when no flavor is specified
145177
dev: &dev
146178
<<: *local
@@ -164,5 +196,5 @@ prod:
164196
deis:
165197
{{ if .deis_registry_s3accessKey }}<<: *s3
166198
{{ else if .deis_registry_swiftAuthURL }} <<: *openstack-swift
167-
{{ else }} <<: *local
199+
{{ else }} <<: *ceph-s3
168200
{{ end }}

registry/templates/create_bucket

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python
2+
import boto
3+
import sys
4+
from boto.s3.connection import OrdinaryCallingFormat
5+
6+
conn = boto.connect_s3(aws_access_key_id='{{ .deis_store_gateway_accessKey }}',
7+
aws_secret_access_key='{{ .deis_store_gateway_secretKey }}',
8+
host='{{ .deis_store_gateway_host }}',
9+
port={{ .deis_store_gateway_port }},
10+
is_secure=False,
11+
calling_format=OrdinaryCallingFormat(),
12+
)
13+
bucket = sys.argv[1]
14+
15+
if not bucket in conn.get_all_buckets():
16+
conn.create_bucket(bucket)

0 commit comments

Comments
 (0)