From 48bd3bf10ec92cdb9b862783fa8c8ff13bff7efb Mon Sep 17 00:00:00 2001 From: muppeth Date: Mon, 13 May 2024 22:49:52 +0200 Subject: [PATCH] Update to 2.0.2 (#19) Bookworm requires npm as seperate package. Co-authored-by: meaz Reviewed-on: https://git.disroot.org/Disroot-Ansible/etherpad/pulls/19 Reviewed-by: meaz Co-authored-by: muppeth Co-committed-by: muppeth --- README.MD | 8 ++++++++ Vagrantfile | 2 +- defaults/main.yml | 6 ++++-- tasks/configure.yml | 4 ++-- tasks/install.yml | 18 ++++++++++++++++++ tasks/installdeps.yml | 14 ++++++++++---- tasks/main.yml | 13 ++++++++----- tasks/modules.yml | 14 +------------- .../etc/systemd/system/etherpad.service.j2 | 2 +- .../var/www/etherpad-lite/settings.json.j2 | 2 +- 10 files changed, 54 insertions(+), 29 deletions(-) create mode 100644 tasks/install.yml diff --git a/README.MD b/README.MD index 531322d..89d7da7 100644 --- a/README.MD +++ b/README.MD @@ -14,8 +14,16 @@ Then you can access etherpad from your computer on http://192.168.33.8:9001 ## Playbook The playbook includes mariadb role and deploys entire stack needed to run Etherpad-lite. Additional role is also available in the Ansible roles repos in git. +## Tags +You can use tags when you deploy: +- `config`: to deploy just config +- `modules`: to deploy modules + +⚠ Since the v.2.0.2, modules can only be installed, not removed. The devs are working on this: https://github.com/ether/etherpad-lite/issues/6272 So if you need to remove a plugin, log into the admin interface. + ## CHANGELOG +- **14.04.2024** - Bumped version to 2.0.2 and change from npm to pnpm - **26.03.2021** - Bumped version to 1.8.13 and enable ep_adminpads2 - **04.03.2021** - Bumped version to 1.8.11 and adjusted readme file - **21.11.2020** - Make it ready for public release diff --git a/Vagrantfile b/Vagrantfile index 4bc00a9..34773e4 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -8,7 +8,7 @@ Vagrant.configure("2") do |config| #config.ssh.insert_key = false config.vm.define "etherpad" do |etherpad| - etherpad.vm.box = "generic/debian11" + etherpad.vm.box = "generic/debian12" etherpad.vm.provider :libvirt do |libvirt| libvirt.memory = 256 end diff --git a/defaults/main.yml b/defaults/main.yml index 45d8b56..2f1090e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,6 @@ --- -etherpad_version: '1.9.7' +etherpad_version: '2.0.2' etherpad_skin: 'colibris' etherpad_skinVariants: 'super-light-toolbar super-light-editor light-background' etherpad_username: 'etherpad' @@ -50,12 +50,14 @@ etherpad_smtp_host: 'localhost' etherpad_smtp_port: '587' etherpad_smtp_user: 'support' etherpad_smtp_pass: 'changeme' -etherpad_nodejs_version: '18' +etherpad_nodejs_version: '21' etherpad_apt: - curl - nodejs - git +etherpad_admin_page: 'true' # set to something else if you don't want to build admin page + etherpad_plugins_list: ep_adminpads2: enabled ep_comments_page: enabled diff --git a/tasks/configure.yml b/tasks/configure.yml index 563558a..8f7d227 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -7,7 +7,7 @@ owner: "{{ etherpad_username }}" group: "{{ etherpad_group }}" mode: 0755 - tags: configuration + tags: config - name: '[CONFIGURE] - Deploy config' template: @@ -18,4 +18,4 @@ mode: 0644 notify: restart etherpad - tags: configuration + tags: config diff --git a/tasks/install.yml b/tasks/install.yml new file mode 100644 index 0000000..c7fb44c --- /dev/null +++ b/tasks/install.yml @@ -0,0 +1,18 @@ +--- + +- name: '[INSTALL] - Install with pnpm' + shell: + cmd: pnpm install + args: + chdir: "{{ etherpad_app_dir }}/app" + become: yes + become_user: "{{ etherpad_username }}" + +- name: '[INSTALL] - Build admin pages with pnpm' + shell: + cmd: pnpm run build + args: + chdir: "{{ etherpad_app_dir }}/app/admin" + become: yes + become_user: "{{ etherpad_username }}" + when: etherpad_admin_page == "true" \ No newline at end of file diff --git a/tasks/installdeps.yml b/tasks/installdeps.yml index 8eb6676..3264edd 100644 --- a/tasks/installdeps.yml +++ b/tasks/installdeps.yml @@ -1,18 +1,24 @@ --- -- name: '[INSTALLDEPS] - Add Nodesource apt key.' +- name: '[INSTALL] - Add Nodesource apt key.' apt_key: - url: https://keyserver.ubuntu.com/pks/lookup?op=get&fingerprint=on&search=0x1655A0AB68576280 - id: "68576280" + url: https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key state: present - name: '[INSTALLDEPS] - Add repository for nodejs' apt_repository: - repo: deb https://deb.nodesource.com/node_{{ etherpad_nodejs_version }}.x {{ ansible_distribution_release }} main + repo: deb https://deb.nodesource.com/node_{{ etherpad_nodejs_version }}.x nodistro main state: present + update_cache: yes filename: 'nodesource' - name: '[INSTALLDEPS] - Install dependencies' apt: name: "{{ etherpad_apt }}" update_cache: yes + state: latest + +- name: '[INSTALLDEPS] - Install pnpm' + npm: + name: pnpm + global: true \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index 635aa20..6609e64 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -11,15 +11,18 @@ - name: Deploy configuration include_tasks: configure.yml - tags: configuration - -- name: Install Modules - include_tasks: modules.yml - tags: modules + tags: config - name: Use abiword include_tasks: abiword.yml when: etherpad_abiword != 'null' +- name: Install etherpad + include_tasks: install.yml + +- name: Install Modules + include_tasks: modules.yml + tags: modules + - name: Systemd include_tasks: systemd.yml diff --git a/tasks/modules.yml b/tasks/modules.yml index d987bb6..419022c 100644 --- a/tasks/modules.yml +++ b/tasks/modules.yml @@ -5,24 +5,12 @@ # then uses filter to get all plugins names in one line, without comas or quotes as needed for npm - name: '[Modules] - Install modules' shell: - cmd: "npm install --no-save --legacy-peer-deps {{ etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'enabled') | map(attribute='key') |join(',') | replace(\",\", \" \") }}" + cmd: "pnpm run install-plugins {{ etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'enabled') | map(attribute='key') |join(',') | replace(\",\", \" \") }}" args: chdir: "{{ etherpad_app_dir }}/app" become: yes become_user: "{{ etherpad_username }}" when: etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'enabled') |length > 0 - notify: - restart etherpad - tags: modules - -- name: '[Modules] - Uninstall modules' - shell: - cmd: "npm uninstall {{ etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'disabled') | map(attribute='key') |join(',') | replace(\",\", \" \") }}" - args: - chdir: "{{ etherpad_app_dir }}/app" - become: yes - become_user: "{{ etherpad_username }}" - when: etherpad_plugins_list| dict2items | selectattr('value', 'eq', 'disabled') |length > 0 notify: restart etherpad tags: modules \ No newline at end of file diff --git a/templates/etc/systemd/system/etherpad.service.j2 b/templates/etc/systemd/system/etherpad.service.j2 index 2b10087..81452fe 100644 --- a/templates/etc/systemd/system/etherpad.service.j2 +++ b/templates/etc/systemd/system/etherpad.service.j2 @@ -8,7 +8,7 @@ User={{ etherpad_username }} Group={{ etherpad_group }} WorkingDirectory={{ etherpad_app_dir }}/app Environment=NODE_ENV=production -ExecStart={{ etherpad_app_dir }}/app/bin/run.sh +ExecStart=pnpm run prod StandardOutput=file:{{ etherpad_logfile }} Restart=always RestartSec=3 diff --git a/templates/var/www/etherpad-lite/settings.json.j2 b/templates/var/www/etherpad-lite/settings.json.j2 index 9f4e74b..5750f45 100644 --- a/templates/var/www/etherpad-lite/settings.json.j2 +++ b/templates/var/www/etherpad-lite/settings.json.j2 @@ -541,7 +541,7 @@ /* * Restrict socket.io transport methods */ - "socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"], + "socketTransportProtocols" : ["websocket", "polling"], "socketIo": { /*