Clark Boylan 39d8d6ffb5 Update etherpad to 2.2.4
There are 2.2.0 and 2.2.1 tags but no built releases and they don't show
up in the changelog for 2.2.2 either. Thats fine we can ignore them and
upgrade to latest (2.2.4) instead. The changelog for 2.2.4 can be found
here:

  https://github.com/ether/etherpad-lite/blob/v2.2.4/CHANGELOG.md

Notable this changes how plugins are loaded into the js shipped to the
browser. We should confirm that our plugins are working as expected as
part of this update.

On the config management side of things there are some small updates to
the Dockerfile to sync up with upstream changes to how etherpad is
built. We also update the settings json file to configure log type. Note
this change was only made to the normal settings file and not the docker
settings file upstream so we match that in this change as well.

Finally we also update our mod_rewrite rules in apache to prevent new
javascript loading locations from being redirected to /p/
inappropriately. Previously we were redirecting foo.min.js to
/p/foo.min.js which caused the server to return html instead of js which
led to syntax errors. This then resulted in js errors from the
ep_headings plugin. It appears this plugin is ancient and no longer
maintained and seems to rely on require() functionality that was removed
from etherpad in 2.2.2. We switch to the ep_headings2 plugin instead.
This will allow us to file bugs against maintained software should
problems persist.

Fungi tested ep_headings2 against our production db content and things
seem to work despite this issue existing [0]. We should upgrade
carefully but it seems like things will likely be functional.

We should also check if these redirect rules affect meetpad as well. But
this can likely be done after the upgrade.

[0] https://github.com/ether/ep_headings2/issues/4

Change-Id: I4a907b5170d3612f4525153a0a07c291d6481a92
2024-09-09 08:45:36 -07:00

157 lines
3.5 KiB
YAML

- name: Ensure docker-compose directory exists
file:
state: directory
path: /etc/etherpad-docker
- name: Write settings file
template:
src: docker-compose.yaml.j2
dest: /etc/etherpad-docker/docker-compose.yaml
- name: Ensure database volume exists
file:
state: directory
path: /var/etherpad/db
- name: Ensure config directory exists
file:
state: directory
path: /etc/etherpad
- name: Ensure db config directory exists
file:
state: directory
path: /etc/etherpad/mysql
- name: Install database config settings
copy:
src: my.cnf
dest: /etc/etherpad/mysql/my.cnf
- name: Make directory for robots.txt
file:
path: /var/etherpad/www
state: directory
- name: Install robots.txt
copy:
src: robots.txt
dest: /var/etherpad/www/robots.txt
- name: Install apache2
apt:
name:
- apache2
- apache2-utils
state: present
- name: Apache modules
apache2_module:
state: present
name: "{{ item }}"
loop:
- rewrite
- proxy
- proxy_http
- ssl
- headers
- proxy_wstunnel
- name: Copy apache tuning
copy:
src: apache-connection-tuning
dest: /etc/apache2/conf-enabled/connection-tuning.conf
owner: root
group: root
mode: 0644
notify: etherpad Reload apache2
- name: Copy apache config
template:
src: etherpad.vhost.j2
dest: /etc/apache2/sites-enabled/000-default.conf
owner: root
group: root
mode: 0644
notify: etherpad Reload apache2
- name: Copy redirect config
template:
src: redirect.vhost.j2
dest: "/etc/apache2/sites-enabled/010-{{ etherpad_redirect_vhost }}.conf"
owner: root
group: root
mode: 0644
when: etherpad_redirect_vhost is defined
notify: etherpad Reload apache2
- name: Write settings file
template:
src: settings.json.j2
dest: /etc/etherpad/settings.json
owner: 5001
group: 5001
mode: '0440'
- name: Remove npm
package:
name:
- npm
state: absent
- name: Run docker-compose pull
shell:
cmd: docker-compose pull
chdir: /etc/etherpad-docker/
- name: Run docker-compose up
shell:
cmd: docker-compose up -d
chdir: /etc/etherpad-docker/
- name: Run docker prune to cleanup unneeded images
shell:
cmd: docker image prune -f
- name: Create db backup dest
file:
state: directory
path: /var/backups/etherpad-mariadb
mode: 0700
owner: root
group: root
- name: Set up cron job for local database backup
cron:
name: etherpad-db-backup
state: present
user: root
job: >
/usr/local/bin/docker-compose -f /etc/etherpad-docker/docker-compose.yaml exec -T mariadb
bash -c '/usr/bin/mysqldump --opt --databases etherpad-lite --single-transaction -uroot -p"$MYSQL_ROOT_PASSWORD"' |
gzip -9 > /var/backups/etherpad-mariadb/etherpad-mariadb.sql.gz
minute: 42
hour: 4
- name: Rotate db backups
include_role:
name: logrotate
vars:
logrotate_rotate: 2
logrotate_file_name: /var/backups/etherpad-mariadb/etherpad-mariadb.sql.gz
logrotate_compress: false
- name: Setup db backup streaming job
block:
- name: Create backup streaming config dir
file:
path: /etc/borg-streams
state: directory
- name: Create db streaming file
copy:
content: >-
/usr/local/bin/docker-compose -f /etc/etherpad-docker/docker-compose.yaml exec -T mariadb
bash -c '/usr/bin/mysqldump --skip-extended-insert --databases etherpad-lite --single-transaction -uroot -p"$MYSQL_ROOT_PASSWORD"'
dest: /etc/borg-streams/mysql