-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/registry drone roles #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 15 commits
2847a29
a57645a
dde0ff6
1d4c868
3f0a2de
beca854
5a0cb4b
16bcf7a
dba782f
b24fa8b
b6fe69c
bc0aebd
11db4ff
1a0ace9
f3926a4
1d040fa
1d8d349
7d3551d
7df4d75
8a3b7fa
861f50d
7593456
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| - hosts: registry | ||
| roles: | ||
| - common-no-vlan | ||
| - nginx | ||
| - docker | ||
| - registry | ||
| - drone | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5+2ViaP1ktWlzMCY4IOJOV1K0TH1GstHzoMdeIf9ihiSz7nR7wKcYJMC6KlmOYVQzftENXHQZAtbL4tVPLpLWXN+4fCn+pbQVu47P3QCH9Ez0d23p4byZl5h+qyx0dJv/ltc71X6NIvHH2WXmvvy+Bda4b1NVpJN/voiMoihipsjPPeL+s6B+3dw6PD3h5vvzvJCrfkKGijoT74+BbjYimwmNsaDRQH9tIMaTVeV7ZIe9qfxg5fkg4WsFl9mzikbqYzdBgiC2XeK/L4w3FJONALAEy7FTsUdNaenKxTn4zw/9qdV20TqYEyCbYlANS+2NMLYxeSqdpYB3yvePoucOw== mric@gandi.net | ||
| ssh-dss AAAAB3NzaC1kc3MAAACBAM686CNkUeMiHvr/1tj4zRaJMqAgZAFCuX6WmocNHleTLG2yWcQPAIXKONp++AJ78woEERCTB2otJSsP4Ur8q/K95UiPYmtRJ/wwTI4ojrCk4BmK9KK2hb0OONO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4tgICqDHAkSGrDJkeF8dgNAtO2+m44oty6U/ztnuSKQGBXACxbpS+M8YfPFTyBkjrOtfqk0R/MgdG2gxvPyYPG3ody20QcYzTbG9LrtOReN58kPt4D/3Mp2w== dev@lanza.fr |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| - name: install ssh authorized keys | ||
| copy: src=ssh_authorized_keys dest=/root/.ssh/authorized_keys mode=0600 | ||
| tags: | ||
| - ssh | ||
|
|
||
| - name: upgrade packages | ||
| shell: apt-get upgrade -y |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| - name: install dependencies | ||
| apt: package={{ item }} state=installed update_cache=yes | ||
| with_items: | ||
| - apt-transport-https | ||
| - curl | ||
| - ca-certificates | ||
| - gnupg2 | ||
| - software-properties-common | ||
|
|
||
| - name: add apt key | ||
| apt_key: | ||
| url: https://download.docker.com/linux/debian/gpg | ||
| state: present | ||
|
|
||
| - name: Add docker apt repo | ||
| apt_repository: | ||
| repo: "deb [arch=amd64] https://download.docker.com/linux/debian stretch stable" | ||
| filename: docker | ||
| state: present | ||
|
|
||
| - name: install docker ce | ||
| apt: package={{ item }} update_cache=yes | ||
| with_items: | ||
| - docker-ce | ||
|
|
||
| - name: start docker | ||
| service: | ||
| name: docker | ||
| state: restarted | ||
|
|
||
| - name: install docker compose | ||
| get_url: | ||
| url: https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Linux-x86_64 | ||
| dest: /usr/local/bin/docker-compose | ||
| mode: 0550 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| - name: create drone directory | ||
| file: | ||
| path: "{{ drone_path }}" | ||
| state: directory | ||
|
|
||
| - name: copy compose file for registry server | ||
| template: src=docker-compose.yml.j2 dest={{ drone_path }}/docker-compose.yml | ||
|
|
||
| - name: start drone | ||
| shell: docker-compose -f {{ drone_path }}/docker-compose.yml up -d | ||
|
|
||
| - name: configure nginx vhost | ||
| template: | ||
| src: drone.nginx.j2 | ||
| dest: /etc/nginx/sites-enabled/drone | ||
|
|
||
| - name: restart service nginx | ||
| service: | ||
| name: nginx | ||
| state: restarted |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| version: '2' | ||
|
|
||
| services: | ||
|
|
||
| drone-server: | ||
| image: drone/drone | ||
| ports: | ||
| - 80:8000 | ||
| - 9000 | ||
| volumes: | ||
| - ./drone/:/var/lib/drone/ | ||
| restart: always | ||
| environment: | ||
| - DRONE_OPEN=true | ||
| - DRONE_HOST={{ DRONE_HOST }} | ||
| - DRONE_GITHUB=true | ||
| - DRONE_ORGS=CaliOpen | ||
| - DRONE_GITHUB_CLIENT={{ DRONE_GITHUB_CLIENT }} | ||
| - DRONE_GITHUB_SECRET={{ DRONE_GITHUB_SECRET }} | ||
| - DRONE_SECRET={{ DRONE_SECRET }} | ||
| - DRONE_ADMIN={{ DRONE_ADMIN }} | ||
|
|
||
| drone-agent: | ||
| image: drone/agent | ||
| command: agent | ||
| restart: always | ||
| depends_on: | ||
| - drone-server | ||
| volumes: | ||
| - /var/run/docker.sock:/var/run/docker.sock | ||
| environment: | ||
| - DRONE_SERVER=drone-server:9000 | ||
| - DRONE_SECRET={{ DRONE_SECRET }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| upstream drone { | ||
| server 127.0.0.1:8000; | ||
| } | ||
|
|
||
| server { | ||
| listen 443 ssl; | ||
| listen [::]:443 ssl; | ||
| server_name drone.{{ caliopen_domain_base }}; | ||
|
|
||
| ssl_certificate /etc/nginx/certs/{{ caliopen_domain_base }}.crt; | ||
| ssl_certificate_key /etc/nginx/certs/{{ caliopen_domain_base }}.key; | ||
| ssl_prefer_server_ciphers On; | ||
| ssl_protocols TLSv1.1 TLSv1.2; | ||
| ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS; | ||
| ssl_session_cache shared:SSL:10m; | ||
|
|
||
| location / { | ||
| proxy_set_header X-Forwarded-For $remote_addr; | ||
| proxy_set_header X-Forwarded-Proto $scheme; | ||
| proxy_set_header Host $http_host; | ||
|
|
||
| proxy_pass http://drone; | ||
| proxy_redirect off; | ||
| proxy_http_version 1.1; | ||
| proxy_buffering off; | ||
|
|
||
| chunked_transfer_encoding off; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,15 +15,19 @@ | |
| with_items: | ||
| - "{{ caliopen_domain_name }}.crt" | ||
| - "{{ caliopen_domain_name }}.key" | ||
| - "{{ caliopen_domain_base }}.crt" | ||
| - "{{ caliopen_domain_base }}.key" | ||
|
|
||
| - name: install prometheus nginx metric exporter | ||
| git: | ||
| repo: "https://github.com/knyar/nginx-lua-prometheus.git" | ||
| dest: /srv/nginx-lua-prometheus | ||
| tags: monitoring | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. registry is deployed with extra parameter --skip-tags monitoring
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not fan of tags for that purpose, as we will forget to give --skip-tags flag. May include the nginx part directly in registry task ?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can just install it even if it isn't monitored atm
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
|
|
||
| - name: configure lua | ||
| template: src=lua.conf.j2 dest=/etc/nginx/conf.d/lua.conf | ||
| notify: restart nginx | ||
| tags: monitoring | ||
|
|
||
| - name: remove default nginx site | ||
| file: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| version: '2' | ||
|
|
||
| services: | ||
|
|
||
| registry: | ||
| image: registry:2 | ||
| ports: | ||
| - 127.0.0.1:5000:5000 | ||
| volumes: | ||
| - ./data:/var/lib/registry |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| $ANSIBLE_VAULT;1.1;AES256 | ||
| 38343563333862323230616439303037656531306339656132306539616132336336306639633435 | ||
| 6135323263643732326538376531323234626235303935660a366437333130323531333765343965 | ||
| 34363962323665386161633939613337663334616266646235663064303965623062333663636162 | ||
| 6162386564383466320a613162383438303131336566336163376637363465653264643038646364 | ||
| 38396436393663343432333830333236383433633361393638393433383563633437666137383132 | ||
| 62623633616639653832653235643665323734393137636331613065616461313131316339396531 | ||
| 31303030656564383632643237363130353664643233313137303632396465323962363638383436 | ||
| 66306230373632383730 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| - name: create docker-registry directory | ||
| file: | ||
| path: "{{ registry_path }}" | ||
| state: directory | ||
|
|
||
| - name: copy compose file for registry server | ||
| copy: src=docker-compose.yml dest={{ registry_path }}/docker-compose.yml | ||
|
|
||
| - name: start docker-registry | ||
| shell: docker-compose -f {{ registry_path }}/docker-compose.yml up -d | ||
|
|
||
| - name: create auth files directory | ||
| file: | ||
| path: /etc/nginx/auth | ||
| state: directory | ||
|
|
||
| - name: copy registry pass file | ||
| copy: | ||
| src: registry.htpasswd | ||
| dest: /etc/nginx/auth/registry.htpasswd | ||
|
|
||
| - name: configure nginx vhost | ||
| template: | ||
| src: docker-registry.nginx.j2 | ||
| dest: /etc/nginx/sites-enabled/docker-registry | ||
|
|
||
| - name: restart service nginx | ||
| service: | ||
| name: nginx | ||
| state: restarted |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| upstream docker-registry { | ||
| server 127.0.0.1:5000; | ||
| } | ||
|
|
||
| map $upstream_http_docker_distribution_api_version $docker_distribution_api_version { | ||
| '' 'registry/2.0'; | ||
| } | ||
|
|
||
| server { | ||
| listen 443 ssl; | ||
| listen [::]:443 ssl; | ||
| server_name registry.{{ caliopen_domain_base }}; | ||
|
|
||
| ssl_certificate /etc/nginx/certs/{{ caliopen_domain_base }}.crt; | ||
| ssl_certificate_key /etc/nginx/certs/{{ caliopen_domain_base }}.key; | ||
| ssl_prefer_server_ciphers On; | ||
| ssl_protocols TLSv1.1 TLSv1.2; | ||
| ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS; | ||
| ssl_session_cache shared:SSL:10m; | ||
|
|
||
| client_max_body_size 0; | ||
| chunked_transfer_encoding on; | ||
|
|
||
| location /v2/ { | ||
|
|
||
| if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) { | ||
| return 404; | ||
| } | ||
|
|
||
| auth_basic "Registry realm"; | ||
| auth_basic_user_file /etc/nginx/auth/registry.htpasswd; | ||
|
|
||
| add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always; | ||
|
|
||
| proxy_pass http://docker-registry; | ||
| proxy_set_header Host $http_host; | ||
| proxy_set_header X-Real-IP $remote_addr; | ||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| proxy_set_header X-Forwarded-Proto $scheme; | ||
| proxy_read_timeout 900; | ||
| } | ||
| } | ||
|
|
||
| server { | ||
| listen 443 ssl; | ||
| listen [::]:443 ssl; | ||
| server_name public-registry.{{ caliopen_domain_base }}; | ||
|
|
||
| ssl_certificate /etc/nginx/certs/{{ caliopen_domain_base }}.crt; | ||
| ssl_certificate_key /etc/nginx/certs/{{ caliopen_domain_base }}.key; | ||
| ssl_prefer_server_ciphers On; | ||
| ssl_protocols TLSv1.1 TLSv1.2; | ||
| ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS; | ||
| ssl_session_cache shared:SSL:10m; | ||
|
|
||
| client_max_body_size 0; | ||
| chunked_transfer_encoding on; | ||
|
|
||
| if ($request_method !~ ^(GET|HEAD)$ ) { | ||
| return 444; | ||
| } | ||
|
|
||
| location /v2/ { | ||
|
|
||
| if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) { | ||
| return 404; | ||
| } | ||
|
|
||
| auth_basic off; | ||
|
|
||
| add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always; | ||
|
|
||
| proxy_pass http://docker-registry; | ||
| proxy_read_timeout 900; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This role is useless at the moment, only needed for ssh keys, maybe in the future it will be of more use.