Skip to content

Commit

Permalink
Merge pull request #99 from systemli/Add-Support-for-Etherpad-v2
Browse files Browse the repository at this point in the history
✨ Add Support for Etherpad v2
  • Loading branch information
0x46616c6b authored May 18, 2024
2 parents c7fdaa9 + 30fa65e commit 13e0948
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 22 deletions.
20 changes: 16 additions & 4 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ etherpad_trust_proxy: "false"
etherpad_cookie_same_site: "Lax"
etherpad_cookie_session_lifetime: 864000000 # = 10d * 24h/d * 60m/h * 60s/m * 1000ms/s
etherpad_cookie_session_refresh_interval: 864000000 # = 10d * 24h/d * 60m/h * 60s/m * 1000ms/s
etherpad_socket_transport_protocols:
["xhr-polling", "jsonp-polling", "htmlfile"]
etherpad_socket_transport_protocols: ["websocket", "polling"]
etherpad_load_test: "false"
etherpad_indentation_on_new_line: "false"
etherpad_automatic_reconnection_timeout: 0
Expand All @@ -96,6 +95,20 @@ etherpad_import_export_rate_limiting_max: 10
etherpad_import_max_file_size: 52428800 # 50 * 1024 * 1024
etherpad_custom_locale_strings: {}
etherpad_enable_admin_ui_tests: "false"
etherpad_lower_case_pad_ids: "false"
etherpad_authentication_method: "apikey" # or sso
etherpad_sso_issuer: "http://localhost:9001"
etherpad_sso_clients: []
# - client_id: "client_id"
# client_secret: "client_secret"
# grant_types: ["authorization_code"]
# response_types: ["code"]
# redirect_uris: ["http://localhost:9001/admin"]
etherpad_ttl_access_token: 3600
etherpad_ttl_authorization_code: 600
etherpad_ttl_client_credentials: 3600
etherpad_ttl_id_token: 3600
etherpad_ttl_refresh_token: 86400
etherpad_toolbar:
left:
- ["bold", "italic", "underline", "strikethrough"]
Expand Down Expand Up @@ -164,8 +177,7 @@ etherpad_headerauth_displayname_header: x-authenticated-name

# Change to "python-pymysql" on python2 systems
etherpad_python_mysql_package: "python3-mysqldb"

# Copy a custom logo file to src/static/
#etherpad_custom_logo_src:

etherpad_node_path: "/usr/bin/node"
etherpad_environment_path: "/usr/local/bin:/usr/bin:/bin:/usr/local/lib/npm/bin"
2 changes: 1 addition & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
roles:
- role: ansible-role-etherpad
vars:
etherpad_repository_version: 1.9.2
etherpad_repository_version: 2.0.3
etherpad_api_key: "secure_api_key"
etherpad_abiword_enabled: true
4 changes: 3 additions & 1 deletion molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@
ansible.builtin.include_role:
name: geerlingguy.nodejs
vars:
nodejs_version: 18.x
nodejs_version: 20.x
nodejs_install_npm_user: "root"
nodejs_npm_global_packages:
- name: pnpm
13 changes: 0 additions & 13 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@
register: etherpad_repository
notify: Restart etherpad-lite

- name: Install dependencies # noqa no-handler
ansible.builtin.shell: |
bin/installDeps.sh
args:
chdir: "{{ etherpad_path }}"
executable: /bin/bash
environment:
ETHERPAD_PRODUCTION: "true"
changed_when: false
become: true
become_user: "{{ etherpad_user }}"
when: etherpad_repository.changed

- name: Copy configuration file
ansible.builtin.template:
src: settings.json.j2
Expand Down
24 changes: 24 additions & 0 deletions tasks/preflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
fail_msg: "Etherpad API Key is not set"
success_msg: "Etherpad API Key is set"

- name: Assert that Etherpad SSO Config is set properly
ansible.builtin.assert:
that:
- etherpad_sso_clients | length > 0
fail_msg: "Etherpad SSO Config is not set properly"
success_msg: "Etherpad SSO Config looks good"
when: etherpad_authentication_method == "sso"

- name: Check NodeJS is installed
ansible.builtin.shell: node --version | sed 's/^.//'
changed_when: false
Expand All @@ -26,3 +34,19 @@
- node_version.stdout is version(etherpad_min_node_version, '>=')
fail_msg: "NodeJS version {{ node_version.stdout }} is not supported. Minimum required version is {{ etherpad_min_node_version }}"
success_msg: "NodeJS version {{ node_version.stdout }} is supported"

- name: Check pnpm is installed
ansible.builtin.command: pnpm --version
changed_when: false
check_mode: no
register: pnpm_version
ignore_errors: true
environment:
PATH: "{{ etherpad_environment_path }}"

- name: Assert that pnpm is installed
ansible.builtin.assert:
that:
- pnpm_version.rc == 0
fail_msg: "pnpm is not installed"
success_msg: "pnpm is installed"
3 changes: 2 additions & 1 deletion templates/etc/systemd/system/etherpad-lite.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Type=simple
User={{ etherpad_user }}
Group={{ etherpad_group }}
WorkingDirectory={{ etherpad_path }}
ExecStart={{ etherpad_node_path }} {{ etherpad_path }}/node_modules/ep_etherpad-lite/node/server.js
ExecStart={{ etherpad_path }}/bin/run.sh
Environment=PATH={{ etherpad_environment_path }}
Environment=NODE_ENV={{ etherpad_node_environment }}
Restart=always

Expand Down
17 changes: 16 additions & 1 deletion templates/settings.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,20 @@
},
"importMaxFileSize": {{ etherpad_import_max_file_size }},
"customLocaleStrings": {{ etherpad_custom_locale_strings|to_json }},
"enableAdminUITests": {{ etherpad_enable_admin_ui_tests }}
"enableAdminUITests": {{ etherpad_enable_admin_ui_tests }},
"authenticationMethod": {{ etherpad_authentication_method }},
"lowerCasePadIds": {{ etherpad_lower_case_pad_ids }},
{% if etherpad_authentication_method == "sso" %}
"sso": {
"issuer": "{{ etherpad_sso_issuer }}",
"clients": {{ etherpad_sso_clients|to_json }},
},
{% endif %}
"ttl": {
"AccessToken": "{{ etherpad_ttl_access_token }}",
"AuthorizationCode": "{{ etherpad_ttl_authorization_code }}",
"ClientCredentials": "{{ etherpad_ttl_client_credentials }}",
"IdToken": "{{ etherpad_ttl_id_token }}",
"RefreshToken": "{{ etherpad_ttl_refresh_token }}"
}
}
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
etherpad_min_node_version: "16.20.1"
etherpad_min_node_version: "18.18.2"

0 comments on commit 13e0948

Please sign in to comment.