Skip to content

Commit

Permalink
✨ Add Shiori
Browse files Browse the repository at this point in the history
  • Loading branch information
anarion80 committed Jun 18, 2024
1 parent ec916df commit 1bf3fa1
Show file tree
Hide file tree
Showing 11 changed files with 237 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ If you have a spare domain name you can configure applications to be accessible
* [SearxNG](https://github.com/searxng/searxng) - Free internet metasearch engine
* [Servas](https://github.com/beromir/Servas) - A self-hosted bookmark management tool
* [Shaarli](https://github.com/shaarli/Shaarli) - Personal, minimalist, super-fast, database free, bookmarking service
* [Shiori](https://github.com/go-shiori/shiori) - Simple bookmark manager built with Go
* [Sickchill](https://sickchill.github.io/) - for managing TV episodes
* [Silverbullet](https://silverbullet.md) - Note-taking application optimized for people with a hacker mindset
* [SiYuan](https://github.com/siyuan-note/siyuan) - A privacy-first, self-hosted, fully open source personal knowledge management software
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,10 @@
tags:
- shaarli

- role: shiori
tags:
- shiori

- role: servas
tags:
- servas
Expand Down
63 changes: 63 additions & 0 deletions roles/shiori/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
shiori_enabled: false
shiori_available_externally: false

# directories
shiori_data_directory: "{{ docker_home }}/shiori"

# network
shiori_port: "8165"
shiori_hostname: "shiori"
shiori_network_name: "shiori"

# specs
shiori_memory: 1g
shiori_db_memory: 1g

# docker
shiori_container_name: shiori
shiori_image_name: "ghcr.io/go-shiori/shiori"
shiori_image_version: latest
shiori_db_container_name: shiori-postgres
shiori_db_image_name: postgres
shiori_db_image_version: 15-alpine
shiori_user_id: "1000"
shiori_group_id: "1000"


# shiori
shiori_postgres_user: shiori
shiori_postgres_password: shiori
shiori_postgres_db: shiori
shiori_http_enabled: "true"
shiori_http_port: "8080"
shiori_http_address: ":"
shiori_http_root_path: "/"
shiori_http_access_log: "true"
shiori_http_serve_web_ui: "true"
shiori_http_secret_key: "secret_key_to_be_changed"
shiori_http_body_limit: "1024"
shiori_http_read_timeout: "10s"
shiori_http_write_timeout: "10s"
shiori_http_idle_timeout: "10s"
shiori_http_disable_keep_alive: "true"
shiori_http_disable_parse_multipart_form: "true"
shiori_data_directory_env: "/data"
shiori_database_url: "postgres://{{ shiori_postgres_user }}:{{ shiori_postgres_password }}@{{ shiori_db_container_name }}/{{ shiori_postgres_db }}?sslmode=disable"

shiori_env:
SHIORI_HTTP_ENABLED: "{{ shiori_http_enabled }}"
SHIORI_HTTP_PORT: "{{ shiori_http_port }}"
SHIORI_HTTP_ADDRESS: "{{ shiori_http_address }}"
SHIORI_HTTP_ROOT_PATH: "{{ shiori_http_root_path }}"
SHIORI_HTTP_ACCESS_LOG: "{{ shiori_http_access_log }}"
SHIORI_HTTP_SERVE_WEB_UI: "{{ shiori_http_serve_web_ui }}"
SHIORI_HTTP_SECRET_KEY: "{{ shiori_http_secret_key }}"
SHIORI_HTTP_BODY_LIMIT: "{{ shiori_http_body_limit }}"
SHIORI_HTTP_READ_TIMEOUT: "{{ shiori_http_read_timeout }}"
SHIORI_HTTP_WRITE_TIMEOUT: "{{ shiori_http_write_timeout }}"
SHIORI_HTTP_IDLE_TIMEOUT: "{{ shiori_http_idle_timeout }}"
SHIORI_HTTP_DISABLE_KEEP_ALIVE: "{{ shiori_http_disable_keep_alive }}"
SHIORI_HTTP_DISABLE_PARSE_MULTIPART_FORM: "{{ shiori_http_disable_parse_multipart_form }}"
SHIORI_DIR: "{{ shiori_data_directory_env }}"
SHIORI_DATABASE_URL: "{{ shiori_database_url }}"
11 changes: 11 additions & 0 deletions roles/shiori/docs/shiori.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Shiori

Homepage: [https://github.com/go-shiori/shiori](https://github.com/go-shiori/shiori)

Shiori is a simple bookmarks manager written in the Go language. Intended as a simple clone of Pocket.

## Usage

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

Shiori web interface can be found at [http://ansible_nas_host_or_ip:8165](http://ansible_nas_host_or_ip:8165). Login with default username `shiori` and default password `gopher`.
6 changes: 6 additions & 0 deletions roles/shiori/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
shiori_enabled: true
10 changes: 10 additions & 0 deletions roles/shiori/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:
shiori_enabled: false
26 changes: 26 additions & 0 deletions roles/shiori/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Include vars
ansible.builtin.include_vars:
file: ../../defaults/main.yml

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

- name: Get shiori container state
community.docker.docker_container:
name: "{{ shiori_container_name }}"
register: result

- name: Check if shiori containers are running
ansible.builtin.assert:
that:
- result_db.container['State']['Status'] == "running"
- result_db.container['State']['Restarting'] == false
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
26 changes: 26 additions & 0 deletions roles/shiori/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
- 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 shiori db
community.docker.docker_container:
name: "{{ shiori_db_container_name }}"
state: absent
register: result_db

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

- name: Check if shiori is stopped
ansible.builtin.assert:
that:
- not result_db.changed
- not result.changed
1 change: 1 addition & 0 deletions roles/shiori/requirements.yml
75 changes: 75 additions & 0 deletions roles/shiori/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
- name: Start Shiori
block:
- name: Create Shiori Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: 1001
group: 65533
with_items:
- "{{ shiori_data_directory }}"
- "{{ shiori_data_directory }}/uploads"

- name: Create Shiori network
community.docker.docker_network:
name: "{{ shiori_network_name }}"

- name: Create Shiori DB Docker Container
community.docker.docker_container:
name: "{{ shiori_db_container_name }}"
image: "{{ shiori_db_image_name }}:{{ shiori_db_image_version }}"
pull: true
volumes:
- "{{ shiori_data_directory }}/postgres:/var/lib/postgresql/data:rw"
networks:
- name: "{{ shiori_network_name }}"
network_mode: "{{ shiori_network_name }}"
container_default_behavior: no_defaults
env:
POSTGRES_PASSWORD: "{{ shiori_postgres_password }}"
POSTGRES_USER: "{{ shiori_postgres_user }}"
POSTGRES_DB: "{{ shiori_postgres_db }}"
labels:
traefik.enable: "false"
restart_policy: always
memory: "{{ shiori_db_memory }}"

- name: Create Shiori Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ shiori_container_name }}"
image: "{{ shiori_image_name }}:{{ shiori_image_version }}"
pull: true
volumes:
- "{{ shiori_data_directory }}/dev-data:/srv/shiori"
- "{{ shiori_data_directory }}/data:/data"
networks:
- name: "{{ shiori_network_name }}"
network_mode: "{{ shiori_network_name }}"
ports:
- "{{ shiori_port }}:8080"
env: "{{ shiori_env }}"
restart_policy: unless-stopped
memory: "{{ shiori_memory }}"
labels:
traefik.enable: "{{ shiori_available_externally | string }}"
traefik.http.routers.shiori.rule: "Host(`{{ shiori_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.shiori.tls.certresolver: "letsencrypt"
traefik.http.routers.shiori.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.shiori.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.shiori.loadbalancer.server.port: "8080"
when: shiori_enabled is true

- name: Stop Shiori
block:
- name: Stop Shiori DB
community.docker.docker_container:
name: "{{ shiori_db_container_name }}"
state: absent

- name: Stop Shiori
community.docker.docker_container:
name: "{{ shiori_container_name }}"
state: absent
when: shiori_enabled is false
14 changes: 14 additions & 0 deletions website/docs/applications/other/shiori.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: "Shiori"
description: "Simple bookmark manager built with Go"
---

Homepage: [https://github.com/go-shiori/shiori](https://github.com/go-shiori/shiori)

Shiori is a simple bookmarks manager written in the Go language. Intended as a simple clone of Pocket.

## Usage

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

Shiori web interface can be found at [http://ansible_nas_host_or_ip:8165](http://ansible_nas_host_or_ip:8165). Login with default username `shiori` and default password `gopher`.

0 comments on commit 1bf3fa1

Please sign in to comment.