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

Commit 4ba12e5

Browse files
author
Mangled Deutz
committed
Updated documentation for 0.7, new developer (contribute) doc, new changelog file
Docker-DCO-1.1-Signed-off-by: Mangled Deutz <[email protected]> (github: dmp42)
1 parent 0c03458 commit 4ba12e5

File tree

3 files changed

+169
-138
lines changed

3 files changed

+169
-138
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Docker-registry
2+
3+
## 0.7
4+
5+
Major architecture rehaul, with potentially breaking changes:
6+
7+
* alternate storage drivers are now implemented as independent pip packages in their own github repositories
8+
* mainline docker-registry now only provide file and s3 storage
9+
* all dependencies have been upgraded to the latest available version (specifically flask, gevent, bugsnag)
10+
* updated and cleaned-up Dockerfile now uses latest Ubuntu LTS
11+
* largely enhanced configuration mechanism (setup-configs.sh is no more)
12+
* cookies are no longer used
13+
14+
* [BUGFIX] unicode issues. Depending on the storage driver you are using, you may encounter unicode issues on already published content (likely garbled content).
15+
* [BUGFIX] content-length fix for bytes ranges
16+

CONTRIBUTE.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Docker-Registry for developers
2+
3+
## Bare minimum
4+
5+
You need `git`, `pip` and `tox`.
6+
7+
You might need `nose`, `coverage` and `flake`.
8+
9+
10+
## Architecture
11+
12+
### docker-registry-core
13+
14+
The code for this lives in the main repository, under the folder depends/docker-registry-core.
15+
16+
It provides:
17+
18+
* exceptions
19+
* a driver interface describing how the registry interacts with the data storage
20+
* a compatibility layer (eg: python version)
21+
* common useful utility code
22+
* filesystem storage driver
23+
24+
It doesn't depend on anything, and is published as a standalone pip package. Its version closely reflects the driver interface versioning.
25+
26+
If you are going to change the way data is stored, this is where you should look.
27+
28+
If you are going to hack on the registry itself, this is probably not interesting for you.
29+
30+
If you are going to create a new storage driver, see below.
31+
32+
### docker-registry
33+
34+
This is what lives in the main repository, and contains the bulk of the server code (including the s3 storage driver).
35+
36+
It depends on `docker-registry-core`.
37+
38+
This is likely where you are going to hack if you want to modify the registry behavior.
39+
40+
It is published as a pip package, although the recommended way to use is to use the official docker image.
41+
42+
43+
### docker-registry-driver-X
44+
45+
Storage drivers (like elliptics) are implemented as independent pip packages.
46+
47+
Said packages depend on `docker-registry-core` only (save their own dependencies).
48+
49+
50+
## Namespaces
51+
52+
We use python namespaces.
53+
54+
`docker-registry-core` uses:
55+
* `docker_registry`
56+
* `docker_registry.core`
57+
* `docker_registry.testing`
58+
* `docker_registry.drivers`
59+
60+
`docker-registry` uses:
61+
* `docker-registry`
62+
* others
63+
64+
Drivers must stay inside `docker_registry.drivers`.
65+
66+
## Tooling
67+
68+
We use `nose`, `coverage`, `hacking` (for `flake`), `tox` and `travis`.
69+
70+
Wherever you are coding (registy, core, or driver), your friends are thus:
71+
72+
* run the tests: `python setup.py nosetests`
73+
* check your style: `flake8`
74+
* run the tests on all platform: `tox`
75+
76+
If any of these three fail, then your PR will get rejected :-)
77+
78+
If the travis build fails, your PR will need to be updated.
79+
80+
## Acceptance platforms
81+
82+
Any new code must run with python2.7.
83+
84+
Any new code should better run with python2.6 and python3.4.
85+
86+
Existing code shouldn't regress.
87+
88+
89+
## Storage driver developer howto
90+
91+
Have a look at the [elliptics driver](https://github.com/noxiouz/docker-registry-driver-elliptics) and copy its stucture.
92+
93+
Explore the files.
94+
95+
Pretty much:
96+
97+
* you have to use namespaces
98+
* you have to implement methods from the base.Driver interface
99+
* you have to use the provided test suite
100+
* all the tests must pass
101+
102+
103+
104+
## API documentation
105+
106+
[search-endpoint]:
107+
http://docs.docker.io/en/latest/reference/api/index_api/#get--v1-search
108+
[SQLAlchemy]: http://docs.sqlalchemy.org/
109+
[create_engine]:
110+
http://docs.sqlalchemy.org/en/latest/core/engines.html#sqlalchemy.create_engine

README.md

Lines changed: 43 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@ The stable, released version is currently the [0.6.9 tag](https://github.com/dot
1717
Quick start
1818
===========
1919

20-
The fastest way to get running is using the
21-
[official image from the Docker index](https://index.docker.io/_/registry/):
20+
The fastest way to get running:
2221

23-
This example will launch a container on port 5000, and storing images within
24-
the container itself:
25-
```
26-
docker run -p 5000:5000 registry
27-
```
22+
* install docker according to the [following instructions](http://docs.docker.io/installation/#installation)
23+
* run the registry: `docker run -p 5000:5000 registry`
2824

25+
That will use the
26+
[official image from the Docker index](https://index.docker.io/_/registry/).
2927

30-
This example will launch a container on port 5000, and storing images in an
31-
Amazon S3 bucket:
28+
Here is another example that will launch a container on port 5000, and store images in an Amazon S3 bucket:
3229
```
3330
docker run \
3431
-e SETTINGS_FLAVOR=s3 \
@@ -65,14 +62,14 @@ In the `config_sample.yml` file, you'll see several sample flavors:
6562
1. `common`: used by all other flavors as base settings
6663
1. `local`: stores data on the local filesystem
6764
1. `s3`: stores data in an AWS S3 bucket
65+
1. `dev`: basic configuration using the `local` flavor
66+
1. `test`: used by unit tests
67+
1. `prod`: production configuration (basically a synonym for the `s3` flavor)
6868
1. `gcs`: stores data in Google cloud storage
6969
1. `swift`: stores data in OpenStack Swift
7070
1. `glance`: stores data in OpenStack Glance, with a fallback to local storage
7171
1. `glance-swift`: stores data in OpenStack Glance, with a fallback to Swift
7272
1. `elliptics`: stores data in Elliptics key/value storage
73-
1. `dev`: basic configuration using the `local` flavor
74-
1. `test`: used by unit tests
75-
1. `prod`: production configuration (basically a synonym for the `s3` flavor)
7673

7774
You can define your own flavors by adding a new top-level yaml key.
7875

@@ -300,18 +297,33 @@ test:
300297

301298
## Storage options
302299

303-
1. `storage`: Selects the storage engine to use. The options for which are
304-
defined below
300+
`storage` selects the storage engine to use. The registry ships with two storage engine by default (`file` and `s3`).
301+
302+
If you want to find other (community provided) storages: `pip search docker-registry-driver`
303+
304+
To use and install one of these alternate storages:
305+
306+
* `pip install docker-registry-driver-NAME`
307+
* in the configuration set `storage` to `NAME`
308+
* add any other storage dependent configuraiton option to the conf file
309+
* review the storage specific documentation for additional dependency or configuration instructions.
305310

306-
### storage: local
311+
Currently, we are aware of the following storage driver:
312+
313+
* [elliptics](https://github.com/noxiouz/docker-registry-driver-elliptics)
314+
* [swift](https://github.com/bacongobbler/docker-registry-driver-swift)
315+
* [gcs](https://github.com/dmp42/docker-registry-driver-gcs)
316+
* [glance](https://github.com/dmp42/docker-registry-driver-glance)
317+
318+
### storage: file
307319

308320
1. `storage_path`: Path on the filesystem where to store data
309321

310322
Example:
311323

312324
```yaml
313325
local:
314-
storage: local
326+
storage: file
315327
storage_path: /mnt/registry
316328
```
317329

@@ -351,104 +363,13 @@ prod:
351363
s3_secret_key: xdDowwlK7TJajV1Y7EoOZrmuPEJlHYcNP2k4j49T
352364
```
353365

354-
### storage: elliptics
355-
[Elliptics](http://reverbrain.com/elliptics/) key/value storage options
356-
357-
1. `elliptics_nodes`: Elliptics remotes
358-
Can be a hash of `address: port`, or a list of `address:port` strings, or a single space delimited string.
359-
1. `elliptics_wait_timeout`: time to wait for the operation complete
360-
1. `elliptics_check_timeout`: timeout for pinging node
361-
1. `elliptics_io_thread_num`: number of IO threads in processing pool
362-
1. `elliptics_net_thread_num`: number of threads in network processing pool
363-
1. `elliptics_nonblocking_io_thread_num`: number of IO threads in processing pool dedicated to nonblocking ops
364-
1. `elliptics_groups`: Elliptics groups registry should use
365-
1. `elliptics_verbosity`: Elliptics logger verbosity (0...4)
366-
1. `elliptics_logfile`: path to Elliptics logfile (default: `dev/stderr`)
367-
1. `elliptics_addr_family`: address family to use when adding Elliptics remotes (default: `2` (for ipv4)). Use 10 for ipv6 remotes on Linux.
368-
369-
Example:
370-
```yaml
371-
dev:
372-
storage: elliptics
373-
elliptics_nodes:
374-
elliptics-host1: 1025
375-
elliptics-host2: 1025
376-
elliptics_wait_timeout: 60
377-
elliptics_check_timeout: 60
378-
elliptics_io_thread_num: 2
379-
elliptics_net_thread_num: 2
380-
elliptics_nonblocking_io_thread_num: 2
381-
elliptics_groups: [1, 2, 3]
382-
elliptics_verbosity: 4
383-
elliptics_logfile: "/tmp/logfile.log"
384-
elliptics_loglevel: debug
385-
```
386-
387-
### storage: gcs
388-
[Google Cloud Storage](https://cloud.google.com/products/cloud-storage/) options
389-
390-
1. `boto_bucket`: string, the bucket name
391-
1. `storage_path`: string, the sub "folder" where image data will be stored.
392-
1. `oauth2`: boolean, true to enable [OAuth2.0](https://developers.google.com/accounts/docs/OAuth2)
393-
394-
Example:
395-
```yaml
396-
dev:
397-
boto_bucket: "_env:GCS_BUCKET"
398-
storage: gcs
399-
storage_path: "_env:STORAGE_PATH:/"
400-
oauth2: true
401-
```
402-
403-
You can also use [developer keys](https://developers.google.com/storage/docs/reference/v1/getting-startedv1#keys) for (if `oauth2` is unset or set to false) instead
404-
of using [OAuth2.0](https://developers.google.com/accounts/docs/OAuth2). Options to configure then:
405-
406-
1. `gs_access_key`: string, GCS access key
407-
1. `gs_secret_key`: string, GCS secret key
408-
1. `gs_secure`: boolean, true for HTTPS to GCS
409-
410-
Example:
411-
```yaml
412-
dev:
413-
boto_bucket: "_env:GCS_BUCKET"
414-
storage: gcs
415-
storage_path: "_env:STORAGE_PATH:/"
416-
gs_access_key: GOOGTS7C7FUP3AIRVJTE
417-
gs_secret_key: bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ
418-
gs_secure: false
419-
```
420-
421-
### storage: swift
422-
OpenStack Swift options
423-
424-
1. `storage_path`: The prefix of where data will be stored
425-
1. `swift_authurl`: Authentication url
426-
1. `swift_container`:
427-
1. `swift_user`:
428-
1. `swift_password`:
429-
1. `swift_tenant_name`:
430-
1. `swift_region_name`:
431-
432-
### storage: glance
433-
OpenStack Glance options
434-
435-
1. `storage_alternate`:
436-
1. `storage_path`:
437-
438-
439366
Run the Registry
440367
----------------
441368

442-
### Option 1 (Recommended) - Run the registry docker container
443-
444-
Install docker according to the following instructions:
445-
http://docs.docker.io/installation/#installation
369+
### Recommended: run the registry docker container
446370

447-
Run registry:
448-
449-
```
450-
docker run -p 5000:5000 registry
451-
```
371+
* install docker according to the [following instructions](http://docs.docker.io/installation/#installation)
372+
* run the registry: `docker run -p 5000:5000 registry`
452373

453374
or
454375

@@ -467,27 +388,29 @@ docker run \
467388
NOTE: The container will try to allocate the port 5000. If the port
468389
is already taken, find out which container is already using it by running `docker ps`
469390
470-
### Option 2 (Advanced) - Install the registry on an existing server
391+
### Advanced: install the registry on an existing server
471392
472393
#### On Ubuntu
473394
474395
Install the system requirements for building a Python library:
475396
476397
```
477-
sudo apt-get install build-essential python-dev libevent-dev python-pip libssl-dev liblzma-dev libffi-dev
398+
sudo apt-get install build-essential python-dev libevent-dev python-pip liblzma-dev
478399
```
479400
480401
Then install the Registry app:
481402
482403
```
483-
sudo pip install .
404+
sudo pip install docker-registry
484405
```
485406
407+
(or clone the repository and `pip install .`)
408+
486409
#### On Red Hat-based systems:
487410
488411
Install the required dependencies:
489412
```
490-
sudo yum install python-devel libevent-devel python-pip openssl-devel libffi-devel gcc xz-devel
413+
sudo yum install python-devel libevent-devel python-pip gcc xz-devel
491414
```
492415
493416
NOTE: On RHEL and CentOS you will need the
@@ -497,9 +420,11 @@ should not require the additional repositories.
497420
Then install the Registry app:
498421
499422
```
500-
sudo python-pip install .
423+
sudo python-pip install docker-registry
501424
```
502425
426+
(or clone the repository and `pip install .`)
427+
503428
#### Run it
504429
505430
```
@@ -557,27 +482,7 @@ dotcloud create myregistry
557482
dotcloud push
558483
```
559484
560-
Run tests
561-
---------
562-
Make sure you have git installed. If not:
563-
564-
Fedora/RHEL/CentOS :
565-
566-
```
567-
sudo yum install git
568-
```
569-
570-
If you want to submit a pull request, please run the unit tests using tox
571-
before submitting anything to the repos:
572-
573-
```
574-
pip install tox
575-
cd docker-registry/
576-
tox
577-
```
485+
For developers
486+
--------------
578487
579-
[search-endpoint]:
580-
http://docs.docker.io/en/latest/reference/api/index_api/#get--v1-search
581-
[SQLAlchemy]: http://docs.sqlalchemy.org/
582-
[create_engine]:
583-
http://docs.sqlalchemy.org/en/latest/core/engines.html#sqlalchemy.create_engine
488+
Read CONTRIBUTE.md

0 commit comments

Comments
 (0)