diff --git a/group_vars/activitypubrelay b/group_vars/activitypubrelay new file mode 100644 index 0000000000000000000000000000000000000000..ba28837c1d7ede85609477a560e05789de9ed756 --- /dev/null +++ b/group_vars/activitypubrelay @@ -0,0 +1,8 @@ +--- + +activitypubrelay_relays: + - name: darmstadt + domain: relay.darmstadt.social + - name: hessen + domain: relay.hessen.social + diff --git a/group_vars/activityrelay b/group_vars/activityrelay deleted file mode 100644 index dc9b888ccd1ba2e6c71455d00cfbf2628933c196..0000000000000000000000000000000000000000 --- a/group_vars/activityrelay +++ /dev/null @@ -1,8 +0,0 @@ -$ANSIBLE_VAULT;1.1;AES256 -61333539343165373234623930393463373762653830626635666234383732663066666431623136 -6431666562383330303937326136663262643530353837320a616133366164306265626431346262 -35396463356466323966623037326235363732373362366533333365663630363462343533303662 -3136626537313130660a356139316637313935373033333833383266356130333562653936366463 -65346630636633336264663435386366333430643037346431353062323235306638636463393133 -32396639646263663633363165303538396432643165316236656630666435383930353662366462 -663232393665633935663934386534386439 diff --git a/inventory b/inventory index b8d5a1a9c93235ae0eb13c8d7128366b7be7f40e..47577af7ac51fceefed36794c11b9d0c9dfb03cd 100644 --- a/inventory +++ b/inventory @@ -27,8 +27,8 @@ bench01.laboratory.openalchem.ist [monitoring] bench03.laboratory.openalchem.ist -[activityrelay] -bench01.laboratory.openalchem.ist +[activitypubrelay] +bench03.laboratory.openalchem.ist [minio] bench03.laboratory.openalchem.ist diff --git a/roles/docker_activityrelay/defaults/main.yml b/roles/docker_activitypubrelay/defaults/main.yml similarity index 63% rename from roles/docker_activityrelay/defaults/main.yml rename to roles/docker_activitypubrelay/defaults/main.yml index bc74a87862237f5c2afdbad37f54e4e1bd8375fa..bb86617daf129d0754f0fe32cd537d641c5975a4 100644 --- a/roles/docker_activityrelay/defaults/main.yml +++ b/roles/docker_activitypubrelay/defaults/main.yml @@ -18,11 +18,14 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -activityrelay_install_location: /var/srv/activityrelay -activityrelay_data_location: /var/srv/activityrelay/data +activitypubrelay_install_location: /var/srv/activity-pub-relay +activitypubrelay_storage_location: /var/srv/containers/activity-pub-relay -activityrelay_domain: relay.example.social +activitypubrelay_domain: relay.example.social +activitypubrelay_relays: +# - name: example +# domain: relay.example.social -activityrelay_version: latest -activityrelay_image_source: quay.io/w4tsn/activity-pub-relay -activityrelay_image: "{{ activityrelay_image_source }}:{{ activityrelay_version }}" +activitypubrelay_version: latest +activitypubrelay_image_source: quay.io/w4tsn/activity-pub-relay +activitypubrelay_image: "{{ activitypubrelay_image_source }}:{{ activitypubrelay_version }}" diff --git a/roles/docker_activityrelay/meta/main.yml b/roles/docker_activitypubrelay/meta/main.yml similarity index 100% rename from roles/docker_activityrelay/meta/main.yml rename to roles/docker_activitypubrelay/meta/main.yml diff --git a/roles/docker_activityrelay/tasks/main.yml b/roles/docker_activitypubrelay/tasks/main.yml similarity index 70% rename from roles/docker_activityrelay/tasks/main.yml rename to roles/docker_activitypubrelay/tasks/main.yml index a4fc19796775040c99f685288146e551ef2d99ed..b32e3f1f3cb27f53170e8959c3841cfb3dcfae59 100644 --- a/roles/docker_activityrelay/tasks/main.yml +++ b/roles/docker_activitypubrelay/tasks/main.yml @@ -1,5 +1,5 @@ --- -# tasks file for activityrelay +# tasks file for activitypubrelay # OpenAlchem.ist Infrastructure # Ansible instructions to deploy the infrastructure for the OpenAlchem.ist, @@ -21,12 +21,12 @@ - name: Update default SELinux contexts sefcontext: - target: '{{ item }}(/.*)?' + target: '{{ activitypubrelay_storage_location }}/{{ item.name }}(/.*)?' setype: "container_file_t" - selevel: "{{ activityrelay_selinux_level | default(omit) }}" + selevel: "{{ activitypubrelay_selinux_level | default(omit) }}" state: present with_items: - - "{{ activityrelay_data_location }}" + - "{{ activitypubrelay_relays }}" become: true - name: Create install directory @@ -34,23 +34,23 @@ path: "{{ item }}" state: directory with_items: - - "{{ activityrelay_install_location }}" + - "{{ activitypubrelay_install_location }}" become: true -- name: Create data directory +- name: Create data directories file: - path: "{{ item }}" + path: "{{ activitypubrelay_storage_location }}/{{ item.name }}" state: directory setype: "container_file_t" - selevel: "{{ activityrelay_selinux_level | default(omit) }}" + selevel: "{{ activitypubrelay_selinux_level | default(omit) }}" with_items: - - "{{ activityrelay_data_location }}" + - "{{ activitypubrelay_relays }}" become: true - name: Deploy docker-compose.yml template: src: docker-compose.yml.j2 - dest: "{{ activityrelay_install_location }}/docker-compose.yml" + dest: "{{ activitypubrelay_install_location }}/docker-compose.yml" mode: 0600 owner: 'root' group: 'root' @@ -60,10 +60,10 @@ - docker become: true -- name: Compose activityrelay +- name: Compose activitypubrelay docker_compose: state: present - project_src: "{{ activityrelay_install_location }}" + project_src: "{{ activitypubrelay_install_location }}" pull: yes remove_orphans: yes become: true diff --git a/roles/docker_activitypubrelay/templates/docker-compose.yml.j2 b/roles/docker_activitypubrelay/templates/docker-compose.yml.j2 new file mode 100644 index 0000000000000000000000000000000000000000..81216c5e5eeb7327bc128a0033d448e3c9a1e90b --- /dev/null +++ b/roles/docker_activitypubrelay/templates/docker-compose.yml.j2 @@ -0,0 +1,51 @@ +{{ ansible_managed | comment }} + +# OpenAlchem.ist Infrastructure +# Ansible instructions to deploy the infrastructure for the OpenAlchem.ist, +# darmstadt.social +# Copyright (C) 2019-2020 Alexander (w4tsn) Wellbrock +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +version: '2' +services: +{% for relay in activitypubrelay_relays %} + {{ relay.name }}: + image: "{{ activitypubrelay_image }}" + mem_limit: 1024mb + memswap_limit: 1280mb + labels: + - "traefik.enable=true" + + - "traefik.http.routers.activitypubrelay-{{ relay.name }}.rule=Host(`{{ relay.domain }}`) && PathPrefix(`/`)" + - "traefik.http.routers.activitypubrelay-{{ relay.name }}.entrypoints=websecure" + - "traefik.http.routers.activitypubrelay-{{ relay.name }}.tls.certresolver=letsencrypt_cf_http" + - "traefik.http.routers.activitypubrelay-{{ relay.name }}.middlewares=activitypubrelay-{{ relay.name }},compress" + - "traefik.http.services.activitypubrelay-{{ relay.name }}.loadbalancer.server.port=8080" + - "traefik.http.middlewares.activitypubrelay-{{ relay.name }}.headers.sslredirect=true" + - "traefik.http.middlewares.activitypubrelay-{{ relay.name }}.headers.stsSeconds=63072000" + - "traefik.http.middlewares.activitypubrelay-{{ relay.name }}.headers.referrerPolicy=no-referrer" + + - "traefik.docker.network=proxy" + networks: + proxy: + volumes: + - "{{ activitypubrelay_storage_location }}/{{ relay.name }}/data:/data" + - "{{ activitypubrelay_storage_location }}/{{ relay.name }}/relay.yaml:/data/relay.yaml:ro" + restart: always +{% endfor %} + +networks: + proxy: + external: true diff --git a/roles/docker_activityrelay/templates/docker-compose.yml.j2 b/roles/docker_activityrelay/templates/docker-compose.yml.j2 deleted file mode 100644 index b7452501890e619e0df894d162edf3f3df6e0cb7..0000000000000000000000000000000000000000 --- a/roles/docker_activityrelay/templates/docker-compose.yml.j2 +++ /dev/null @@ -1,49 +0,0 @@ -{{ ansible_managed | comment }} - -# OpenAlchem.ist Infrastructure -# Ansible instructions to deploy the infrastructure for the OpenAlchem.ist, -# darmstadt.social -# Copyright (C) 2019-2020 Alexander (w4tsn) Wellbrock -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -version: '2' -services: - relay: - image: "{{ activityrelay_image }}" - mem_limit: 1024mb - memswap_limit: 1280mb - labels: - - "traefik.enable=true" - - - "traefik.http.routers.activitypubrelay.rule=Host(`{{ activityrelay_domain }}`) && PathPrefix(`/`)" - - "traefik.http.routers.activitypubrelay.entrypoints=websecure" - - "traefik.http.routers.activitypubrelay.tls.certresolver=letsencrypt_cf_http" - - "traefik.http.routers.activitypubrelay.middlewares=activitypubrelay,compress" - - "traefik.http.services.activitypubrelay.loadbalancer.server.port=8080" - - "traefik.http.middlewares.activitypubrelay.headers.sslredirect=true" - - "traefik.http.middlewares.activitypubrelay.headers.stsSeconds=63072000" - - "traefik.http.middlewares.activitypubrelay.headers.referrerPolicy=no-referrer" - - - "traefik.docker.network=proxy" - networks: - proxy: - volumes: - - "{{ activityrelay_data_location }}:/data" - - "{{ activityrelay_install_location }}/config.yml:/data/relay.yaml:ro" - restart: always - -networks: - proxy: - external: true diff --git a/service_activityrelay.yml b/service_activitypubrelay.yml similarity index 92% rename from service_activityrelay.yml rename to service_activitypubrelay.yml index 7e98b50891e0f5b9fd8c8e3167aed26044b15f64..778d0685d49dbaa717e086fbd505107b9f425f9a 100644 --- a/service_activityrelay.yml +++ b/service_activitypubrelay.yml @@ -18,6 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -- hosts: activityrelay +- hosts: + - activitypubrelay roles: - - docker_activityrelay + - docker_activitypubrelay diff --git a/site.yml b/site.yml index 926cc187a90d09da9036230268bf474a3c2fb23c..f7ca5cb05d67dd97913ac6e7f25ca8c8ed107974 100644 --- a/site.yml +++ b/site.yml @@ -29,7 +29,7 @@ # Darmstadt.social - import_playbook: service_mastodon.yml - import_playbook: service_matrix.yml -- import_playbook: service_activityrelay.yml +- import_playbook: service_activitypubrelay.yml - import_playbook: service_jitsimeet.yml # Openalchem.ist