-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/registry drone roles #42
base: master
Are you sure you want to change the base?
Changes from 7 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 |
---|---|---|
|
@@ -4,12 +4,14 @@ caliopen | |
gateway | ||
storage | ||
smtp | ||
citools | ||
|
||
[services:vars] | ||
dist_directory=./dist | ||
object_store_access_key=SZ1BBGKTD2N13E0W5L8N | ||
object_store_secret_key=qTsjiThBQA2NH6ZO32tCwCC6wcC8ValVLR16XUsB | ||
caliopen_domain_name=alpha.caliopen.org | ||
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. Can't we use variables And for consistency naming, use caliopen_domain_base instead of caliopen_base_domain |
||
caliopen_base_domain=caliopen.org | ||
caliopen_nameservers=["155.133.128.67", "155.133.128.65"] | ||
|
||
# Vault | ||
|
@@ -20,6 +22,20 @@ vault_worker_password=TO_BE_DEFINED | |
vault_cert_path=/etc/vault/alpha.caliopen.org.crt | ||
vault_key_path=/etc/vault/alpha.caliopen.org.key | ||
|
||
# Docker registry | ||
registry_path=/etc/docker-registry | ||
|
||
# Drone | ||
drone_path=/etc/drone | ||
# Github OAuth | ||
DRONE_GITHUB_CLIENT= | ||
DRONE_GITHUB_SECRET= | ||
# Agent/Server communication | ||
DRONE_SECRET=this_should_be_a_secret | ||
# List of admins, Github usernames | ||
DRONE_ADMIN= | ||
DRONE_HOST=drone.caliopen.org | ||
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. use of {{ caliopen_domain_base }} possible ? |
||
|
||
# Version of installed software out of host packaging | ||
|
||
# monitoring platform | ||
|
@@ -61,6 +77,9 @@ cache | |
mq | ||
object_store | ||
|
||
[citools:children] | ||
registry | ||
|
||
[store] | ||
store1 ansible_host=ip_store1 ansible_user=root backend_ip=backend_store1 | ||
store2 ansible_host=ip_store2 ansible_user=root backend_ip=backend_store2 | ||
|
@@ -107,3 +126,6 @@ mail1 ansible_host=ip_mail1 ansible_user=root backend_ip=backend_mail1 | |
|
||
[logstash] | ||
logstash1 ansible_host=ip_logstash1 ansible_user=root backend_ip=backend_logstash1 | ||
|
||
[registry] | ||
registry1 ansible_host=ip_registry1 ansible_user=root backend_ip=backend_registry1 | ||
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. missing \n at end of line |
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== [email protected] | ||
ssh-dss AAAAB3NzaC1kc3MAAACBAM686CNkUeMiHvr/1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eqb03PXoT+45V57s6UxJpIihjZSrEqJ1ZXAD0tLv3Fsj1KHNQi8da+P0ph33XeplCGPhRBohiL3obxWSDZ/WX0MaX4tgICqDHAkSGrDJkeF8dgNAtO2+m44oty6U/ztnuSKQGBXACxbpS+M8YfPFTyBkjrOtfqk0R/MgdG2gxvPyYPG3ody20QcYzTbG9LrtOReN58kPt4D/3Mp2w== [email protected] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- name: install ssh authorized keys | ||
copy: src=ssh_authorized_keys dest=/root/.ssh/authorized_keys mode=0600 | ||
tags: | ||
- ssh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
- name: install dependencies | ||
apt: package={{ item }} state=installed update_cache=yes | ||
with_items: | ||
- apt-transport-https | ||
- ca-certificates | ||
- curl | ||
- gnupg2 | ||
- software-properties-common | ||
|
||
- name: add apt key | ||
apt_key: | ||
url: https://download.docker.com/linux/debian/gpg | ||
state: present | ||
|
||
- name: get debian version | ||
shell: lsb_release -cs | ||
register: debian_version | ||
|
||
- name: Add docker apt repo | ||
apt_repository: | ||
repo: 'deb [arch=amd64] https://download.docker.com/linux/debian {{ debian_version }} 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 | ||
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. missing \n |
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 up -f {{ drone_path }}/docker-compose.yml | ||
|
||
- 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,33 @@ | ||
http { | ||
|
||
upstream drone { | ||
server 127.0.0.1:8000; | ||
} | ||
|
||
server { | ||
listen 443 ssl; | ||
listen [::]:443 ssl: | ||
server_name drone.{{ caliopen_base_domain }}; | ||
|
||
ssl_certificate /etc/nginx/certs/{{ caliopen_base_domain }}.crt; | ||
ssl_certificate_key /etc/nginx/certs/{{ caliopen_base_domain }}.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 |
---|---|---|
@@ -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,25 @@ | ||
- 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 up -f {{ registry_path }}/docker-compose.yml | ||
|
||
- 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,80 @@ | ||
http { | ||
|
||
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_base_domain }}; | ||
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. need to update all caliopen_base_domain variable to new naming |
||
|
||
ssl_certificate /etc/nginx/certs/{{ caliopen_base_domain }}.crt; | ||
ssl_certificate_key /etc/nginx/certs/{{ caliopen_base_domain }}.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_base_domain }}; | ||
|
||
ssl_certificate /etc/nginx/certs/{{ caliopen_base_domain }}.crt; | ||
ssl_certificate_key /etc/nginx/certs/{{ caliopen_base_domain }}.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.