From a219b17996c5beb2da4d82e3aff2607731f9adfa Mon Sep 17 00:00:00 2001 From: Mathias Teier Date: Fri, 2 Apr 2021 19:16:09 +0200 Subject: [PATCH] Add Gitea --- gitea/docker-compose.yml | 17 +++++++++++++++++ gitea/start.yml | 26 ++++++++++++++++++++++++++ mail/start.yml | 10 ---------- nginx/playbook-nginx.yml | 2 +- nginx/sites/gitea | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 78 insertions(+), 11 deletions(-) create mode 100644 gitea/docker-compose.yml create mode 100644 gitea/start.yml create mode 100644 nginx/sites/gitea diff --git a/gitea/docker-compose.yml b/gitea/docker-compose.yml new file mode 100644 index 0000000..8b41468 --- /dev/null +++ b/gitea/docker-compose.yml @@ -0,0 +1,17 @@ +version: "2.4" +services: + server: + image: gitea/gitea:1.13.6 + container_name: gitea + environment: + USER_UID: 1000 + USER_GID: 1000 + DOMAIN: "git.kagent.at" + restart: unless-stopped + volumes: + - /var/gitea:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "3000:3000" + - "2222:22" \ No newline at end of file diff --git a/gitea/start.yml b/gitea/start.yml new file mode 100644 index 0000000..f5f3e04 --- /dev/null +++ b/gitea/start.yml @@ -0,0 +1,26 @@ +--- +- hosts: teier.eu + gather_facts: no + tasks: + - name: Check dc directory + stat: + path: /dc/gitea + register: gitea_dc_dir_stat + + - name: Create gitea dc directory + file: + path: /dc/gitea + state: directory + mode: 0755 + group: root + owner: root + when: gitea_dc_dir_stat.islnk is not defined + + - name: Copy compose file + copy: + src: docker-compose.yml + dest: /dc/gitea/ + + - name: Start gitea + shell: "cd /dc/gitea && docker-compose up -d" + \ No newline at end of file diff --git a/mail/start.yml b/mail/start.yml index 743e98a..382ddd3 100644 --- a/mail/start.yml +++ b/mail/start.yml @@ -16,16 +16,6 @@ owner: root when: mail_dc_dir_stat.islnk is not defined - - name: Copy mailserver.env - copy: - src: mailserver.env - dest: /dc/mail/ - - - name: Copy setup.sh - copy: - src: setup.sh - dest: /dc/mail/ - - name: Copy compose file copy: src: docker-compose.yml diff --git a/nginx/playbook-nginx.yml b/nginx/playbook-nginx.yml index 0b9068d..be64840 100644 --- a/nginx/playbook-nginx.yml +++ b/nginx/playbook-nginx.yml @@ -20,7 +20,7 @@ shell: "rm -f /etc/nginx/sites-enabled/*" - name: Get Certificate - shell: certbot certonly --standalone --preferred-challenges http -m mathias.teier@icloud.com --agree-tos -n -d teier.eu -d cloud.teier.eu -d nummus.teier.eu -d www.teier.eu -d collabora.teier.eu -d matrix.teier.eu + shell: certbot certonly --standalone --preferred-challenges http -m mathias.teier@icloud.com --agree-tos -n -d teier.eu -d cloud.teier.eu -d nummus.teier.eu -d www.teier.eu -d collabora.teier.eu -d matrix.teier.eu -d kagent.at -d www.kagent.at -d git.kagent.at - name: Install nginx server config copy: diff --git a/nginx/sites/gitea b/nginx/sites/gitea new file mode 100644 index 0000000..624621d --- /dev/null +++ b/nginx/sites/gitea @@ -0,0 +1,34 @@ +server { + listen 80; + server_name git.kagent.at; + return 301 https://git.kagent.at:443$request_uri; +} + +server { + listen 443 ssl http2; + server_name git.kagent.at; + + ssl on; + ssl_certificate /etc/letsencrypt/live/teier.eu/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/teier.eu/privkey.pem; + + location / { + proxy_pass http://127.0.0.1:3000/; + + # Configuration for WebSockets + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_cache off; + + # Configuration for ServerSentEvents + proxy_buffering off; + + # Configuration for LongPolling or if your KeepAliveInterval is longer than 60 seconds + proxy_read_timeout 100s; + + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Frame-Options "SAMEORIGIN"; + } +} \ No newline at end of file