Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit a409762

Browse files
committed
Merge pull request #525 from docker/next
Next
2 parents d6ffacf + 2d08d4d commit a409762

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+238
-224
lines changed

.travis.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ python:
44
- "2.6"
55
- "2.7"
66

7+
before_install:
8+
- sudo apt-get update
9+
- sudo apt-get install redis-server
10+
- sudo apt-get install libevent-dev liblzma-dev
11+
712
install:
813
## This below should be separated when core lives elsewhere
914
# Install core tests reqs
@@ -16,9 +21,10 @@ install:
1621
- pip install -rrequirements/test.txt
1722
- pip install .
1823

19-
# XXX should run the core tests as well
20-
script: SETTINGS_FLAVOR=test DOCKER_REGISTRY_CONFIG=config_sample.yml flake8 . && SETTINGS_FLAVOR=test DOCKER_REGISTRY_CONFIG=config_sample.yml python setup.py nosetests
24+
before_script:
25+
- redis-server &
2126

22-
before_install:
23-
- sudo apt-get update
24-
- sudo apt-get install libevent-dev liblzma-dev
27+
script:
28+
- SETTINGS_FLAVOR=test DOCKER_REGISTRY_CONFIG=config_sample.yml flake8
29+
- SETTINGS_FLAVOR=test DOCKER_REGISTRY_CONFIG=config_sample.yml python setup.py nosetests
30+
- cd depends/docker-registry-core && python setup.py nosetests

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Docker-registry
22

3+
## 0.9.0-dev
4+
5+
* "loose" dependencies mechanism (DEPS=loose environment var will let you install without strictly versioned dependencies)
6+
* enhanced python version compatibility
7+
* enhanced style checking
8+
* enhanced testing
9+
* uniformized various gunicorn start stances
10+
11+
312
## 0.8.0
413

514
* configuration rehaul: https://github.com/docker/docker-registry/pull/444 - beware this breaks API for the drivers, and the core package has been updated accordingly to denote that

CONTRIBUTE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,10 @@ Pretty much:
103103

104104
Drivers are expected to receive bytes and to return bytes.
105105
Don't try to decode or encode content.
106+
107+
## Development environement notes
108+
109+
We don't currently run any tests for python3, as we are stuck on gevent not being py3 ready.
110+
111+
On OSX, in order for the dependencies to compile properly (inside tox venv) you might need to have extra include and lib specified. Environment variables are provided for that, namely $TOX_INCLUDE and $TOX_LIB.
112+

README.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ Quick start
1919

2020
The fastest way to get running:
2121

