OSDN Git Service

adds a reverse proxy (nginx) service with SSL setup feature to the `apt_utils::aptly...
[metasearch/grid-chef-repo.git] / roles / docker-registry.rb
1 name 'docker-registry'
2 description 'Docker Registry'
3
4 run_list(
5   'recipe[ssl_cert::ca_certs]',
6   'recipe[ssl_cert::server_key_pairs]',
7   'role[docker]',
8   'recipe[docker-grid::registry]',
9 )
10
11 #env_run_lists()
12
13 #default_attributes()
14
15 registry_cn = 'registry.docker.example.com'
16
17 override_attributes(
18   'ssl_cert' => {
19     'ca_names' => [
20       'grid_ca',
21     ],
22     'common_names' => [
23       registry_cn,
24     ],
25   },
26   'docker-grid' => {
27     'engine' => {
28       'skip_setup' => false,
29     },
30     'compose' => {
31       'skip_setup' => false,
32     },
33     'registry' => {
34       'with_ssl_cert_cookbook' => true,
35       'ssl_cert' => {
36         'common_name' => registry_cn,
37       },
38       'docker-compose' => {
39         'config' => {
40           'registry' => {
41             'restart' => 'always',
42             'image' => 'registry:2',
43             'ports' => [
44               '5000:5000',
45             ],
46             'environment' => {
47               # These environment variables will be set by the docker-grid::registry recipe automatically.
48               #'REGISTRY_HTTP_TLS_CERTIFICATE' => '/certs/domain.crt',
49               #'REGISTRY_HTTP_TLS_KEY' =>         '/certs/domain.key',
50               'REGISTRY_AUTH' =>                'htpasswd',
51               'REGISTRY_AUTH_HTPASSWD_PATH' =>  '/auth/.htpasswd',
52               'REGISTRY_AUTH_HTPASSWD_REALM' => 'Registry Realm',
53             },
54             'volumes' => [
55               '/var/lib/docker-registry:/var/lib/registry',
56               # These volumes will be set by the docker-grid::registry recipe automatically.
57               #"#{server_cert_path(node['docker-grid']['registry']['ssl_cert']['common_name'])}:/certs/domain.crt:ro",
58               #"#{server_key_path(node['docker-grid']['registry']['ssl_cert']['common_name'])}:/certs/domain.key:ro",
59               './auth:/auth',
60             ],
61           },
62         },
63       },
64     },
65   },
66 )
67