Skip to content

Commit

Permalink
Add Support for Etherpad v2
Browse files Browse the repository at this point in the history
  • Loading branch information
0x46616c6b committed May 18, 2024
1 parent c7fdaa9 commit 5b20472
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 8 deletions.
20 changes: 15 additions & 5 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,5 @@ 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"
21 changes: 21 additions & 0 deletions tasks/preflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
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_authentication_method == "sso" and etherpad_sso_clients | length > 0
fail_msg: "Etherpad SSO Config is not set properly"
success_msg: "Etherpad SSO Config looks good"

- name: Check NodeJS is installed
ansible.builtin.shell: node --version | sed 's/^.//'
changed_when: false
Expand All @@ -26,3 +33,17 @@
- 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

Check failure on line 37 in tasks/preflight.yml

View workflow job for this annotation

GitHub Actions / Integration / Lint

command-instead-of-shell

Use shell only when shell functionality is required.
ansible.builtin.shell: pnpm --version
changed_when: false
check_mode: no
register: pnpm_version
ignore_errors: true

- 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"
2 changes: 1 addition & 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,7 @@ 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=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 authenticationMethod == "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 5b20472

Please sign in to comment.