Skip to content

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
  • Loading branch information
medanthelinium committed Nov 27, 2024
1 parent 3402799 commit 75a8170
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 18 deletions.
86 changes: 74 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,85 @@ An Ansible role that sets up Apache Solr and Apache Tika on a Proserver

Downloads the defined versions of Solr and Tika from [archive.apache.org](https://archive.apache.org) and enables their respective services.

### Example configuration
## Dependencies
* [ansible-proserver-oauth2-proxy](https://github.com/punktDe/ansible-proserver-oauth2-proxy)
* [ansible-proserver-nginx](https://github.com/punktDe/ansible-proserver-nginx) or [ansible-proserver-apache](https://github.com/punktDe/ansible-proserver-apache)
* [ansible-proserver-dehydrated](https://github.com/punktDe/ansible-proserver-dehydrated)
* [ansible-proserver-supervisord](https://github.com/punktDe/ansible-proserver-supervisord)

## Background

This role deactivates the built-in FreeBSD rc.d services for Solr and Tika and does not interfere with their respective working directories (/var/solr, /var/solr/db, etc.).

Instead, it uses [supervisord](https://github.com/punktDe/ansible-proserver-supervisord) for service management, and works with the following folders:

|Directory|Description|
|---|---|
|/var/opt/solr/solr|Solr working directory|
|/var/opt/solr/home|Solr home|
|/var/opt/solr/tika|Tika working directory|
|/var/log/solr-ansible|Solr and Tika Logs|

## Configuration

The default configuration values can be found in defaults/main.yaml

### solr.url
**Default**: empty

The URL for the Solr WebUI
```yaml
solr:
url: https://solr.example.com
```
### solr.oauth2_proxy
**Default**: empty
The oauth2_proxy configuration that should be used for Solr WebUI authentiacation.
Should be defined under `oauth2_proxy.$configuration` e.g. `oauth2_proxy.main` or `oauth2_proxy.solr`

If empty, the WebUI will be publicly available, with no authentication.
```yaml
solr:
oauth2_proxy: main
```

### solr.overwrite_home
**Default**: no

If enabled, will erase the Solr home directory (default: /var/opt/solr/home) on version change.

Use with caution – this will also remove all your cores and custom configurations for them.

```yaml
solr:
overwrite_home: yes
```

### solr.prefix
The directories for Solr and Tika
```yaml
solr:
domain: https://solr.example.com
prefix:
bin: /var/solr
var: /var/db/solr
version: 9.2.0
bin: /var/opt/solr/solr
home: /var/opt/solr/home
tika: /var/opt/solr/tika
logs: /var/log/solr-ansible
```

### solr.version
Solr version to install. Make sure the version exists on either https://archive.apache.org/dist/lucene/solr/ (pre 9.x) or https://archive.apache.org/dist/solr/solr/ (9.x)
```yaml
solr:
version: 9.7.0
```

### solr.tika.version
Tika version to install. Make sure the version exists on https://archive.apache.org/dist/tika
```yaml
solr:
tika:
prefix:
bin: /var/opt/tika
version: 2.8.0
oauth2_proxy: main # https://github.com/punktDe/ansible-proserver-oauth2-proxy
# Will erase the Solr home and replace it with the example
# home folder shipped with the respective Solr version
overwrite_home: no
version: 3.0.0
```
7 changes: 3 additions & 4 deletions defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
solr:
overwrite_home: no
domain:
url:
prefix:
bin: /var/opt/solr/solr
home: /var/opt/solr/home
tika: /var/opt/solr/tika
logs: /var/log/solr-ansible
version: 9.7.0
tika:
prefix:
bin: /var/opt/tika
version: 3.0.0
oauth2_proxy:
overwrite_home: no
2 changes: 2 additions & 0 deletions handlers/main.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- name: Start Solr
changed_when: yes
ansible.builtin.shell:
cmd: |
set -e -u -o pipefail
Expand All @@ -8,6 +9,7 @@
register: solr_service_result

- name: Restart Solr
changed_when: yes
ansible.builtin.shell:
cmd: |
set -e -u -o pipefail
Expand Down
4 changes: 2 additions & 2 deletions tasks/tika.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
owner: root
mode: "0755"
with_items:
- "{{ solr.tika.prefix.bin }}"
- "{{ solr.prefix.tika }}"

- name: Create log directory for Tika
ansible.builtin.file:
Expand All @@ -19,7 +19,7 @@
register: tika_get_url_result
ansible.builtin.get_url:
url: "https://archive.apache.org/dist/tika/{{ solr.tika.version }}/tika-server-{{ tika_standard }}{{ solr.tika.version }}.jar"
dest: "{{ solr.tika.prefix.bin }}/tika-server.jar"
dest: "{{ solr.prefix.tika }}/tika-server.jar"
checksum: "sha512:https://archive.apache.org/dist/tika/{{ solr.tika.version }}/tika-server-{{ tika_standard }}{{ solr.tika.version }}.jar.sha512"
owner: root
mode: "0755"
Expand Down

0 comments on commit 75a8170

Please sign in to comment.