Move static files into files/ and Jinja2 templates into templates/ #169

Merged
samsapti merged 7 commits from move_stuff_around into main 2023-09-29 21:09:08 +00:00
29 changed files with 40 additions and 31 deletions

View file

@ -5,4 +5,3 @@
name: "nginx-proxy" name: "nginx-proxy"
restart: "yes" restart: "yes"
state: "started" state: "started"

View file

@ -1,9 +1,9 @@
# vim: ft=yaml.ansible # vim: ft=yaml.ansible
--- ---
- name: copy docker registry nginx configuration - name: copy docker registry vhost configuration
copy: copy:
src: "files/configs/docker_registry/nginx.conf" src: vhost/docker_registry
samsapti marked this conversation as resolved Outdated

can we call this file docker_registry?

can we call this file docker_registry?

My (undocumented) naming convention here is actually the subdomain the service is hosted on, so the docker registry's domain is docker.data.coop and the vhost file is docker (without .data.coop). But if you insist I can change it.

My (undocumented) naming convention here is actually the subdomain the service is hosted on, so the docker registry's domain is `docker.data.coop` and the vhost file is `docker` (without `.data.coop`). But if you insist I can change it.

can we have the full domain name as the name of the file then? the same with the other comments

can we have the full domain name as the name of the file then? the same with the other comments

Then I would rather use the service name instead, just for the sake of avoiding code duplication (not hardcoding the base domain). What do you think?

Then I would rather use the service name instead, just for the sake of avoiding code duplication (not hardcoding the base domain). What do you think?

ah yes very good point! let's use the name of the service and not anything related to the domain name

ah yes very good point! let's use the name of the service and not anything related to the domain name
dest: "/docker-volumes/nginx/vhost/{{ services.docker_registry.domain }}" dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.docker_registry.domain }}"
mode: "0644" mode: "0644"
- name: docker registry container - name: docker registry container

View file

@ -12,7 +12,7 @@
- name: copy sso public certificate - name: copy sso public certificate
copy: copy:
src: "files/sso/sso.data.coop.pem" src: sso/sso.data.coop.pem
dest: "{{ services.hedgedoc.volume_folder }}/sso.data.coop.pem" dest: "{{ services.hedgedoc.volume_folder }}/sso.data.coop.pem"
mode: "0644" mode: "0644"
@ -33,7 +33,7 @@
- "hedgedoc" - "hedgedoc"
volumes: volumes:
- "{{ services.hedgedoc.volume_folder }}/db:/var/lib/postgresql/data" - "{{ services.hedgedoc.volume_folder }}/db:/var/lib/postgresql/data"
app: app:
image: "quay.io/hedgedoc/hedgedoc:{{ services.hedgedoc.version }}" image: "quay.io/hedgedoc/hedgedoc:{{ services.hedgedoc.version }}"
environment: environment:
@ -55,7 +55,7 @@
- "{{ services.hedgedoc.volume_folder }}/hedgedoc/uploads:/hedgedoc/public/uploads" - "{{ services.hedgedoc.volume_folder }}/hedgedoc/uploads:/hedgedoc/public/uploads"
- "{{ services.hedgedoc.volume_folder }}/sso.data.coop.pem:/sso.data.coop.pem" - "{{ services.hedgedoc.volume_folder }}/sso.data.coop.pem:/sso.data.coop.pem"
restart: "unless-stopped" restart: "unless-stopped"
networks: networks:
- "hedgedoc" - "hedgedoc"
- "external_services" - "external_services"
depends_on: depends_on:

View file

@ -25,7 +25,7 @@
- name: upload mailu.env file - name: upload mailu.env file
template: template:
src: mailu.env.j2 src: mailu/env.j2
dest: "{{ services.mailu.volume_folder }}/mailu.env" dest: "{{ services.mailu.volume_folder }}/mailu.env"
- name: hard link to Let's Encrypt TLS certificate - name: hard link to Let's Encrypt TLS certificate
@ -106,7 +106,7 @@
admin: admin:
image: ghcr.io/mailu/admin:{{ services.mailu.version }} image: ghcr.io/mailu/admin:{{ services.mailu.version }}
restart: always restart: always
env_file: "{{ services.mailu.volume_folder}}/mailu.env" env_file: "{{ services.mailu.volume_folder }}/mailu.env"
volumes: volumes:
- "{{ services.mailu.volume_folder }}/data:/data" - "{{ services.mailu.volume_folder }}/data:/data"
- "{{ services.mailu.volume_folder }}/dkim:/dkim" - "{{ services.mailu.volume_folder }}/dkim:/dkim"

View file

@ -31,17 +31,17 @@
- name: Copy mastodon environment file - name: Copy mastodon environment file
template: template:
src: files/configs/mastodon/env_file.j2 src: mastodon/env.j2
dest: "{{ services.mastodon.volume_folder }}/env_file" dest: "{{ services.mastodon.volume_folder }}/env_file"
- name: Upload vhost config for root domain - name: Upload vhost config for root domain
template: copy:
src: files/configs/mastodon/vhost-mastodon src: vhost/mastodon
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.mastodon.domain }}" dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.mastodon.domain }}"
- name: Copy PostgreSQL config - name: Copy PostgreSQL config
copy: copy:
src: files/configs/mastodon/postgresql.conf src: mastodon/postgresql.conf
dest: "{{ services.mastodon.volume_folder }}/postgres_config/postgresql.conf" dest: "{{ services.mastodon.volume_folder }}/postgres_config/postgresql.conf"
- name: Set up Mastodon - name: Set up Mastodon

