Merge pull request 'Switched to akkoma' (#7) from akkoma into main

Reviewed-on: #7
Reviewed-by: meaz <meaz@no-reply@disroot.org>
This commit is contained in:
muppeth 2023-01-30 15:36:28 +00:00
commit 5ae3d33569
11 changed files with 83 additions and 127 deletions

View File

@ -1,6 +1,6 @@
# Pleroma role # Pleroma/Akkoma 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). 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 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. 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`

2
Vagrantfile vendored
View File

@ -15,6 +15,6 @@ Vagrant.configure("2") do |config|
pleroma.vm.network "forwarded_port", guest: 80, host: 8888, host_ip: "192.168.33.15" pleroma.vm.network "forwarded_port", guest: 80, host: 8888, host_ip: "192.168.33.15"
pleroma.vm.network "forwarded_port", guest: 443, host: 4443, host_ip: "192.168.33.15" pleroma.vm.network "forwarded_port", guest: 443, host: 4443, host_ip: "192.168.33.15"
pleroma.vm.network "private_network", ip: "192.168.33.15" pleroma.vm.network "private_network", ip: "192.168.33.15"
config.vm.provision "shell", inline: "apt install acl"
end end
end end

View File

@ -42,62 +42,49 @@ pleroma_signup_open: "true"
pleroma_loglevel: ":debug" pleroma_loglevel: ":debug"
pleroma_conf_from_db: 'true' pleroma_conf_from_db: 'true'
pleroma_allow_relay: 'true' pleroma_allow_relay: 'true'
pleroma_nickname_format: 'false'
pleroma_remote_post_retention: '90' pleroma_remote_post_retention: '90'
pleroma_db_host: "localhost" pleroma_db_host: "localhost"
pleroma_db_superuser: "postgres" pleroma_db_superuser: "postgres"
pleroma_db_passwd: 'changeme' pleroma_db_passwd: 'changeme'
pleroma_db: "pleroma" pleroma_db: "pleroma"
pleroma_db_user: "admin" pleroma_db_user: "admin"
pleroma_data_dir: "/srv/pleroma_data/" pleroma_data_dir: "/srv/pleroma_data"
pleroma_smtp: 'false' pleroma_smtp: 'false'
pleroma_ldap: 'false' pleroma_ldap: 'false'
pleroma_admin: 'true' pleroma_admin: 'true'
pleroma_admin_user: 'admin' pleroma_admin_user: 'admin'
pleroma_admin_email: 'admin@example.lan' pleroma_admin_email: 'admin@example.lan'
pleroma_admin_password: 'changeme' 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_arch: 'amd64'
pleroma_nofile: '500000' pleroma_nofile: '500000'
pleroma_instance_favicons: 'true' pleroma_instance_favicons: 'true'
pleroma_remoteip: 'true' pleroma_remoteip: 'true'
pleroma_proxies: '["192.168.33.15"]' pleroma_proxies: '["192.168.33.15"]'
pleroma_soapbox: false
pleroma_soapbox_version: "develop"
pleroma_soapbox_download_url: "https://gitlab.com/soapbox-pub/soapbox-fe/-/jobs/artifacts/{{ pleroma_soapbox_version }}/download?job=build-production"
pleroma_custom_emoji: 'true' pleroma_custom_emoji: 'true'
pleroma_custom_emoji_list: pleroma_custom_emoji_list:
- name: 'blobbear' - name: 'blobbear'
url: 'https://labo.lacoloc.cafe/june/blobbears/raw/branch/master/manifest.json' url: 'https://labo.lacoloc.cafe/june/blobbears/raw/branch/master/manifest.json'
- name: 'blobcat' - name: 'blobcat'
url: 'https://fedi.absturztau.be/emoji-packs/manifest.json' url: 'https://fedi.absturztau.be/emoji-packs/manifest.json'
#soapbox pleroma_frontends:
pleroma_soapbox_logo: '/images/logo.png' - name: 'mangane'
pleroma_soapbox_brandcolor: '#0482d8' conf: 'primary'
pleroma_soapbox_promopanel: ref: 'dist'
- text: 'Our Site stats' url: 'https://github.com/Cl0v1s/mangane-ui/releases/latest/download/static.zip'
icon: 'area-chart' - name: 'admin-fe'
url: 'https://fediverse.network/example.com' conf: 'admin'
- text: 'Our Site blog' ref: 'develop'
icon: 'comment-o' - name: 'pleroma-fe'
url: 'https://blog.example.com' conf: 'pleroma'
pleroma_soapbox_gif: 'false' ref: 'develop'
pleroma_soapbox_thememode: 'light' # If you want to upload custom config files for frontends, specify below using the example
pleroma_soapbox_copyright: '♡2020. Copying is an act of love. Please copy and share.' #pleroma_frontend_custom_configs:
pleroma_soapbox_footer: # - name: 'mangane'
- name: 'About' # filename: 'soapbox.json'
url: '/about' # confpath: 'static/instance/soapbox.json'
- 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'
#Postgres #Postgres
postgresql_version: 13 postgresql_version: 13

0
files/favicon.png Normal file
View File

0
files/logo.svg Normal file
View File

View File

@ -37,6 +37,7 @@
- '{{ pleroma_data_dir }}/uploads' - '{{ pleroma_data_dir }}/uploads'
- '{{ pleroma_data_dir }}/static' - '{{ pleroma_data_dir }}/static'
- '{{ pleroma_data_dir }}/static/emoji' - '{{ pleroma_data_dir }}/static/emoji'
- '{{ pleroma_data_dir }}/static/instance'
- 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 }}'

