Skip to content
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

✨ Add Wanderer #120

Merged
merged 1 commit into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Vaultwarden](https://github.com/dani-garcia/vaultwarden) - Self-Hosting port of password manager
* [Virtual Desktop](https://github.com/RattyDAVE/docker-ubuntu-xrdp-mate-custom) - A virtual desktop running on your NAS.
* [Wallabag](https://wallabag.org/) - Save and classify articles. Read them later.
* [Wanderer](https://github.com/Flomp/wanderer) - A self-hosted trail database.
* [Watchtower](https://github.com/v2tec/watchtower) - Monitor your Docker containers and update them if a new version is available
* [Webtrees](https://www.webtrees.net/index.php/en/) - On-line collaborative genealogy application
* [Wger](https://wger.de) - Free, open source web application that manages your exercises, workouts and nutrition
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,10 @@
tags:
- wallabag

- role: wanderer
tags:
- wanderer

- role: watchtower
tags:
- watchtower
Expand Down
45 changes: 45 additions & 0 deletions roles/wanderer/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
wanderer_enabled: false
wanderer_available_externally: false

# directories
wanderer_data_directory: "{{ docker_home }}/wanderer"

# network
wanderer_port: "3015"
wanderer_db_port: "8090"
wanderer_search_port: "7700"
wanderer_hostname: "wanderer"
wanderer_network_name: "wanderer"

# specs
wanderer_memory: 1g
wanderer_db_memory: 1g
wanderer_search_memory: 1g
wanderer_valhalla_memory: 1g

# docker
wanderer_container_name: wanderer
wanderer_image_name: "flomp/wanderer-web"
wanderer_image_version: latest
wanderer_db_container_name: wanderer-db
wanderer_db_image_name: "flomp/wanderer-db"
wanderer_db_image_version: "latest"
wanderer_search_container_name: wanderer-search
wanderer_search_image_name: "flomp/wanderer-search"
wanderer_search_image_version: "latest"
wanderer_user_id: "1000"
wanderer_group_id: "1000"

# wanderer
wanderer_meili_url: "http://{{ wanderer_search_container_name }}:7700"
wanderer_meili_master_key: "vODkljPcfFANYNepCHyDyGjzAMPcdHnrb6X5KyXQPWo"
wanderer_meili_no_analytics: "true"
wanderer_origin: "https://{{ wanderer_hostname }}.{{ ansible_nas_domain }}"
wanderer_body_size_limit: "Infinity"
wanderer_public_pocketbase_url: "http://{{ wanderer_db_container_name }}:{{ wanderer_db_port }}"
wanderer_public_disable_signup: "false"
wanderer_upload_folder: "/app/uploads"
wanderer_upload_user: ""
wanderer_upload_password: ""
wanderer_public_valhalla_url: "https://valhalla1.openstreetmap.de"
11 changes: 11 additions & 0 deletions roles/wanderer/docs/wanderer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Wanderer

Homepage: [https://github.com/Flomp/wanderer](https://github.com/Flomp/wanderer)

A self-hosted trail database.

## Usage

Set `wanderer_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file.

wanderer web interface can be found at [http://ansible_nas_host_or_ip:3015](http://ansible_nas_host_or_ip:3015).
6 changes: 6 additions & 0 deletions roles/wanderer/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
wanderer_enabled: true
10 changes: 10 additions & 0 deletions roles/wanderer/molecule/default/side_effect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Stop
hosts: all
become: true
tasks:
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
ansible.builtin.include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
vars:
wanderer_enabled: false
33 changes: 33 additions & 0 deletions roles/wanderer/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Include vars
ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Get wanderer search container state
community.docker.docker_container:
name: "{{ wanderer_search_container_name }}"
register: result_search

- name: Get wanderer db container state
community.docker.docker_container:
name: "{{ wanderer_db_container_name }}"
register: result_db

- name: Get wanderer container state
community.docker.docker_container:
name: "{{ wanderer_container_name }}"
register: result

- name: Check if wanderer containers are running
ansible.builtin.assert:
that:
- result_search.container['State']['Status'] == "running"
- result_search.container['State']['Restarting'] == false
- result_db.container['State']['Status'] == "running"
- result_db.container['State']['Restarting'] == false
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
33 changes: 33 additions & 0 deletions roles/wanderer/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Include vars
ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Try and stop and remove wanderer search
community.docker.docker_container:
name: "{{ wanderer_db_container_name }}"
state: absent
register: result_search

- name: Try and stop and remove wanderer db
community.docker.docker_container:
name: "{{ wanderer_db_container_name }}"
state: absent
register: result_db

- name: Try and stop and remove wanderer
community.docker.docker_container:
name: "{{ wanderer_container_name }}"
state: absent
register: result

- name: Check if wanderer is stopped
ansible.builtin.assert:
that:
- not result_search.changed
- not result_db.changed
- not result.changed
1 change: 1 addition & 0 deletions roles/wanderer/requirements.yml
142 changes: 142 additions & 0 deletions roles/wanderer/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
---
- name: Start Wanderer
block:
- name: Create Wanderer Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ wanderer_data_directory }}"

- name: Create Wanderer network
community.docker.docker_network:
name: "{{ wanderer_network_name }}"

- name: Create Wanderer Search Docker Container
community.docker.docker_container:
name: "{{ wanderer_search_container_name }}"
image: "{{ wanderer_search_image_name }}:{{ wanderer_search_image_version }}"
pull: true
volumes:
- "{{ wanderer_data_directory }}/data/data.ms:/meili_data/data.ms:rw"
networks:
- name: "{{ wanderer_network_name }}"
network_mode: "{{ wanderer_network_name }}"
container_default_behavior: no_defaults
ports:
- "{{ wanderer_search_port }}:7700"
env:
MEILI_URL: "{{ wanderer_meili_url }}"
MEILI_MASTER_KEY: "{{ wanderer_meili_master_key }}"
MEILI_NO_ANALYTICS: "{{ wanderer_meili_no_analytics }}"
labels:
traefik.enable: "false"
restart_policy: always
memory: "{{ wanderer_search_memory }}"
healthcheck:
test: curl --fail http://localhost:7700/health || exit 1
interval: 15s
retries: 10
start_period: 20s
timeout: 10s

- name: Wait until Wanderer Search initializes and is healthy
community.docker.docker_container_info:
name: "{{ wanderer_search_container_name }}"
register: result
until: result.container.State.Health.Status == "healthy"
retries: 20
delay: 30

- name: Create Wanderer Db Docker Container
community.docker.docker_container:
name: "{{ wanderer_db_container_name }}"
image: "{{ wanderer_db_image_name }}:{{ wanderer_db_image_version }}"
pull: true
volumes:
- "{{ wanderer_data_directory }}/data/pb_data:/pb_data:rw"
networks:
- name: "{{ wanderer_network_name }}"
network_mode: "{{ wanderer_network_name }}"
container_default_behavior: no_defaults
ports:
- "{{ wanderer_db_port }}:8090"
env:
MEILI_URL: "{{ wanderer_meili_url }}"
MEILI_MASTER_KEY: "{{ wanderer_meili_master_key }}"
MEILI_NO_ANALYTICS: "{{ wanderer_meili_no_analytics }}"
labels:
traefik.enable: "false"
restart_policy: always
memory: "{{ wanderer_db_memory }}"


- name: Wait until Wanderer DB is running
community.docker.docker_container_info:
name: "{{ wanderer_db_container_name }}"
register: result
until: result.container.State.Status == "running"
retries: 20
delay: 30

- name: Create Wanderer Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ wanderer_container_name }}"
image: "{{ wanderer_image_name }}:{{ wanderer_image_version }}"
pull: true
volumes:
- "{{ wanderer_data_directory }}/data/uploads:/app/uploads:rw"
networks:
- name: "{{ wanderer_network_name }}"
network_mode: "{{ wanderer_network_name }}"
ports:
- "{{ wanderer_port }}:3000"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ wanderer_user_id | quote }}"
PGID: "{{ wanderer_group_id | quote }}"
MEILI_URL: "{{ wanderer_meili_url }}"
MEILI_MASTER_KEY: "{{ wanderer_meili_master_key }}"
MEILI_NO_ANALYTICS: "{{ wanderer_meili_no_analytics }}"
ORIGIN: "{{ wanderer_origin }}"
PUBLIC_POCKETBASE_URL: "{{ wanderer_public_pocketbase_url }}"
PUBLIC_DISABLE_SIGNUP: "{{ wanderer_public_disable_signup }}"
UPLOAD_FOLDER: "{{ wanderer_upload_folder }}"
UPLOAD_USER: "{{ wanderer_upload_user }}"
UPLOAD_PASSWORD: "{{ wanderer_upload_password }}"
PUBLIC_VALHALLA_URL: "{{ wanderer_public_valhalla_url }}"
restart_policy: unless-stopped
memory: "{{ wanderer_memory }}"
labels:
traefik.enable: "{{ wanderer_available_externally | string }}"
traefik.http.routers.wanderer.rule: "Host(`{{ wanderer_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.wanderer.tls.certresolver: "letsencrypt"
traefik.http.routers.wanderer.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.wanderer.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.wanderer.loadbalancer.server.port: "3000"
healthcheck:
test: curl -ILfSs http://localhost:3000 > /dev/null || exit 1
interval: 30s
timeout: 15s
retries: 3
start_period: 30s
when: wanderer_enabled is true

- name: Stop Wanderer
block:
- name: Stop Wanderer search
community.docker.docker_container:
name: "{{ wanderer_search_container_name }}"
state: absent

- name: Stop Wanderer db
community.docker.docker_container:
name: "{{ wanderer_db_container_name }}"
state: absent

- name: Stop Wanderer
community.docker.docker_container:
name: "{{ wanderer_container_name }}"
state: absent
when: wanderer_enabled is false
14 changes: 14 additions & 0 deletions website/docs/applications/other/wanderer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: "Wanderer"
description: "a self-hosted trail database"
---

Homepage: [https://github.com/Flomp/wanderer](https://github.com/Flomp/wanderer)

A self-hosted trail database.

## Usage

Set `wanderer_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file.

wanderer web interface can be found at [http://ansible_nas_host_or_ip:3015](http://ansible_nas_host_or_ip:3015).