2021-02-20 15:53:35 +00:00
|
|
|
version = node.metadata['pleroma']['version']
|
|
|
|
|
|
|
|
users = {
|
|
|
|
'pleroma': {
|
|
|
|
'home': '/opt/pleroma',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
directories = {
|
|
|
|
'/opt/pleroma': {},
|
|
|
|
'/var/pleroma': {
|
|
|
|
'owner': 'pleroma',
|
|
|
|
},
|
|
|
|
'/var/pleroma/uploads': {
|
|
|
|
'owner': 'pleroma',
|
|
|
|
},
|
|
|
|
'/var/pleroma/static': {
|
|
|
|
'owner': 'pleroma',
|
|
|
|
},
|
|
|
|
'/var/pleroma/static/emoji': {
|
|
|
|
'owner': 'pleroma',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
if node.has_bundle('zfs'):
|
|
|
|
directories['/var/pleroma']['needs'] = {
|
|
|
|
'zfs_dataset:tank/pleroma-data',
|
|
|
|
}
|
|
|
|
|
|
|
|
actions = {
|
|
|
|
'pleroma_download_release': {
|
|
|
|
'command': \
|
|
|
|
'cd /opt/pleroma/ && '\
|
2021-02-20 18:37:33 +00:00
|
|
|
f'wget -O/opt/pleroma/pleroma.zip https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/release/{version}/download?job=amd64 && '\
|
2021-02-20 15:53:35 +00:00
|
|
|
'rm -rf release && '\
|
2021-02-20 18:37:33 +00:00
|
|
|
'unzip /opt/pleroma/pleroma.zip && '\
|
|
|
|
'chown -R pleroma:pleroma /opt/pleroma/release && '\
|
|
|
|
f'echo -n "{version}" > /opt/pleroma/.bundlewrap_installed_version',
|
2021-02-20 15:53:35 +00:00
|
|
|
'unless': f'[ "$(cat /opt/pleroma/.bundlewrap_installed_version)" = "{version}" ]',
|
|
|
|
'needs': {
|
|
|
|
'directory:/opt/pleroma',
|
|
|
|
},
|
2021-02-20 18:37:33 +00:00
|
|
|
'preceded_by': {
|
|
|
|
'svc_systemd:pleroma:stop',
|
|
|
|
},
|
|
|
|
'triggers': {
|
|
|
|
'action:pleroma_migrate_database',
|
|
|
|
'svc_systemd:pleroma:restart',
|
|
|
|
},
|
2021-02-20 15:53:35 +00:00
|
|
|
},
|
2021-02-20 18:37:33 +00:00
|
|
|
'pleroma_migrate_database': {
|
2021-02-20 15:53:35 +00:00
|
|
|
'triggered': True,
|
2021-02-20 18:37:33 +00:00
|
|
|
'command': \
|
|
|
|
'echo "CREATE EXTENSION IF NOT EXISTS citext;" | psql pleroma && '\
|
|
|
|
'echo "CREATE EXTENSION IF NOT EXISTS pg_trgm;" | psql pleroma && '\
|
|
|
|
'echo "CREATE EXTENSION IF NOT EXISTS \\\"uuid-ossp\\\";" | psql pleroma && '\
|
|
|
|
'sudo -u pleroma PLEROMA_CONFIG_PATH=/opt/pleroma/pleroma.config.exs /opt/pleroma/release/bin/pleroma_ctl create',
|
|
|
|
'needs': {
|
2021-02-20 15:53:35 +00:00
|
|
|
'postgres_db:pleroma',
|
|
|
|
},
|
2021-02-20 18:37:33 +00:00
|
|
|
},
|
2021-02-20 15:53:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
files = {
|
2021-02-20 18:37:33 +00:00
|
|
|
'/etc/systemd/system/pleroma.service': {
|
|
|
|
'triggers': {
|
|
|
|
'action:systemd-reload',
|
|
|
|
'svc_systemd:pleroma:restart',
|
|
|
|
},
|
|
|
|
},
|
2021-02-20 15:53:35 +00:00
|
|
|
'/opt/pleroma/pleroma.config.exs': {
|
|
|
|
'content_type': 'mako',
|
2021-02-20 18:37:33 +00:00
|
|
|
'triggers': {
|
|
|
|
'svc_systemd:pleroma:restart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
svc_systemd = {
|
|
|
|
'pleroma': {
|
|
|
|
'needs': {
|
|
|
|
'action:pleroma_download_release',
|
|
|
|
'action:pleroma_migrate_database',
|
|
|
|
'file:/etc/systemd/system/pleroma.service',
|
|
|
|
'file:/opt/pleroma/pleroma.config.exs',
|
|
|
|
},
|
2021-02-20 15:53:35 +00:00
|
|
|
},
|
|
|
|
}
|