View File

@ -1,73 +1,51 @@
--- ---
- name: '[Soapbox] - delete tmp pleroma dir'
file:
path: "{{ pleroma_tmp_dir }}"
state: '{{ item }}'
with_items:
- absent
- directory
- name: '[Soapbox] - download and unarchive soapbox' - name: '[Frontends] - Make sure pleroma is up and running'
unarchive: systemd:
src: '{{ pleroma_soapbox_download_url }}' name: 'pleroma.service'
dest: '{{ pleroma_tmp_dir }}' state: 'started'
creates: '{{ pleroma_tmp_dir }}/static'
remote_src: yes - 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' - name: '[Frontend] - Install/update custom frontends'
file: command: '{{ pleroma_app_dir }}/release/bin/pleroma_ctl frontend install {{ item.name }} --ref {{ item.ref }} --build-url {{ item.url }}'
path: "{{ pleroma_data_dir }}/static/" become: yes
state: "absent" become_user: '{{ pleroma_user }}'
with_items: '{{ pleroma_frontends }}'
when: 'item.url is defined'
- name: '[Soapbox] - install soapbox' - name: '[Frontend] - Create images dir'
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'
file: file:
path: '{{ pleroma_data_dir }}/static/images' path: '{{ pleroma_data_dir }}/static/images'
state: directory state: directory
- name: '[Soapbox] - Add instance logo' - name: '[Frontend] - Add instance logo'
copy: copy:
src: '{{ pleroma_extra_files_path }}/logo.png' src: '{{ pleroma_extra_files_path }}/logo.svg'
dest: '{{ pleroma_data_dir }}/static/images/logo.png' dest: '{{ pleroma_data_dir }}/static/instance/logo.svg'
owner: '{{ pleroma_user }}' owner: '{{ pleroma_user }}'
group: '{{ pleroma_group }}' group: '{{ pleroma_group }}'
mode: 0775 mode: 0775
- name: '[Soapbox] - Add instance favicon' - name: '[Frontend] - Add instance favicon'
copy: copy:
src: '{{ pleroma_extra_files_path }}/logo.png' src: '{{ pleroma_extra_files_path }}/logo.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 }}'
mode: 0775 mode: 0775
- name: '[Frontend] - Add custom configs'
copy:
src: '{{pleroma_extra_files_path }}/{{ item.name }}/{{ item.filename }}'
dest: '{{ pleroma_data_dir }}/static/frontends/{{ item.name }}/{{ item.confpath }}'
owner: '{{ pleroma_user }}'
group: '{{ pleroma_group }}'
mode: 0775
loop: '{{ pleroma_frontend_custom_configs }}'
when: 'pleroma_frontend_custom_configs is defined'

View File

@ -1,10 +1,10 @@
--- ---
- include: user.yml - include_tasks: user.yml
- include: installdeps.yml - include_tasks: installdeps.yml
- include: configure.yml - include_tasks: configure.yml
tags: tags:
- upgrade - upgrade
@ -13,17 +13,14 @@
path: '{{ pleroma_app_dir }}/release' path: '{{ pleroma_app_dir }}/release'
register: pleroma_release register: pleroma_release
- name: '[Main] - Install pleroma' - include_tasks: install.yml
include_tasks: install.yml
when: pleroma_release.stat.exists == False when: pleroma_release.stat.exists == False
- name: '[Main] - Upgrade pleroma' - include_tasks: upgrade.yml
include_tasks: upgrade.yml
tags: tags:
- upgrade - upgrade
- never - never
- include: frontends.yml - include_tasks: frontends.yml
tags: tags:
- upgrade - upgrade
- soapbox

View File

@ -5,8 +5,19 @@
become: yes become: yes
become_user: '{{ pleroma_user }}' become_user: '{{ pleroma_user }}'
- name: '[Upgrade] - Stop backend'
systemd:
name: pleroma
state: 'stopped'
daemon_reload: 'yes'
- name: '[Upgrade] - Run migrations' - name: '[Upgrade] - Run migrations'
command: '{{ pleroma_app_dir }}/release/bin/pleroma_ctl migrate' command: '{{ pleroma_app_dir }}/release/bin/pleroma_ctl migrate'
become: yes become: yes
become_user: '{{ pleroma_user }}' become_user: '{{ pleroma_user }}'
- name: '[Upgrade] - Start backend'
systemd:
name: pleroma
state: 'started'
daemon_reload: 'yes'

View File

@ -20,6 +20,7 @@ config :pleroma, :instance,
invites_enabled: {{ pleroma_invites_enabled }}, invites_enabled: {{ pleroma_invites_enabled }},
static_dir: "{{ pleroma_data_dir }}/static/", static_dir: "{{ pleroma_data_dir }}/static/",
allow_relay: {{ pleroma_allow_relay }}, allow_relay: {{ pleroma_allow_relay }},
extended_nickname_format: {{ pleroma_nickname_format }},
remote_post_retention_days: "{{ pleroma_remote_post_retention }}" 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, :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 %}

View File

@ -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 %}
]
}
}