From 75b694f78ec9cd98aaf65594cf4bc6cd4be08732 Mon Sep 17 00:00:00 2001 From: muppeth Date: Wed, 4 Jan 2023 00:21:10 +0100 Subject: [PATCH] added akkoma support; changed the way frontends are installed (following akkoma's docs); switched to mangane; updated config templates --- README.md | 6 ++-- defaults/main.yml | 46 ++++++++---------------- files/favicon.png | 0 files/logo.svg | 0 tasks/configure.yml | 1 + tasks/frontends.yml | 76 ++++++++++++--------------------------- tasks/main.yml | 1 - tasks/upgrade.yml | 11 ++++++ templates/config.exs.j2 | 9 +++++ templates/soapbox.json.j2 | 27 -------------- 10 files changed, 60 insertions(+), 117 deletions(-) create mode 100644 files/favicon.png create mode 100644 files/logo.svg delete mode 100644 templates/soapbox.json.j2 diff --git a/README.md b/README.md index 250016b..18cc417 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Pleroma role -Pleroma role is was initially based on role by (Luke Hoersten)[https://src.nth.io/ansible-roles/file/2d705e63f6cb/pleroma/otp] with heavy modifications (basically re-written). -This role deploys and updates OTP pleroma instance with soapbox ui. Currently supported distributions are debian based. Role requires disroot's (nginx)[https://git.disroot.org/Disroot-Ansible/nginx] role and (postgresql)[https://github.com/ANXS/postgresql.git]. Other nginx / postgres roles could be used but may require changes in variables. +# Pleroma/Akkoma role +Pleroma/Akkoma role is was initially based on role by (Luke Hoersten)[https://src.nth.io/ansible-roles/file/2d705e63f6cb/pleroma/otp] with heavy modifications (basically re-written). +This role deploys and updates OTP akkoma (default) or pleroma instance. Currently supported distributions are debian based. Role requires disroot's (nginx)[https://git.disroot.org/Disroot-Ansible/nginx] role and (postgresql)[https://github.com/ANXS/postgresql.git]. Other nginx / postgres roles could be used but may require changes in variables. You can deploy test instance using `Vagrantfile` attached to the role. `vagrant up` diff --git a/defaults/main.yml b/defaults/main.yml index e010e91..7608ff7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -42,6 +42,7 @@ pleroma_signup_open: "true" pleroma_loglevel: ":debug" pleroma_conf_from_db: 'true' pleroma_allow_relay: 'true' +pleroma_nickname_format: 'false' pleroma_remote_post_retention: '90' pleroma_db_host: "localhost" pleroma_db_superuser: "postgres" @@ -55,49 +56,30 @@ pleroma_admin: 'true' pleroma_admin_user: 'admin' pleroma_admin_email: 'admin@example.lan' pleroma_admin_password: 'changeme' -pleroma_download_url: "https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/stable/download?job={{pleroma_arch}}" +pleroma_download_url: 'https://akkoma-updates.s3-website.fr-par.scw.cloud/stable/akkoma-{{ pleroma_arch }}.zip' #akkoma +#pleroma_download_url: "https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/stable/download?job={{pleroma_arch}}" #pleroma pleroma_arch: 'amd64' pleroma_nofile: '500000' pleroma_instance_favicons: 'true' pleroma_remoteip: 'true' pleroma_proxies: '["192.168.33.15"]' -pleroma_soapbox: false -pleroma_soapbox_version: "develop" -pleroma_soapbox_download_url: "https://gitlab.com/soapbox-pub/soapbox/-/jobs/artifacts/{{ pleroma_soapbox_version }}/download?job=build-production" - pleroma_custom_emoji: 'true' pleroma_custom_emoji_list: - name: 'blobbear' url: 'https://labo.lacoloc.cafe/june/blobbears/raw/branch/master/manifest.json' - name: 'blobcat' url: 'https://fedi.absturztau.be/emoji-packs/manifest.json' -#soapbox -pleroma_soapbox_logo: '/images/logo.png' -pleroma_soapbox_brandcolor: '#0482d8' -pleroma_soapbox_promopanel: - - text: 'Our Site stats' - icon: 'area-chart' - url: 'https://fediverse.network/example.com' - - text: 'Our Site blog' - icon: 'comment-o' - url: 'https://blog.example.com' -pleroma_soapbox_gif: 'false' -pleroma_soapbox_thememode: 'light' -pleroma_soapbox_copyright: '♡2020. Copying is an act of love. Please copy and share.' -pleroma_soapbox_footer: - - name: 'About' - url: '/about' - - name: 'Terms of Service' - url: '/about/tos' - - name: 'Privacy Policy' - url: '/about/privacy' - - name: 'Source code' - url: '/about#opensource' - -pleroma_soapbox_redirects: 'false' #set to true if you want to redirect footer page links to another site -#pleroma_soap_about: 'https://example.com/about' -#pleroma_soap_tos: 'https://example.com/tos' -#pleroma_soap_pp: 'https://example/pp' +pleroma_frontends: + - name: 'mangane' + conf: 'primary' + ref: 'dist' + url: 'https://github.com/Cl0v1s/mangane-ui/releases/latest/download/static.zip' + - name: 'admin-fe' + conf: 'admin' + ref: 'develop' + - name: 'pleroma-fe' + conf: 'pleroma' + ref: 'develop' #Postgres postgresql_version: 13 diff --git a/files/favicon.png b/files/favicon.png new file mode 100644 index 0000000..e69de29 diff --git a/files/logo.svg b/files/logo.svg new file mode 100644 index 0000000..e69de29 diff --git a/tasks/configure.yml b/tasks/configure.yml index 989fd50..22350d6 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -37,6 +37,7 @@ - '{{ pleroma_data_dir }}/uploads' - '{{ pleroma_data_dir }}/static' - '{{ pleroma_data_dir }}/static/emoji' + - '{{ pleroma_data_dir }}/static/instance' - name: '[Config] - Install custom emoji packs' shell: '{{ pleroma_app_dir }}/release/bin/pleroma_ctl emoji get-packs {{ item.name }} -m {{ item.url }}' diff --git a/tasks/frontends.yml b/tasks/frontends.yml index 0a3ee6e..a016579 100644 --- a/tasks/frontends.yml +++ b/tasks/frontends.yml @@ -1,70 +1,38 @@ --- -- name: '[Soapbox] - delete tmp pleroma dir' - file: - path: "{{ pleroma_tmp_dir }}" - state: '{{ item }}' - with_items: - - absent - - directory -- name: '[Soapbox] - download and unarchive soapbox' - unarchive: - src: '{{ pleroma_soapbox_download_url }}' - dest: '{{ pleroma_tmp_dir }}' - creates: '{{ pleroma_tmp_dir }}/static' - remote_src: yes +- name: '[Frontends] - Make sure pleroma is up and running' + systemd: + name: 'pleroma.service' + state: 'started' + +- name: '[Frontend] - Install/update known frontends' + command: '{{ pleroma_app_dir }}/release/bin/pleroma_ctl frontend install {{ item.name }} --ref {{ item.ref }}' + become: yes + become_user: '{{ pleroma_user }}' + with_items: '{{ pleroma_frontends }}' + when: 'item.url is not defined' -- name: '[Soapbox] - delete old soapbox' - file: - path: "{{ pleroma_data_dir }}/static/" - state: "absent" +- name: '[Frontend] - Install/update custom frontends' + command: '{{ pleroma_app_dir }}/release/bin/pleroma_ctl frontend install {{ item.name }} --ref {{ item.ref }} --build-url {{ item.url }}' + become: yes + become_user: '{{ pleroma_user }}' + with_items: '{{ pleroma_frontends }}' + when: 'item.url is defined' -- name: '[Soapbox] - install soapbox' - copy: - remote_src: true - src: '{{ pleroma_tmp_dir }}/static/' - dest: '{{ pleroma_data_dir }}/static/' - owner: '{{ pleroma_user }}' - group: '{{ pleroma_group }}' - mode: "0755" - -- name: '[Soapbox] - install soapbox config' - template: - src: 'soapbox.json.j2' - dest: '{{ pleroma_data_dir }}/static/instance/soapbox.json' - owner: '{{ pleroma_user }}' - group: '{{ pleroma_group }}' - mode: "0755" - -- name: '[Soapbox] - Create about dir' - file: - path: '{{ pleroma_data_dir }}/static/instance/about' - state: directory - -- name: '[ Soapbox] - Deploy about redirects' - template: - src: 'about/soapbox.{{ item }}.html.j2' - dest: '{{ pleroma_data_dir }}/static/instance/about/{{ item }}.html' - with_items: - - index - - privacy - - tos - when: pleroma_soapbox_redirects is defined and pleroma_soapbox_redirects == 'true' - -- name: '[Soapbox] - Create images dir' +- name: '[Frontend] - Create images dir' file: path: '{{ pleroma_data_dir }}/static/images' state: directory -- name: '[Soapbox] - Add instance logo' +- name: '[Frontend] - Add instance logo' copy: - src: '{{ pleroma_extra_files_path }}/logo.png' - dest: '{{ pleroma_data_dir }}/static/images/logo.png' + src: '{{ pleroma_extra_files_path }}/logo.svg' + dest: '{{ pleroma_data_dir }}/static/instance/logo.svg' owner: '{{ pleroma_user }}' group: '{{ pleroma_group }}' mode: 0775 -- name: '[Soapbox] - Add instance favicon' +- name: '[Frontend] - Add instance favicon' copy: src: '{{ pleroma_extra_files_path }}/logo.png' dest: '{{ pleroma_data_dir }}/static/favicon.png' diff --git a/tasks/main.yml b/tasks/main.yml index 9e62497..d83668c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -26,4 +26,3 @@ - include: frontends.yml tags: - upgrade - - soapbox diff --git a/tasks/upgrade.yml b/tasks/upgrade.yml index 8fd7d2d..f1a8891 100644 --- a/tasks/upgrade.yml +++ b/tasks/upgrade.yml @@ -5,8 +5,19 @@ become: yes become_user: '{{ pleroma_user }}' +- name: '[Upgrade] - Stop backend' + systemd: + name: pleroma + state: 'stopped' + daemon_reload: 'yes' + - name: '[Upgrade] - Run migrations' command: '{{ pleroma_app_dir }}/release/bin/pleroma_ctl migrate' become: yes become_user: '{{ pleroma_user }}' +- name: '[Upgrade] - Start backend' + systemd: + name: pleroma + state: 'started' + daemon_reload: 'yes' diff --git a/templates/config.exs.j2 b/templates/config.exs.j2 index 83a27db..0203442 100644 --- a/templates/config.exs.j2 +++ b/templates/config.exs.j2 @@ -20,6 +20,7 @@ config :pleroma, :instance, invites_enabled: {{ pleroma_invites_enabled }}, static_dir: "{{ pleroma_data_dir }}/static/", allow_relay: {{ pleroma_allow_relay }}, + extended_nickname_format: {{ pleroma_nickname_format }}, remote_post_retention_days: "{{ pleroma_remote_post_retention }}" @@ -96,3 +97,11 @@ config :pleroma, :ldap, config :pleroma, :instances_favicons, enabled: {{ pleroma_instance_favicons }} +config :pleroma, :frontends, +{% for item in pleroma_frontends %} + {{ item.conf }}: %{ + "name" => "{{ item.name }}", + "ref" => "{{ item.ref }}" + }{% if not loop.last %}, +{% endif %} +{% endfor %} diff --git a/templates/soapbox.json.j2 b/templates/soapbox.json.j2 deleted file mode 100644 index add951c..0000000 --- a/templates/soapbox.json.j2 +++ /dev/null @@ -1,27 +0,0 @@ -{ -"logo": "{{ pleroma_soapbox_logo }}", -"brandColor": "{{ pleroma_soapbox_brandcolor }}", -"promoPanel": { - "items": [ -{% for item in pleroma_soapbox_promopanel %} - { - "icon": "{{ item.icon }}", - "text": "{{ item.text }}", - "url": "{{ item.url }}" - }{% if not loop.last %},{% endif %} -{% endfor %} - ] - }, - "defaultSettings": { - "autoPlayGif": {{ pleroma_soapbox_gif }}, - "themeMode": "{{ pleroma_soapbox_thememode }}" - }, - "copyright": "{{ pleroma_soapbox_copyright }}", - "navlinks": { - "homeFooter": [ -{% for item in pleroma_soapbox_footer %} - { "title": "{{ item.name }}", "url": "{{ item.url }}" }{% if not loop.last %},{% endif %} -{% endfor %} - ] - } -}