View file

@ -29,33 +29,33 @@
- name: Upload Element config.json - name: Upload Element config.json
template: template:
src: files/configs/element/config.json src: element/config.json.j2
dest: "{{ services.element.volume_folder }}/data/config.json" dest: "{{ services.element.volume_folder }}/data/config.json"
- name: Upload Element riot.im.conf - name: Upload Element riot.im.conf
template: copy:
src: files/configs/element/riot.im.conf src: element/riot.im.conf
dest: "{{ services.element.volume_folder }}/data/riot.im.conf" dest: "{{ services.element.volume_folder }}/data/riot.im.conf"
- name: upload vhost config for matrix domain - name: upload vhost config for matrix domain
template: copy:
src: files/configs/matrix/vhost-matrix src: vhost/matrix
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.matrix.domain }}" dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.matrix.domain }}"
- name: Upload vhost config for Element domain - name: Upload vhost config for Element domain
template: copy:
src: files/configs/matrix/vhost-element src: vhost/element
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ item }}" dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ item }}"
loop: "{{ services.element.domains }}" loop: "{{ services.element.domains }}"
- name: Upload homeserver.yaml - name: Upload homeserver.yaml
template: template:
src: "files/configs/matrix/homeserver.yaml.j2" src: matrix/homeserver.yaml.j2
dest: "{{ services.matrix.volume_folder }}/data/homeserver.yaml" dest: "{{ services.matrix.volume_folder }}/data/homeserver.yaml"
- name: upload matrix logging config - name: upload matrix logging config
template: copy:
src: "files/configs/matrix/matrix.data.coop.log.config" src: matrix/log.config
dest: "{{ services.matrix.volume_folder }}/data/matrix.data.coop.log.config" dest: "{{ services.matrix.volume_folder }}/data/matrix.data.coop.log.config"
- name: Set up Matrix and Element - name: Set up Matrix and Element

View file

@ -1,8 +1,8 @@
# vim: ft=yaml.ansible # vim: ft=yaml.ansible
--- ---
- name: upload vhost config for cloud.data.coop - name: upload vhost config for cloud.data.coop
template: copy:
src: files/configs/nextcloud/vhost src: vhost/nextcloud
valberg marked this conversation as resolved Outdated

can we call this file nextcloud ?

can we call this file nextcloud ?
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.nextcloud.domain }}" dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.nextcloud.domain }}"
notify: "restart nginx" notify: "restart nginx"

View file

@ -11,8 +11,8 @@
loop_var: volume loop_var: volume
- name: upload privatebin config - name: upload privatebin config
template: copy:
src: files/configs/privatebin-conf.php src: privatebin/conf.php
dest: "{{ services.privatebin.volume_folder }}/cfg/conf.php" dest: "{{ services.privatebin.volume_folder }}/cfg/conf.php"
- name: privatebin app container - name: privatebin app container

View file

@ -1,13 +1,13 @@
# vim: ft=yaml.ansible # vim: ft=yaml.ansible
--- ---
- name: Create rallly volume folders - name: Create Rallly volume folders
file: file:
name: "{{ services.rallly.volume_folder }}/postgres" name: "{{ services.rallly.volume_folder }}/postgres"
state: directory state: directory
- name: Copy Rallly environment file - name: Copy Rallly environment file
template: template:
src: files/configs/rallly/env_file.j2 src: rallly/env.j2
dest: "{{ services.rallly.volume_folder }}/env_file" dest: "{{ services.rallly.volume_folder }}/env_file"
- name: Set up Rallly - name: Set up Rallly

View file

@ -33,7 +33,7 @@
- name: Create SSH config - name: Create SSH config
template: template:
src: restic.ssh.config.j2 src: restic/ssh.config.j2
dest: "{{ services.restic.volume_folder }}/ssh/config" dest: "{{ services.restic.volume_folder }}/ssh/config"
owner: root owner: root
group: root group: root
@ -41,7 +41,7 @@
- name: Create SSH known_hosts file - name: Create SSH known_hosts file
template: template:
src: restic.ssh.known_hosts.j2 src: restic/ssh.known_hosts.j2
dest: "{{ services.restic.volume_folder }}/ssh/known_hosts" dest: "{{ services.restic.volume_folder }}/ssh/known_hosts"
owner: root owner: root
group: root group: root

View file

@ -2,6 +2,15 @@
--- ---
- name: Upload vhost config for root domain - name: Upload vhost config for root domain
copy: copy:
<<<<<<< HEAD
src: vhost/base_domain
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ base_domain }}"
- name: Upload vhost config for WWW domain
copy:
src: vhost/www.base_domain
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/www.{{ base_domain }}"
=======
src: files/configs/matrix/vhost-root src: files/configs/matrix/vhost-root
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.data_coop_website.domain }}" dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.data_coop_website.domain }}"
@ -9,6 +18,7 @@
copy: copy:
src: files/configs/vhost-www src: files/configs/vhost-www
dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.data_coop_website.www_domain }}" dest: "{{ services.nginx_proxy.volume_folder }}/vhost/{{ services.data_coop_website.www_domain }}"
>>>>>>> main
- name: setup data.coop website docker container - name: setup data.coop website docker container
docker_container: docker_container: