forked from davestephens/ansible-nas
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from anarion80/add_shiori
✨ Add Shiori
- Loading branch information
Showing
11 changed files
with
237 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -801,6 +801,10 @@ | |
tags: | ||
- shaarli | ||
|
||
- role: shiori | ||
tags: | ||
- shiori | ||
|
||
- role: servas | ||
tags: | ||
- servas | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
provisioner: | ||
inventory: | ||
group_vars: | ||
all: | ||
shiori_enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../requirements.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |