-
-
Notifications
You must be signed in to change notification settings - Fork 22
Feat/numishare tomcat #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1da74f7
87ada3f
43de002
6d6ebef
a9a817c
b8fbd20
2263366
e72d375
231d198
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| - name: 'Playbook linuxfabrik.lfops.setup_numishare' | ||
| hosts: 'all' | ||
| become: true | ||
| any_errors_fatal: true | ||
| serial: 1 | ||
|
Comment on lines
+3
to
+5
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't set these unless absolutely necessary |
||
|
|
||
| vars: | ||
|
|
||
| setup_numishare__apache_solr__skip_injections__internal_var: '{{ setup_numishare__apache_solr__skip_injections | d(setup_numishare__apache_solr__skip_role__internal_var) }}' | ||
| setup_numishare__apache_solr__skip_role__internal_var: '{{ setup_numishare__apache_solr__skip_role | d(false) }}' | ||
| setup_numishare__apache_tomcat__skip_role__internal_var: '{{ setup_numishare__apache_tomcat__skip_role | d(false) }}' | ||
| setup_numishare__apps__skip_role__internal_var: '{{ setup_numishare__apps__skip_role | d(false) }}' | ||
| setup_numishare__existdb__skip_role__internal_var: '{{ setup_numishare__existdb__skip_role | d(false) }}' | ||
| setup_numishare__numishare__skip_role__internal_var: '{{ setup_numishare__numishare__skip_role | d(false) }}' | ||
| setup_numishare__orbeon_forms__skip_role__internal_var: '{{ setup_numishare__orbeon_forms__skip_role | d(false) }}' | ||
|
|
||
| pre_tasks: | ||
|
|
||
| - ansible.builtin.import_role: | ||
| name: 'shared' | ||
| tasks_from: 'log-start.yml' | ||
| tags: | ||
| - 'always' | ||
|
|
||
| roles: | ||
|
|
||
| # OS-level helpers (java, git, unzip, ...). Reduce to whatever is missing | ||
| # by overriding `apps__apps__host_var` in the inventory. apache_solr's OS | ||
| # dependencies (bc, lsof, pwgen, tar) are injected here unless the user | ||
| # opts out via setup_numishare__apache_solr__skip_injections. | ||
| - role: 'linuxfabrik.lfops.apps' | ||
| apps__apps__dependent_var: '{{ | ||
| (not setup_numishare__apache_solr__skip_injections__internal_var) | ternary(apache_solr__apps__apps__dependent_var, []) | ||
| }}' | ||
| when: | ||
| - 'not setup_numishare__apps__skip_role__internal_var' | ||
|
Comment on lines
+27
to
+36
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just do this directly in the role itself |
||
|
|
||
| # Search backend. Numishare's solr-home lives at /opt/numishare/solr-home | ||
| # (outside Solr's default permitted paths), so the Java SecurityManager | ||
| # blocks reads with `access denied ("java.io.FilePermission" ...)`. Disable it. | ||
| # The `numishare` core is fed from eXist-db and could be rebuilt from there, | ||
| # but we still snapshot it via apache-solr-dump for a fast restore path. | ||
| - role: 'linuxfabrik.lfops.apache_solr' | ||
| apache_solr__security_manager_enabled: false | ||
| apache_solr__dump_cores: | ||
| - '{{ numishare__solr_core_name | d("numishare") }}' | ||
| when: | ||
| - 'not setup_numishare__apache_solr__skip_role__internal_var' | ||
|
|
||
| # Application server (required by Orbeon Forms). Runs before numishare so | ||
| # the `tomcat` user/group exist when numishare chowns its files. | ||
| - role: 'linuxfabrik.lfops.apache_tomcat' | ||
| when: | ||
| - 'not setup_numishare__apache_tomcat__skip_role__internal_var' | ||
|
|
||
| # Numishare checkout, exist-config, Solr core wiring, themes dir. | ||
| # Runs before existdb/orbeon so its files exist when those reference them. | ||
| - role: 'linuxfabrik.lfops.numishare' | ||
| when: | ||
| - 'not setup_numishare__numishare__skip_role__internal_var' | ||
|
|
||
| # XML database backing Numishare. | ||
| - role: 'linuxfabrik.lfops.existdb' | ||
| when: | ||
| - 'not setup_numishare__existdb__skip_role__internal_var' | ||
|
|
||
| # Orbeon WAR deployment + Numishare-specific properties / web.xml / themes wiring. | ||
| - role: 'linuxfabrik.lfops.orbeon_forms' | ||
| when: | ||
| - 'not setup_numishare__orbeon_forms__skip_role__internal_var' | ||
|
|
||
| post_tasks: | ||
|
|
||
| - ansible.builtin.import_role: | ||
| name: 'shared' | ||
| tasks_from: 'log-end.yml' | ||
| tags: | ||
| - 'always' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -259,6 +259,64 @@ apache_solr__users__host_var: | |
| ``` | ||
|
|
||
|
|
||
| ## Backup and Restore | ||
|
|
||
| The role can deploy a `mariadb-dump`-style backup pipeline for one or more Solr cores. It uses Solr's `replication?command=backup` endpoint, polls `command=details` until the backup status reports `success`, and writes the snapshot under `apache_solr__dump_directory`. On every run the directory is wiped and refreshed; retention is the responsibility of the surrounding backup tool (Borg, Restic, ...) which snapshots that directory. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove the reference to mariadb |
||
|
|
||
| ### Optional Backup Variables | ||
|
|
||
| `apache_solr__dump_cores` | ||
|
|
||
| * List of cores to back up. Empty disables the timer and stops the existing one. | ||
| * Type: List of strings. | ||
| * Default: `[]` | ||
|
|
||
| `apache_solr__dump_directory` | ||
|
|
||
| * Where the latest snapshot lands. Owned by `{{ apache_solr__user }}:{{ apache_solr__group }}` so Solr can write into it. | ||
| * Type: String. | ||
| * Default: `'/backup/apache-solr-dump'` | ||
|
|
||
| `apache_solr__dump_on_calendar` | ||
|
|
||
| * `OnCalendar=` value for `apache-solr-dump.timer`. Default seeds the minute by `inventory_hostname` so a fleet does not all hit Solr at the same second. | ||
| * Type: String. | ||
| * Default: `'*-*-* 22:{{ 59 | random(seed=inventory_hostname) }}:00'` | ||
|
|
||
| `apache_solr__dump_url` | ||
|
|
||
| * Base URL of the Solr instance the dumper hits. Defaults to localhost on the configured port. Override if Solr listens on a UNIX socket or the loopback alias differs. | ||
| * Type: String. | ||
| * Default: `'http://127.0.0.1:{{ apache_solr__http_bind_port }}/solr'` | ||
|
|
||
| ### Restoring a Core | ||
|
|
||
| 1. Stop Solr writes to the target core (route traffic away or stop the service). | ||
| 2. Identify the snapshot directory written by the dumper: | ||
|
|
||
| ```bash | ||
| ls /backup/apache-solr-dump/snapshot.<core_name>/ | ||
| ``` | ||
|
|
||
| 3. Hit the replication restore endpoint: | ||
|
|
||
| ```bash | ||
| curl 'http://127.0.0.1:8983/solr/<core_name>/replication?command=restore&location=/backup/apache-solr-dump&name=<core_name>' | ||
| ``` | ||
|
|
||
| 4. Poll until done: | ||
|
|
||
| ```bash | ||
| curl 'http://127.0.0.1:8983/solr/<core_name>/replication?command=restorestatus&wt=json' | ||
| ``` | ||
|
|
||
| `status` flips to `success` (or `failed`) when the restore completes. | ||
|
|
||
| 5. Re-enable traffic. | ||
|
|
||
| For Numishare specifically: the `numishare` core is also reproducible from eXist-db (the Numishare publish pipeline rebuilds the index). The Solr snapshot exists to skip the (potentially long) rebuild during disaster recovery, not as the only authoritative source. | ||
|
|
||
|
|
||
| ## License | ||
|
|
||
| [The Unlicense](https://unlicense.org/) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be
lfops_setup_numishare