From 3b596c57014a3d6e5c13c1b2b82ee6da5144ccbc Mon Sep 17 00:00:00 2001 From: Jesper Hess Nielsen Date: Sat, 2 Mar 2019 18:29:15 +0100 Subject: [PATCH] Add docker registry container --- playbook.yml | 1 + roles/docker/defaults/main.yml | 4 ++++ .../files/configs/docker_registry/nginx.conf | 1 + .../docker/tasks/services/docker_registry.yml | 24 +++++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 roles/docker/files/configs/docker_registry/nginx.conf create mode 100644 roles/docker/tasks/services/docker_registry.yml diff --git a/playbook.yml b/playbook.yml index 5f7e3f2..a24d717 100644 --- a/playbook.yml +++ b/playbook.yml @@ -20,6 +20,7 @@ - privatebin - codimd - netdata + - docker_registry smtp_host: postfix smtp_port: 587 diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 745c652..e3b245c 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -35,4 +35,8 @@ codimd: netdata: domain: "netdata.{{ base_domain }}" + +docker_registry: + domain: "docker.{{ base_domain }}" + volume_folder: "{{ volume_root_folder }}/docker-registry" \ No newline at end of file diff --git a/roles/docker/files/configs/docker_registry/nginx.conf b/roles/docker/files/configs/docker_registry/nginx.conf new file mode 100644 index 0000000..c636de7 --- /dev/null +++ b/roles/docker/files/configs/docker_registry/nginx.conf @@ -0,0 +1 @@ +client_max_body_size 10G; diff --git a/roles/docker/tasks/services/docker_registry.yml b/roles/docker/tasks/services/docker_registry.yml new file mode 100644 index 0000000..cd4d559 --- /dev/null +++ b/roles/docker/tasks/services/docker_registry.yml @@ -0,0 +1,24 @@ +--- +- name: copy docker registry nginx configuration + copy: + src: "files/configs/docker_registry/nginx.conf" + dest: "/docker-volumes/nginx/vhost/{{ docker_registry.domain }}" + mode: "0644" + +- name: docker registry container + docker_container: + name: registry + image: registry:2 + restart_policy: always + volumes: + - "{{ docker_registry.volume_folder }}/registry:/var/lib/registry" + - "{{ docker_registry.volume_folder }}/auth:/auth" + networks: + - name: external_services + env: + VIRTUAL_HOST: "{{ docker_registry.domain }}" + LETSENCRYPT_HOST: "{{ docker_registry.domain }}" + LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}" + REGISTRY_AUTH: "htpasswd" + REGISTRY_AUTH_HTPASSWD_PATH: "/auth/htpasswd" + REGISTRY_AUTH_HTPASSWD_REALM: "data.coop docker registry"