summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-03-09 03:19:05 -0500
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-03-09 03:19:05 -0500
commit544a62ea16a289a12b55690ad918068fb5f00564 (patch)
tree31b3389222bb4be2abea9ec36bd159c42357301a
parent5232b710f00e85ce3b031bcaa77ff8cb81122d38 (diff)
downloadoldinfra-544a62ea16a289a12b55690ad918068fb5f00564.tar.gz
oldinfra-544a62ea16a289a12b55690ad918068fb5f00564.zip
drone.io
-rw-r--r--deploy-drone.yml4
-rw-r--r--group_vars/drone.yml4
-rw-r--r--inventory4
-rw-r--r--roles/drone/tasks/main.yml22
-rw-r--r--roles/drone/templates/docker-compose.yml.j229
-rw-r--r--roles/gitea/templates/docker-compose.yml.j22
-rw-r--r--roles/nameservers/templates/db.simponic.xyz.j22
-rw-r--r--roles/private/files/europa/http.drone.internal.simponic.xyz.conf13
-rw-r--r--roles/private/files/europa/https.drone.internal.simponic.xyz.conf32
-rw-r--r--roles/webservers/files/nijika/https.git.simponic.xyz.conf2
10 files changed, 114 insertions, 0 deletions
diff --git a/deploy-drone.yml b/deploy-drone.yml
new file mode 100644
index 0000000..2acfda2
--- /dev/null
+++ b/deploy-drone.yml
@@ -0,0 +1,4 @@
+- name: drone setup
+ hosts: drone
+ roles:
+ - drone
diff --git a/group_vars/drone.yml b/group_vars/drone.yml
new file mode 100644
index 0000000..55843ea
--- /dev/null
+++ b/group_vars/drone.yml
@@ -0,0 +1,4 @@
+---
+drone_gitea_client_id: "{{ lookup('env', 'DRONE_GITEA_CLIENT_ID') }}"
+drone_gitea_client_secret: "{{ lookup('env', 'DRONE_GITEA_CLIENT_SECRET') }}"
+drone_rpc_secret: "{{ lookup('env', 'DRONE_RPC_SECRET') }}"
diff --git a/inventory b/inventory
index cb31cce..450c150 100644
--- a/inventory
+++ b/inventory
@@ -3,6 +3,7 @@ nijika ansible_user=root ansible_connection=ssh
ryo ansible_user=root ansible_connection=ssh
levi ansible_user=root ansible_connection=ssh
mail.simponic.xyz ansible_user=root ansible_connection=ssh
+mcbeta.simponic.xyz ansible_user=root ansible_connection=ssh
[private]
johan ansible_user=root ansible_connection=ssh
@@ -60,3 +61,6 @@ levi ansible_user=root ansible_connection=ssh
[owncloud]
europa ansible_user=root ansible_connection=ssh
+
+[drone]
+europa ansible_user=root ansible_connection=ssh
diff --git a/roles/drone/tasks/main.yml b/roles/drone/tasks/main.yml
new file mode 100644
index 0000000..25f0dbb
--- /dev/null
+++ b/roles/drone/tasks/main.yml
@@ -0,0 +1,22 @@
+---
+- name: ensure drone docker/compose exist
+ file:
+ path: /etc/docker/compose/drone
+ state: directory
+ owner: root
+ group: root
+ mode: 0700
+
+- name: build drone docker-compose.yml.j2
+ template:
+ src: ../templates/docker-compose.yml.j2
+ dest: /etc/docker/compose/drone/docker-compose.yml
+ owner: root
+ group: root
+ mode: u=rw,g=r,o=r
+
+- name: daemon-reload and enable drone
+ ansible.builtin.systemd_service:
+ state: restarted
+ enabled: true
+ name: docker-compose@drone
diff --git a/roles/drone/templates/docker-compose.yml.j2 b/roles/drone/templates/docker-compose.yml.j2
new file mode 100644
index 0000000..8c5e31e
--- /dev/null
+++ b/roles/drone/templates/docker-compose.yml.j2
@@ -0,0 +1,29 @@
+version: '3'
+
+services:
+ drone:
+ container_name: drone
+ image: drone/drone:latest
+ volumes:
+ - ./drone:/data
+ ports:
+ - "127.0.0.1:2201:80"
+ environment:
+ - DRONE_GITEA_SERVER=https://git.simponic.xyz
+ - DRONE_GITEA_CLIENT_ID={{ drone_gitea_client_id }}
+ - DRONE_GITEA_CLIENT_SECRET={{ drone_gitea_client_secret }}
+ - DRONE_GIT_ALWAYS_AUTH=true
+ - DRONE_SERVER_PROTO=https
+ - DRONE_SERVER_HOST=drone.internal.simponic.xyz
+ - DRONE_RPC_SECRET={{ drone_rpc_secret }}
+ drone-runner:
+ container_name: drone_runner
+ image: drone/drone-runner-docker:latest
+ userns_mode: 'host' # Needed to get access to docker socket
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+ environment:
+ - DRONE_RPC_SECRET={{ drone_rpc_secret }}
+ - DRONE_RPC_HOST=drone:80
+ - DRONE_RPC_PROTO=http
+ - DRONE_RUNNER_CAPACITY=4
diff --git a/roles/gitea/templates/docker-compose.yml.j2 b/roles/gitea/templates/docker-compose.yml.j2
index 5a0a071..1df56a8 100644
--- a/roles/gitea/templates/docker-compose.yml.j2
+++ b/roles/gitea/templates/docker-compose.yml.j2
@@ -18,3 +18,5 @@ services:
ports:
- "127.0.0.1:9966:3000"
- "{{ nijika_ip }}:222:22"
+ dns:
+ - {{ johan_ip }}
diff --git a/roles/nameservers/templates/db.simponic.xyz.j2 b/roles/nameservers/templates/db.simponic.xyz.j2
index 38c502f..beed50f 100644
--- a/roles/nameservers/templates/db.simponic.xyz.j2
+++ b/roles/nameservers/templates/db.simponic.xyz.j2
@@ -17,6 +17,7 @@ simponic.xyz. IN NS {{ dns_replica_hostname }}.simponic.xyz.
johan.simponic.xyz. 1 IN A 23.95.20.192
osaka.simponic.xyz. 1 IN A 129.123.76.14
+mcbeta.simponic.xyz. 1 IN A 23.95.20.45
mail.simponic.xyz. 1 IN A 192.3.248.205
@@ -45,3 +46,4 @@ mail._domainkey.simponic.xyz. 1 IN TXT ( "v=DKIM1; h=sha256; k=rsa; "
"lKZ3nglGzPfdJEpfLyXBP4l5UlxqWYUIrCzqHY9bNmyPepb1CJT97AD5jGGngCrnMCmllAdyOKa1ds5uoPjjGaLO8bOoBWXQuacn++hDsdyQ78Y673T2935CN/uGgrLBs9UiA0BQIDAQAB" ) ; ----- DKIM key mail for simponic.xyz
_dmarc.simponic.xyz. 1 IN TXT "v=DMARC1; p=quarantine; sp=quarantine; fo=0; adkim=r; aspf=r; pct=100; rf=afrf; ri=86400; rua=mailto:dmarc.report@simponic.xyz; ruf=mailto:dmarc.report@simponic.xyz"
simponic.xyz. 1 IN TXT "v=spf1 mx ip4:192.3.248.205 ~all"
+simponic.xyz. 1 IN TXT "google-site-verification=iP51S608sxhIkualEX6iODQBGVV8YVe8PY_tij4fdIM"
diff --git a/roles/private/files/europa/http.drone.internal.simponic.xyz.conf b/roles/private/files/europa/http.drone.internal.simponic.xyz.conf
new file mode 100644
index 0000000..db2ea0e
--- /dev/null
+++ b/roles/private/files/europa/http.drone.internal.simponic.xyz.conf
@@ -0,0 +1,13 @@
+server {
+ listen 80;
+ server_name drone.internal.simponic.xyz;
+
+ location /.well-known/acme-challenge {
+ root /var/www/letsencrypt;
+ try_files $uri $uri/ =404;
+ }
+
+ location / {
+ rewrite ^ https://drone.internal.simponic.xyz$request_uri? permanent;
+ }
+}
diff --git a/roles/private/files/europa/https.drone.internal.simponic.xyz.conf b/roles/private/files/europa/https.drone.internal.simponic.xyz.conf
new file mode 100644
index 0000000..06214a6
--- /dev/null
+++ b/roles/private/files/europa/https.drone.internal.simponic.xyz.conf
@@ -0,0 +1,32 @@
+server {
+ listen 443 ssl;
+ server_name drone.internal.simponic.xyz;
+
+ ssl_certificate /etc/letsencrypt/live/drone.internal.simponic.xyz/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/drone.internal.simponic.xyz/privkey.pem;
+ ssl_trusted_certificate /etc/letsencrypt/live/drone.internal.simponic.xyz/fullchain.pem;
+
+ ssl_session_cache shared:SSL:50m;
+ ssl_session_timeout 5m;
+ ssl_stapling on;
+ ssl_stapling_verify on;
+
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
+ ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
+
+ ssl_dhparam /etc/nginx/dhparams.pem;
+ ssl_prefer_server_ciphers on;
+
+ location / {
+ proxy_pass http://127.0.0.1:2201;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+ proxy_set_header Host $server_name;
+ proxy_buffering off;
+ 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 $http_x_forwarded_proto;
+ add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
+ }
+}
diff --git a/roles/webservers/files/nijika/https.git.simponic.xyz.conf b/roles/webservers/files/nijika/https.git.simponic.xyz.conf
index 2abd4fd..df92763 100644
--- a/roles/webservers/files/nijika/https.git.simponic.xyz.conf
+++ b/roles/webservers/files/nijika/https.git.simponic.xyz.conf
@@ -17,9 +17,11 @@ server {
ssl_dhparam /etc/nginx/dhparams.pem;
ssl_prefer_server_ciphers on;
+
location / {
proxy_pass http://127.0.0.1:9966;
+ client_max_body_size 500M;
client_body_buffer_size 128k;
proxy_set_header Host $host;