22-
* install docker according to the [following instructions](http://docs.docker.io/installation/#installation)
22+
* install docker according to the [following instructions](https://docs.docker.com/installation/#installation)
2323
* run the registry: `docker run -p 5000:5000 registry`
2424

2525
That will use the
26-
[official image from the Docker index](https://index.docker.io/_/registry/).
26+
[official image from the Docker index](https://registry.hub.docker.com/_/registry/).
2727

2828
Here is another example that will launch a container on port 5000, and store images in an Amazon S3 bucket:
2929
```
@@ -407,10 +407,10 @@ Then install the Registry app:
407407
sudo pip install docker-registry
408408
```
409409
410-
If you need extra requirements, like bugsnag, specify them:
410+
If you need extra requirements, like bugsnag, or new-relic specify them:
411411
412412
```
413-
sudo pip install docker-registry[bugsnag]
413+
sudo pip install docker-registry[bugsnag,newrelic]
414414
```
415415
416416
@@ -430,15 +430,15 @@ should not require the additional repositories.
430430
Then install the Registry app:
431431
432432
```
433-
sudo python-pip install docker-registry[bugsnag]
433+
sudo python-pip install docker-registry[bugsnag,newrelic]
434434
```
435435
436436
(or clone the repository and `pip install .`)
437437
438438
#### Run it
439439
440440
```
441-
gunicorn --access-logfile - -k gevent -b 0.0.0.0:5000 -w 4 --max-requests 100 docker_registry.wsgi:application
441+
docker-registry
442442
```
443443
444444
### How do I setup user accounts?
@@ -452,13 +452,6 @@ auth enabled (see `contrib/` for examples).
452452
The recommended setting to run the Registry in a prod environment is gunicorn
453453
behind a nginx server which supports chunked transfer-encoding (nginx >= 1.3.9).
454454
455-
You could use for instance supervisord to spawn the registry with 8 workers
456-
using this command:
457-
458-
```
459-
gunicorn -k gevent --max-requests 100 --graceful-timeout 3600 -t 3600 -b localhost:5000 -w 8 docker_registry.wsgi:application
460-
```
461-
462455
#### nginx
463456
464457
[Here is an nginx configuration file example.](https://github.com/docker/docker-registry/blob/master/contrib/nginx.conf), which applies to versions < 1.3.9 which are compiled with the [HttpChunkinModule](http://wiki.nginx.org/HttpChunkinModule).
@@ -482,6 +475,20 @@ requests to the Docker Registry:
482475
ProxyPassReverse / http://localhost:5000/
483476
```
484477
478+
#### Advanced start options (NOT recommended)
479+
480+
If you want greater control over gunicorn:
481+
482+
```
483+
gunicorn -c contrib/gunicorn.py docker_registry.wsgi:application
484+
```
485+
486+
or even bare
487+
488+
```
489+
gunicorn --access-logfile - --error-logfile - -k gevent -b 0.0.0.0:5000 -w 4 --max-requests 100 docker_registry.wsgi:application
490+
```
491+
485492
For developers
486493
--------------
487494

config/gunicorn_config.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

contrib/gunicorn_config.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Gunicorn config file
2+
3+
import os
4+
5+
flavor = os.environ.get('SETTINGS_FLAVOR', 'dev')
6+
7+
reload = True
8+
bind = '%s:%s' % (
9+
os.environ.get('REGISTRY_HOST', '0.0.0.0'),
10+
os.environ.get('REGISTRY_PORT', '5000')
11+
)
12+
graceful_timeout = int(os.environ.get('GUNICORN_GRACEFUL_TIMEOUT'), 3600)
13+
timeout = int(os.environ.get('GUNICORN_SILENT_TIMEOUT'), 3600)
14+
worker_class = 'gevent'
15+
max_requests = 100
16+
workers = int(os.environ.get('GUNICORN_WORKERS', 4))
17+
log_level = 'debug'
18+
debug = True
19+
accesslog = os.environ.get('GUNICORN_ACCESS_LOG_FILE', '-')
20+
errorlog = os.environ.get('GUNICORN_ERROR_LOG_FILE', '-')
21+
access_log_format = ('%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" '
22+
'"%(a)s" %(D)s %({X-Docker-Size}o)s')
23+
24+
if flavor == 'prod' or flavor == 'staging':
25+
reload = False
26+
workers = 8
27+
debug = False
28+
log_level = 'info'

depends/docker-registry-core/docker_registry/core/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
__title__ = 'docker-registry-core'
4848
__build__ = 0x000000
4949

50+
__url__ = 'https://github.com/docker/docker-registry'
51+
__description__ = 'Docker registry core package'
52+
__download__ = 'https://github.com/docker/docker-registry/archive/master.zip'
53+
5054
try:
5155
NullHandler = logging.NullHandler
5256
except AttributeError:

depends/docker-registry-core/docker_registry/core/boto.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
from . import driver
3939
from . import lru
40-
4140
from .exceptions import FileNotFoundError
4241

4342
logger = logging.getLogger(__name__)

depends/docker-registry-core/docker_registry/core/driver.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@
4141

4242
class Base(object):
4343

44-
"""Storage is a convenience class that describes methods that must be
45-
implemented by any backend.
44+
"""Storage is a convenience class...
45+
46+
... that describes methods that must be implemented by any backend.
4647
You should inherit (or duck type) this if you are implementing your own.
4748
4849
:param host: host name
@@ -157,60 +158,52 @@ def put_bytes(self, path, content):
157158
return self.put_content(path, content)
158159

159160
def get_content(self, path):
160-
"""Method to get content
161-
"""
161+
"""Method to get content."""
162162
raise NotImplementedError(
163163
"You must implement get_content(self, path) on your storage %s" %
164164
self.__class__.__name__)
165165

166166
def put_content(self, path, content):
167-
"""Method to put content
168-
"""
167+
"""Method to put content."""
169168
raise NotImplementedError(
170169
"You must implement put_content(self, path, content) on %s" %
171170
self.__class__.__name__)
172171

173172
def stream_read(self, path, bytes_range=None):
174-
"""Method to stream read
175-
"""
173+
"""Method to stream read."""
176174
raise NotImplementedError(
177175
"You must implement stream_read(self, path, , bytes_range=None) " +
178176
"on your storage %s" %
179177
self.__class__.__name__)
180178

181179
def stream_write(self, path, fp):
182-
"""Method to stream write
183-
"""
180+
"""Method to stream write."""
184181
raise NotImplementedError(
185182
"You must implement stream_write(self, path, fp) " +
186183
"on your storage %s" %
187184
self.__class__.__name__)
188185

189186
def list_directory(self, path=None):
190-
"""Method to list directory
191-
"""
187+
"""Method to list directory."""
192188
raise NotImplementedError(
193189
"You must implement list_directory(self, path=None) " +
194190
"on your storage %s" %
195191
self.__class__.__name__)
196192

197193
def exists(self, path):
198-
"""Method to test exists
199-
"""
194+
"""Method to test exists."""
200195
raise NotImplementedError(
201196
"You must implement exists(self, path) on your storage %s" %
202197
self.__class__.__name__)
203198

204199
def remove(self, path):
205-
"""Method to remove
206-
"""
200+
"""Method to remove."""
207201
raise NotImplementedError(
208202
"You must implement remove(self, path) on your storage %s" %
209203
self.__class__.__name__)
210204

211205
def get_size(self, path):
212-
"""Method to get the size
213-
"""
206+
"""Method to get the size."""
214207
raise NotImplementedError(
215208
"You must implement get_size(self, path) on your storage %s" %
216209
self.__class__.__name__)

depends/docker-registry-core/docker_registry/core/exceptions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434

3535
class UnspecifiedError(Exception):
3636

37-
"""Base class for all exceptions in docker_registry
38-
"""
37+
"""Base class for all exceptions in docker_registry."""
3938

4039
def __init__(self, *args, **kwargs):
4140
self.message = kwargs.pop('message', 'No details')
@@ -44,8 +43,9 @@ def __init__(self, *args, **kwargs):
4443

4544
class UsageError(UnspecifiedError):
4645

47-
"""Exceptions related to use of the library, like missing files,
48-
wrong argument type, etc.
46+
"""Exceptions related to use of the library.
47+
48+
Missing files, wrong argument type, etc.
4949
"""
5050

5151

0 commit comments

Comments
 (0)