Merge pull request #81 from mother-of-all-self-hosting/ilmo

Add ILMO
This commit is contained in:
Slavi Pantaleev 2023-07-19 10:58:49 +03:00 committed by GitHub
commit 216eb97c0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 162 additions and 0 deletions

99
docs/services/ilmo.md Normal file
View file

@ -0,0 +1,99 @@
# ILMO
[Ilmo](https://github.com/moan0s/ILMO2) is an open source library management tool.
Read [the documentation](https://ilmo2.readthedocs.io/) to learn what you can do with it.
**Warning**: This service is a custom solution for a small library. Feel free to use it but don't expect a solution that works for every use case
## Dependencies
This service requires the following other services:
- a [Postgres](postgres.md) database
- a [Traefik](traefik.md) reverse-proxy server
## Configuration
To enable this service, add the following configuration to your `vars.yml` file and re-run the [installation](../installing.md) process:
```yaml
########################################################################
# #
# ilmo #
# #
########################################################################
ilmo_enabled: true
ilmo_hostname: ilmo.example.com
ilmo_instance_name: "My library"
########################################################################
# #
# /ilmo #
# #
########################################################################
```
## Setting up the first user
You need to create a first user (unless you import an existing database).
You can do this conveniently by running
```bash
just run-tags ilmo-add-superuser --extra-vars=username=USERNAME --extra-vars=password=PASSWORD --extra-vars=email=EMAIL
```
## Usage
After installation, you can go to the ILMO URL, as defined in `ilmo_hostname`. Log in with the user credentials from above.
Follow the [ILMO documentation](https://ilmo2.readthedocs.io/en/latest/index.html) to learn how to use ILMO.
## Migrate an existing instance
The following assumes you want to migrate from `serverA` to `serverB` (managed by mash) but you just cave to adjust the copy commands if you are on the same server.
Stop the initial instance on `serverA`
```bash
serverA$ systemctl stop ilmo
```
Dump the database (depending on your existing setup you might have to adjust this)
```
serverA$ pg_dump ilmo > latest.sql
```
Copy the files to the new server
```bash
serverA$ rsync -av -e "ssh" latest.sql root@serverB:/mash/ilmo/
serverA$ rsync -av -e "ssh" data/* root@serverB:/mash/ilmo/data/
```
Install (but don't start) the service and database on the server and import the database.
```bash
yourPC$ just run-tags install-postgres
yourPC$ just run-tags install-ilmo
yourPC$ just run-tags import-postgres --extra-vars=server_path_postgres_dump=/mash/ilmo/latest.sql --extra-vars=postgres_default_import_database=mash-ilmo
```
Start the services on the new server
```bash
yourPC$ just run-tags start
```
Done 🥳
### Troubleshooting
If you by accident started the service before importing the database you should
* stop the service
* use `/mash/postgres/bin/cli` to get a database interface
* Delete the existing database (THIS WILL DELETE ALL DATA!) `DROP DATABASE ilmo WITH (FORCE);`
* Continue from "Install (but don't start) the service and database on the server and import the database."

View file

@ -20,6 +20,7 @@
| [Grafana](https://grafana.com/) | An open and composable observability and data visualization platform, often used with [Prometheus](services/prometheus.md) | [Link](services/grafana.md) |
| [Healthchecks](https://healthchecks.io/) | A simple and Effective Cron Job Monitoring solution | [Link](services/healthchecks.md) |
| [Hubsite](https://github.com/moan0s/hubsite) | A simple, static site that shows an overview of the available services | [Link](services/hubsite.md) |
| [ILMO](https://github.com/moan0s/ILMO2) | An open source library management tool. | [Link](services/ilmo.md) |
| [Infisical](https://infisical.com/) | An open-source end-to-end encrypted platform for securely managing secrets and configs across your team, devices, and infrastructure. | [Link](services/infisical.md) |
| [InfluxDB](https://www.influxdata.com/) | A self-hosted time-series database. | [Link](services/influxdb.md) |
| [Jitsi](https://jitsi.org/) | A fully encrypted, 100% Open Source video conferencing solution | [Link](services/jitsi.md) |

View file

@ -113,6 +113,8 @@ devture_systemd_service_manager_services_list_auto: |
+
([{'name': (gotosocial_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'gotosocial']}] if gotosocial_enabled else [])
+
([{'name': (ilmo_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'ilmo']}] if ilmo_enabled else [])
+
([{'name': (mobilizon_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'mobilizon']}] if mobilizon_enabled else [])
+
([{'name': (grafana_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'grafana']}] if grafana_enabled else [])
@ -281,6 +283,12 @@ devture_postgres_managed_databases_auto: |
'password': gotosocial_database_password,
}] if gotosocial_enabled else [])
+
([{
'name': ilmo_database_name,
'username': ilmo_database_username,
'password': ilmo_database_password,
}] if ilmo_enabled else [])
+
([{
'name': keycloak_database_name,
'username': keycloak_database_username,
@ -1426,6 +1434,55 @@ hubsite_service_list_auto: |
########################################################################
# #
# ilmo #
# #
########################################################################
ilmo_enabled: false
ilmo_identifier: "{{ mash_playbook_service_identifier_prefix }}ilmo"
ilmo_base_path: "{{ mash_playbook_base_path }}/{{ mash_playbook_service_base_directory_name_prefix }}ilmo"
ilmo_uid: "{{ mash_playbook_uid }}"
ilmo_gid: "{{ mash_playbook_gid }}"
ilmo_secret: "{{ '%s' | format(mash_playbook_generic_secret_key) | password_hash('sha512', 'secret.ilmo', rounds=655555) | to_uuid }}"
ilmo_database_host: "{{ devture_postgres_identifier if devture_postgres_enabled else '' }}"
ilmo_database_port: "{{ '5432' if devture_postgres_enabled else '' }}"
ilmo_database_password: "{{ '%s' | format(mash_playbook_generic_secret_key) | password_hash('sha512', 'db.ilmo', rounds=655555) | to_uuid }}"
ilmo_database_username: "ilmo"
ilmo_systemd_required_services_list: |
{{
(['docker.service'])
+
([devture_postgres_identifier ~ '.service'] if devture_postgres_enabled and ilmo_database_host == devture_postgres_identifier else [])
}}
ilmo_container_additional_networks: |
{{
([mash_playbook_reverse_proxyable_services_additional_network] if mash_playbook_reverse_proxyable_services_additional_network else [])
+
([devture_postgres_container_network] if devture_postgres_enabled and ilmo_database_host == devture_postgres_identifier and ilmo_container_network != devture_postgres_container_network else [])
}}
ilmo_container_labels_traefik_enabled: "{{ mash_playbook_traefik_labels_enabled }}"
ilmo_container_labels_traefik_docker_network: "{{ mash_playbook_reverse_proxyable_services_additional_network }}"
ilmo_container_labels_traefik_entrypoints: "{{ devture_traefik_entrypoint_primary }}"
ilmo_container_labels_traefik_tls_certResolver: "{{ devture_traefik_certResolver_primary }}"
########################################################################
# #
# /ilmo #
# #
########################################################################
########################################################################
# #
# infisical #

View file

@ -83,6 +83,9 @@
- src: git+https://github.com/moan0s/hubsite.git
version: v1.23.3-2
name: hubsite
- src: git+https://github.com/moan0s/ansible-role-ilmo.git
version: v1.0.3-0
name: ilmo
- src: git+https://github.com/mother-of-all-self-hosting/ansible-role-infisical.git
version: v0.3.8-4
name: infisical

View file

@ -96,6 +96,8 @@
- role: galaxy/hubsite
- role: galaxy/ilmo
- role: galaxy/influxdb
- role: galaxy/jitsi