Merge pull request 'Set Mangane config from role' (#15) from logo into main

Reviewed-on: #15
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
This commit is contained in:
meaz 2023-11-28 20:16:18 +00:00
commit a008c07a03
9 changed files with 193 additions and 16 deletions

View File

@ -1,6 +1,7 @@
# Pleroma/Akkoma role # 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). Pleroma/Akkoma role 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.
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. You can deploy test instance using `Vagrantfile` attached to the role.
`vagrant up` `vagrant up`
@ -11,5 +12,14 @@ Then you can then access gitea from your computer on `http://192.168.33.15`
To update pleroma include `upgrade` **tag**. To update pleroma include `upgrade` **tag**.
## Frontend
This role also deploys Mangane as the default frontend (this can be changed with `pleroma_frontends` var). Mangane can be configured in `defaults/main.yml` (See the `# Mangane vars` section).
⚠️ If you have already deployed Mangane and have changed config from http://192.168.33.15/soapbox/config then you have to first remove this config from DB with `sudo -u pleroma /opt/pleroma/release/bin/pleroma_ctl config delete pleroma frontend_configurations`. Then run the role with `ansible-playbook -b Playbooks/pleroma.yml --tags upgrade`
## Customization ## Customization
In the `files` folder, `avi.png` is the default user avatar. In the `files` folder, `avi.png` is the default user avatar. You can also changes logo that you can find there.
If you have already deployed but want to do any change, like change logo, avatar or a config, then run the role with `ansible-playbook -b Playbooks/pleroma.yml --tags upgrade`.

View File

@ -5,6 +5,7 @@ pleroma_user: 'pleroma'
pleroma_group: 'pleroma' pleroma_group: 'pleroma'
pleroma_tmp_dir: '/tmp/pleroma/' pleroma_tmp_dir: '/tmp/pleroma/'
pleroma_app_dir: '/opt/pleroma' pleroma_app_dir: '/opt/pleroma'
pleroma_config_dir: '/etc/pleroma'
pleroma_apt_list: pleroma_apt_list:
- 'libmagic-dev' - 'libmagic-dev'
@ -20,19 +21,18 @@ pleroma_apt_list:
- 'libimage-exiftool-perl' - 'libimage-exiftool-perl'
- 'unzip' - 'unzip'
pleroma_host: "192.168.33.15" pleroma_host: "192.168.33.15"
pleroma_port: 4000 pleroma_port: 4000
pleroma_scheme: "http" pleroma_scheme: "http"
pleroma_proxy_pass: "{{ pleroma_scheme }}://{{ pleroma_host }}:{{ pleroma_port }}" pleroma_proxy_pass: "{{ pleroma_scheme }}://{{ pleroma_host }}:{{ pleroma_port }}"
pleroma_config_dir: '/etc/pleroma'
# Configuration vars set in config.exs
pleroma_link_host: "192.168.33.15" pleroma_link_host: "192.168.33.15"
pleroma_link_port: "80" pleroma_link_port: "80"
pleroma_link_scheme: "http" pleroma_link_scheme: "http"
pleroma_https: 'false' pleroma_https: 'false'
pleroma_config_dir: '/etc/pleroma'
pleroma_instance_name: "{{ pleroma_link_host }}" pleroma_instance_name: "{{ pleroma_link_host }}"
pleroma_secret_key: 'CDPbJ/+rD8hd27Hcw8igvGwyIDoS/J1isK4noJOybqfCuNuW9GDm0QNiW7syrGsHQQkTTSkzSZkAlKTqdnUahQ==' #openssl rand -base64 64 | paste --delimiters '' --serial pleroma_secret_key: 'CDPbJ/+rD8hd27Hcw8igvGwyIDoS/J1isK4noJOybqfCuNuW9GDm0QNiW7syrGsHQQkTTSkzSZkAlKTqdnUahQ==' #openssl rand -base64 64 | paste --delimiters '' --serial
pleroma_invites_enabled: 'false' pleroma_invites_enabled: 'false'
@ -72,7 +72,7 @@ pleroma_custom_emoji_list:
url: 'https://fedi.absturztau.be/emoji-packs/manifest.json' url: 'https://fedi.absturztau.be/emoji-packs/manifest.json'
pleroma_frontends: pleroma_frontends:
- name: 'mangane' - name: 'mangane'
conf: 'primary' conf: 'primary' # primary means the frontend that will be served by default for general requests
ref: 'dist' ref: 'dist'
url: 'https://github.com/BDX-town/Mangane/releases/latest/download/static.zip' url: 'https://github.com/BDX-town/Mangane/releases/latest/download/static.zip'
- name: 'admin-fe' - name: 'admin-fe'
@ -81,11 +81,13 @@ pleroma_frontends:
- name: 'pleroma-fe' - name: 'pleroma-fe'
conf: 'pleroma' conf: 'pleroma'
ref: 'develop' ref: 'develop'
# If you want to upload custom config files for frontends, specify below using the example # If you want to upload custom config files for frontends, specify below using the example
#pleroma_frontend_custom_configs: #pleroma_frontend_custom_configs:
# - name: 'mangane' # - name: 'mangane'
# filename: 'soapbox.json' # filename: 'soapbox.json'
# confpath: 'static/instance/soapbox.json' # confpath: 'static/instance/soapbox.json'
pleroma_mrf_simple: 'true' pleroma_mrf_simple: 'true'
pleroma_mrf_policies: pleroma_mrf_policies:
- policy: 'reject' - policy: 'reject'
@ -101,6 +103,20 @@ pleroma_mrf_policies:
- host: 'test.com' - host: 'test.com'
reason: 'reason 2' reason: 'reason 2'
# Mangane vars (used in config.exs)
mangane_authenticatedProfile: "true"
mangane_homeDescription: "This is the Exemple.org instance of Akkoma."
mangane_singleUserMode: "false"
mangane_brandColor: "#F24173"
mangane_accentColor: "#D00A42"
mangane_navlinks:
- title: 'Link to TOS'
url: 'https://example.org/tos'
- title: 'Link to PP'
url: 'https://example.org/pp'
mangane_copyright: "Soyons de bons humains."
#Postgres #Postgres
postgresql_version: 13 postgresql_version: 13
postgresql_listen_addresses: postgresql_listen_addresses:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
files/logo-512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 362.83 362.83">
<defs>
<style>
.cls-1 {
fill: #462d7a;
}
.cls-2 {
stroke: #2c1e50;
}
.cls-2, .cls-3 {
stroke-miterlimit: 10;
}
.cls-3 {
stroke: #fff;
}
</style>
</defs>
<g id="Layer_9" data-name="Layer 9">
<path class="cls-2" d="M269.3,197.19c-5.77-11.54-85.59,16.83-154.76,27.39-21.09,3.22-38.13,4.31-47.3,4.75-.74,2.91-1.76,7.02-2.87,11.97-1.93,8.6-2.89,12.89-2.6,13.78,3.3,9.95,59.73-.88,99.18-7.64,32.67-5.6,115.14-18.96,114.61-30.77-.03-.69-1.11-4.01-3.27-10.65-1.78-5.47-2.67-8.2-2.98-8.83Z"/>
</g>
<g id="Layer_6" data-name="Layer 6">
<path class="cls-1" d="M115.2,131.89c6.26-6.54,20.19-20.63,42.39-26.14,15.79-3.92,28.51-1.28,33.51,0,83.72,21.41,116.03,201.78,77.79,226.32-10.28,6.6-26.86,2.7-36.77-3.3-32.63-19.78-29.3-72.87-44.44-73.73-5.11-.29-7.15,5.8-20.91,24.94-19.63,27.3-31.49,43.44-49.21,50.87-2.53,1.06-26.91,12.07-41.84,1.23-38.55-28-2.96-155.84,39.49-200.18Zm56.31,10.45c-27.39-.52-46.38,38.21-37.98,54.55,10.09,19.62,65.5,18.26,74.77-3.3,7.21-16.78-11.38-50.77-36.79-51.24Z"/>
</g>
<g id="Layer_4" data-name="Layer 4">
<path d="M68.93,86.51c-6.55,27.74,252.45,113.97,267.56,89.66,9.24-14.87-64.9-83.62-163.53-97.57-39.06-5.52-100.95-5.14-104.03,7.91Z"/>
</g>
<g id="Layer_5" data-name="Layer 5">
<path class="cls-3" d="M138.96,93.76c.41-5.25,6.51-5.74,28.85-19.42,26.97-16.51,28.85-22.38,56.86-40.83,30.07-19.81,48.46-31.94,54.82-26.61,9.72,8.15-25.18,43.33-21.31,99.35,.87,12.61,3.12,17.79-.86,23.01-18.25,23.95-120.07-13.68-118.35-35.5Z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -4,4 +4,5 @@
systemd: systemd:
name: 'pleroma.service' name: 'pleroma.service'
state: 'restarted' state: 'restarted'
enabled: true
daemon_reload: 'yes' daemon_reload: 'yes'

View File

@ -13,12 +13,16 @@
# - '{{ pleroma_app_dir }}' # - '{{ pleroma_app_dir }}'
become: 'yes' become: 'yes'
become_user: "{{ pleroma_user }}" become_user: "{{ pleroma_user }}"
tags:
- upgrade
- name: '[Config] - Deploy systemd config' - name: '[Config] - Deploy systemd config'
template: template:
src: 'pleroma.service.j2' src: 'pleroma.service.j2'
dest: '/etc/systemd/system/pleroma.service' dest: '/etc/systemd/system/pleroma.service'
notify: restart pleroma notify: restart pleroma
tags:
- upgrade
- name: '[Config] - Deploy pleroma config' - name: '[Config] - Deploy pleroma config'
template: template:
@ -30,6 +34,8 @@
notify: restart pleroma notify: restart pleroma
become: 'yes' become: 'yes'
become_user: "{{ pleroma_user }}" become_user: "{{ pleroma_user }}"
tags:
- upgrade
- name: '[Config] - Create data directories' - name: '[Config] - Create data directories'
file: file:
@ -46,6 +52,8 @@
- '{{ pleroma_data_dir }}/static/instance' - '{{ pleroma_data_dir }}/static/instance'
become: 'yes' become: 'yes'
become_user: "{{ pleroma_user }}" become_user: "{{ pleroma_user }}"
tags:
- upgrade
- name: '[Config] - Install custom emoji packs' - name: '[Config] - Install custom emoji packs'
shell: '{{ pleroma_app_dir }}/release/bin/pleroma_ctl emoji get-packs {{ item.name }} -m {{ item.url }}' shell: '{{ pleroma_app_dir }}/release/bin/pleroma_ctl emoji get-packs {{ item.name }} -m {{ item.url }}'
@ -53,4 +61,5 @@
become_user: "{{ pleroma_user }}" become_user: "{{ pleroma_user }}"
with_items: "{{ pleroma_custom_emoji_list }}" with_items: "{{ pleroma_custom_emoji_list }}"
when: 'pleroma_custom_emoji == true' when: 'pleroma_custom_emoji == true'
tags:
- upgrade

View File

@ -37,10 +37,22 @@
become: yes become: yes
become_user: '{{ pleroma_user }}' become_user: '{{ pleroma_user }}'
- name: '[Frontend] - Add instance logo' - name: '[Frontend] - Create extra static dir'
file:
path: '{{ pleroma_data_dir }}/static/static'
state: directory
owner: '{{ pleroma_user }}'
group: '{{ pleroma_group }}'
mode: 0775
tags:
- upgrade
become: yes
become_user: '{{ pleroma_user }}'
- name: '[Frontend] - Add instance logo svg'
copy: copy:
src: '{{ pleroma_extra_files_path }}/logo.svg' src: '{{ pleroma_extra_files_path }}/logo.svg'
dest: '{{ pleroma_data_dir }}/static/instance/logo.svg' dest: '{{ pleroma_data_dir }}/static/static/logo.svg'
owner: '{{ pleroma_user }}' owner: '{{ pleroma_user }}'
group: '{{ pleroma_group }}' group: '{{ pleroma_group }}'
mode: 0775 mode: 0775
@ -48,10 +60,34 @@
- upgrade - upgrade
become: 'yes' become: 'yes'
become_user: "{{ pleroma_user }}" become_user: "{{ pleroma_user }}"
- name: '[Frontend] - Add instance favicon' - name: '[Frontend] - Add instance logo png'
copy: copy:
src: '{{ pleroma_extra_files_path }}/logo.png' src: '{{ pleroma_extra_files_path }}/logo.png'
dest: '{{ pleroma_data_dir }}/static/static/logo.png'
owner: '{{ pleroma_user }}'
group: '{{ pleroma_group }}'
mode: 0775
tags:
- upgrade
become: 'yes'
become_user: "{{ pleroma_user }}"
- name: '[Frontend] - Add PWA logo'
copy:
src: '{{ pleroma_extra_files_path }}/logo-512.png'
dest: '{{ pleroma_data_dir }}/static/static/logo-512.png'
owner: '{{ pleroma_user }}'
group: '{{ pleroma_group }}'
mode: 0775
tags:
- upgrade
become: 'yes'
become_user: "{{ pleroma_user }}"
- name: '[Frontend] - Add instance favicon'
copy:
src: '{{ pleroma_extra_files_path }}/favicon.png'
dest: '{{ pleroma_data_dir }}/static/favicon.png' dest: '{{ pleroma_data_dir }}/static/favicon.png'
owner: '{{ pleroma_user }}' owner: '{{ pleroma_user }}'
group: '{{ pleroma_group }}' group: '{{ pleroma_group }}'
@ -60,7 +96,7 @@
- upgrade - upgrade
become: 'yes' become: 'yes'
become_user: "{{ pleroma_user }}" become_user: "{{ pleroma_user }}"
- name: '[Frontend] - Add default user avatar' - name: '[Frontend] - Add default user avatar'
copy: copy:
src: '{{ pleroma_extra_files_path }}/avi.png' src: '{{ pleroma_extra_files_path }}/avi.png'
@ -75,7 +111,7 @@
- name: '[Frontend] - Add custom configs' - name: '[Frontend] - Add custom configs'
copy: copy:
src: '{{pleroma_extra_files_path }}/{{ item.name }}/{{ item.filename }}' src: '{{ pleroma_extra_files_path }}/{{ item.name }}/{{ item.filename }}'
dest: '{{ pleroma_data_dir }}/static/frontends/{{ item.name }}/{{ item.confpath }}' dest: '{{ pleroma_data_dir }}/static/frontends/{{ item.name }}/{{ item.confpath }}'
owner: '{{ pleroma_user }}' owner: '{{ pleroma_user }}'
group: '{{ pleroma_group }}' group: '{{ pleroma_group }}'

View File

@ -129,3 +129,74 @@ config :pleroma, :mrf_simple,
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% for item in pleroma_frontends %}
{% if item.name == "mangane" %}
config :pleroma, :frontend_configurations,
soapbox_fe: %{
verifiedIcon: "",
authenticatedProfile: {{ mangane_authenticatedProfile }},
linkFooterMessage: "", # this adds a message in the irght column once logged
homeDescription: "{{ mangane_homeDescription }}",
appleAppId: nil,
authProvider: "",
customCss: [],
gdprUrl: "",
customRegUrl: "",
cryptoDonatePanel: %{
limit: 1
},
singleUserModeProfile: "",
extensions: %{},
verifiedCanEditName: false,
quotePosts: true,
singleUserMode: {{ mangane_singleUserMode }},
brandColor: "{{ mangane_brandColor }}",
links: %{},
ads: [],
customRegProvider: "",
banner: "",
defaultSettings: %{},
aboutPages: %{},
navlinks: %{
homeFooter: [
{% for item in mangane_navlinks %}
%{
title: "{{ item.title }}",
url: "{{ item.url }}"
}{% if not loop.last %},
{% endif %}
{% endfor %}
]
},
promoPanel: %{
items: []
},
greentext: false,
allowedEmoji: [
"👍",
"❤️",
"😆",
"😮",
"😢",
"😩",
"👍",
"❤️",
"😆",
"😮",
"😢",
"😩"
],
accentColor: "{{ mangane_accentColor }}",
colors: %{},
logo: "/static/logo.svg",
{% set current_year = now().year %} # Allows to set the current year in copyright!
copyright: "🕶 {{ current_year|string }}. {{ mangane_copyright }}",
logoDarkMode: nil,
cryptoAddresses: [],
displayFqn: true,
mobilePages: %{},
gdpr: false
}
{% endif %}
{% endfor %}