Move web1 over to a containerized setup, containerize Nextcloud

This commit is contained in:
Salt 2021-08-24 00:31:11 -05:00
parent a6cc1ecece
commit 1fb222fb15
6 changed files with 113 additions and 13 deletions

View File

@ -15,6 +15,80 @@
restart_policy: unless-stopped restart_policy: unless-stopped
pull: yes pull: yes
tasks: tasks:
- name: ensure docker network
docker_network: name=web
tags: [ docker ]
- name: ensure docker nginx config
copy:
dest: /data/nginx-certbot/user_conf.d/vhosts.conf
mode: "0750"
content: |
server {
listen 443 ssl default_server;
server_name desu.ltd;
ssl_certificate /etc/letsencrypt/live/desu.ltd/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/desu.ltd/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/desu.ltd/chain.pem;
ssl_dhparam /etc/letsencrypt/dhparams/dhparam.pem;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://desultd:80;
}
}
server {
listen 443 ssl;
server_name 9iron.club;
ssl_certificate /etc/letsencrypt/live/desu.ltd/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/desu.ltd/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/desu.ltd/chain.pem;
ssl_dhparam /etc/letsencrypt/dhparams/dhparam.pem;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://9iron:80;
}
}
server {
listen 443 ssl;
server_name git.desu.ltd;
ssl_certificate /etc/letsencrypt/live/desu.ltd/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/desu.ltd/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/desu.ltd/chain.pem;
ssl_dhparam /etc/letsencrypt/dhparams/dhparam.pem;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://gitea:3000;
}
}
server {
listen 443 ssl;
server_name nc.desu.ltd;
ssl_certificate /etc/letsencrypt/live/desu.ltd/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/desu.ltd/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/desu.ltd/chain.pem;
ssl_dhparam /etc/letsencrypt/dhparams/dhparam.pem;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://nextcloud:80;
}
}
server {
listen 443 ssl;
server_name srv.9iron.club;
ssl_certificate /etc/letsencrypt/live/desu.ltd/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/desu.ltd/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/desu.ltd/chain.pem;
ssl_dhparam /etc/letsencrypt/dhparams/dhparam.pem;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://srv:80;
}
}
tags: [ docker, ingress ]
- name: include tasks for apps - name: include tasks for apps
include_tasks: tasks/app/{{ task }} include_tasks: tasks/app/{{ task }}
with_items: with_items:
@ -28,6 +102,9 @@
- 9iron.yml - 9iron.yml
- desultd.yml - desultd.yml
- gitea.yml - gitea.yml
- nextcloud.yml
- srv.yml
- ingress-generic.yml
loop_control: loop_control:
loop_var: task loop_var: task
tags: [ always ] tags: [ always ]
@ -47,20 +124,12 @@
- /var/lib/gitea/log - /var/lib/gitea/log
- /data/gitea/data/gitea/log - /data/gitea/data/gitea/log
tags: [ backup ] tags: [ backup ]
- role: certbot
tags: [ web, certbot ]
- role: php
tags: [ web, php ]
- role: apache
tags: [ web, apache ]
- role: git - role: git
vars: vars:
git_repos: git_repos:
- repo: https://git.desu.ltd/salt/gitea-custom - repo: https://git.desu.ltd/salt/gitea-custom
dest: /data/gitea/data/gitea/custom dest: /data/gitea/data/gitea/custom
tags: [ web, git ] tags: [ web, git ]
- role: nextcloud
tags: [ web, nextcloud ]
- hosts: web2.desu.ltd - hosts: web2.desu.ltd
module_defaults: module_defaults:
docker_container: docker_container:

View File

@ -3,8 +3,9 @@
docker_container: docker_container:
name: 9iron name: 9iron
image: rehashedsalt/9iron:latest image: rehashedsalt/9iron:latest
ports: networks:
- 8001:80 - name: web
aliases: [ "9iron" ]
volumes: volumes:
- /data/9iron/files:/var/www/html/files - /data/9iron/files:/var/www/html/files
- /data/9iron/packs:/var/www/html/minecraft/packs - /data/9iron/packs:/var/www/html/minecraft/packs

View File

@ -3,8 +3,9 @@
docker_container: docker_container:
name: desultd name: desultd
image: rehashedsalt/desultd:latest image: rehashedsalt/desultd:latest
ports: networks:
- 8002:80 - name: web
aliases: [ "desultd" ]
volumes: volumes:
- /data/9iron/files:/var/www/html/files - /data/9iron/files:/var/www/html/files
tags: [ docker, 9iron ] tags: [ docker, 9iron ]

View File

@ -12,8 +12,10 @@
GITEA__database_USER: gitea-desultd GITEA__database_USER: gitea-desultd
GITEA__database_PASSWD: "{{ secret_gitea_db_pass }}" GITEA__database_PASSWD: "{{ secret_gitea_db_pass }}"
ports: ports:
- 3000:3000
- 127.0.0.1:2222:22 - 127.0.0.1:2222:22
networks:
- name: web
aliases: [ "gitea" ]
volumes: volumes:
- /data/gitea/data:/data - /data/gitea/data:/data
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro

View File

@ -0,0 +1,14 @@
# vim:ft=ansible:
- name: docker deploy nextcloud
docker_container:
name: nextcloud
image: nextcloud:21
networks:
- name: web
aliases: [ "nextcloud" ]
volumes:
- /data/nextcloud/apps:/var/www/html/apps
- /data/nextcloud/config:/var/www/html/config
- /data/nextcloud/themes:/var/www/html/themes
- /srv/desu.ltd/nc:/var/www/html/data
tags: [ docker, nextcloud ]

View File

@ -0,0 +1,13 @@
# vim:ft=ansible:
- name: docker deploy nextcloud shim
docker_container:
# NOTE: We depend on the default configuration of Apache here, specifically
# the default to have server-generated indexes. Makes srv easier to navigate
name: srv
image: httpd:latest
networks:
- name: web
aliases: [ "srv" ]
volumes:
- /var/www/srv.9iron.club:/usr/local/apache2/htdocs
tags: [ docker, 9iron ]