This repository was archived by the owner on Sep 12, 2018. It is now read-only.
File tree 8 files changed +50
-28
lines changed
8 files changed +50
-28
lines changed Original file line number Diff line number Diff line change 13
13
import flask
14
14
15
15
from . import toolkit
16
- from .lib import __version__
17
16
from .lib import config
17
+ from .server import __version__
18
18
19
19
app = flask .Flask ('docker-registry' )
20
20
cfg = config .load ()
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
-
3
- __author__ = 'Docker Registry Contributors'
4
- __copyright__ = '{{driver.copyright}}'
5
- __credits__ = []
6
-
7
- __license__ = 'Apache 2.0'
8
- __version__ = '0.7.0'
9
- __maintainer__ = __author__
10
-
11
- __status__ = 'Production'
12
-
13
- __title__ = 'docker-registry'
14
- __build__ = 0x000000
15
-
16
- __url__ = 'https://github.com/dotcloud/docker-registry'
17
- __description__ = 'Registry server for Docker'
18
- __download__ = 'https://github.com/dotcloud/docker-registry/archive/master.zip'
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
3
3
import logging
4
-
5
4
import redis
6
5
7
6
from docker_registry .core import lru
Original file line number Diff line number Diff line change 16
16
from .tags import * # noqa
17
17
from .images import * # noqa
18
18
from .lib import config
19
+ from .server import env
19
20
from .status import * # noqa
20
21
from .search import * # noqa
21
22
@@ -47,12 +48,13 @@ def run_gunicorn():
47
48
formatter_class = RawTextHelpFormatter )
48
49
parser .parse_args ()
49
50
50
- workers = os .environ .get ('GUNICORN_WORKERS' , '4' )
51
- port = os .environ .get ('REGISTRY_PORT' , '5000' )
52
- graceful_timeout = os .environ .get ('GUNICORN_GRACEFUL_TIMEOUT' , '3600' )
53
- silent_timeout = os .environ .get ('GUNICORN_SILENT_TIMEOUT' , '3600' )
51
+ workers = env .source ('GUNICORN_WORKERS' )
52
+ host = env .source ('REGISTRY_HOST' )
53
+ port = env .source ('REGISTRY_PORT' )
54
+ graceful_timeout = env .source ('GUNICORN_GRACEFUL_TIMEOUT' )
55
+ silent_timeout = env .source ('GUNICORN_SILENT_TIMEOUT' )
54
56
55
- address = '0.0.0.0:{0}' . format ( port )
57
+ address = '%s:%s' % ( host , port )
56
58
57
59
gunicorn_path = distutils .spawn .find_executable ('gunicorn' )
58
60
if gunicorn_path is None :
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+
3
+ __author__ = 'Docker Registry Contributors'
4
+ __copyright__ = 'Copyright 2014 Docker'
5
+ __credits__ = []
6
+
7
+ __license__ = 'Apache 2.0'
8
+ __version__ = '0.7.0'
9
+ __maintainer__ = __author__
10
+
11
+ __status__ = 'Production'
12
+
13
+ __title__ = 'docker-registry'
14
+ __build__ = 0x000000
15
+
16
+ __url__ = 'https://github.com/dotcloud/docker-registry'
17
+ __description__ = 'Registry server for Docker'
18
+ __download__ = 'https://github.com/dotcloud/docker-registry/archive/master.zip'
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+
3
+ import os
4
+
5
+ __all__ = ['source' ]
6
+
7
+ defined = {
8
+ 'REGISTRY_PORT' : 5000 ,
9
+ 'REGISTRY_HOST' : '0.0.0.0' ,
10
+ 'SETTINGS_FLAVOR' : 'dev' ,
11
+ 'GUNICORN_WORKERS' : 4 ,
12
+ 'GUNICORN_GRACEFUL_TIMEOUT' : 3600 ,
13
+ 'GUNICORN_SILENT_TIMEOUT' : 3600
14
+ }
15
+
16
+
17
+ def source (key , override = None ):
18
+ return os .environ .get (key , defined [key ] if key in defined else override )
Original file line number Diff line number Diff line change 2
2
# -*- coding: utf-8 -*-
3
3
4
4
import logging
5
- import os
6
5
7
6
from .run import app
7
+ from .server import env
8
8
9
9
10
10
if __name__ == '__main__' :
11
11
# Bind to PORT if defined, otherwise default to 5000.
12
- port = int (os .environ .get ('PORT_WWW' , 5000 ))
12
+ host = env .source ('REGISTRY_HOST' )
13
+ port = int (env .source ('REGISTRY_PORT' ))
13
14
app .debug = True
14
- app .run (host = '0.0.0.0' , port = port )
15
+ app .run (host = host , port = port )
15
16
# Or you can run:
16
17
# gunicorn --access-logfile - --log-level debug --debug -b 0.0.0.0:5000 \
17
18
# -w 1 wsgi:application
Original file line number Diff line number Diff line change 10
10
11
11
# XXX as ugly as this looks, namespaces break terribly otherwise
12
12
# import docker_registry.lib as lib
13
- execfile ('./docker_registry/lib /__init__.py' )
13
+ execfile ('./docker_registry/server /__init__.py' )
14
14
15
15
requirements_txt = open ('./requirements.txt' )
16
16
requirements = [line for line in requirements_txt ]
31
31
# Explicit packages list to avoid setup_tools funkyness
32
32
packages = ['docker_registry' ,
33
33
'docker_registry.drivers' ,
34
+ 'docker_registry.server' ,
34
35
'docker_registry.lib' ,
35
36
'docker_registry.storage' ,
36
37
'docker_registry.lib.index' ]
You can’t perform that action at this time.
0 commit comments