diff --git a/README.md b/README.md index a3a6e7e978..a959461c99 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ If you have a spare domain name you can configure applications to be accessible * [RSS-Bridge](https://rss-bridge.github.io/rss-bridge/) - The RSS feed for websites missing it * [Sabnzbd](https://sabnzbd.org/) - A powerful usenet downloader that FreeNAS provides * [Sickchill](https://sickchill.github.io/) - for managing TV episodes +* [Silverbullet](https://silverbullet.md) - Note-taking application optimized for people with a hacker mindset * [Sonarr](https://sonarr.tv/) - for downloading and managing TV episodes * [Speedtest-Tracker](https://github.com/henrywhitaker3/Speedtest-Tracker) - Continuously track your internet speed * Stats - Monitor and visualise metrics about your NAS and internet connection using Grafana, Prometheus, Telegraf and more. diff --git a/nas.yml b/nas.yml index adb5b191d7..7c20d283a5 100644 --- a/nas.yml +++ b/nas.yml @@ -358,6 +358,10 @@ tags: - sickchill + - role: silverbullet + tags: + - silverbullet + - role: sonarr tags: - sonarr diff --git a/roles/silverbullet/defaults/main.yml b/roles/silverbullet/defaults/main.yml new file mode 100644 index 0000000000..d4d5dbc2da --- /dev/null +++ b/roles/silverbullet/defaults/main.yml @@ -0,0 +1,22 @@ +--- +silverbullet_enabled: false +silverbullet_available_externally: false + +# directories +silverbullet_data_directory: "{{ docker_home }}/silverbullet" + +# network +silverbullet_port: 3002 +silverbullet_hostname: silverbullet + +# docker +silverbullet_container_name: "silverbullet" +silverbullet_image_name: "zefhemel/silverbullet" +silverbullet_image_version: "latest" + +# specs +silverbullet_memory: 1g + +# config +silverbullet_username: admin +silverbullet_password: topSecret diff --git a/roles/silverbullet/molecule/default/molecule.yml b/roles/silverbullet/molecule/default/molecule.yml new file mode 100644 index 0000000000..4c31fff4ef --- /dev/null +++ b/roles/silverbullet/molecule/default/molecule.yml @@ -0,0 +1,6 @@ +--- +provisioner: + inventory: + group_vars: + all: + silverbullet_enabled: true diff --git a/roles/silverbullet/molecule/default/side_effect.yml b/roles/silverbullet/molecule/default/side_effect.yml new file mode 100644 index 0000000000..edd5b0d792 --- /dev/null +++ b/roles/silverbullet/molecule/default/side_effect.yml @@ -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: + silverbullet_enabled: false diff --git a/roles/silverbullet/molecule/default/verify.yml b/roles/silverbullet/molecule/default/verify.yml new file mode 100644 index 0000000000..c63d4c2c1b --- /dev/null +++ b/roles/silverbullet/molecule/default/verify.yml @@ -0,0 +1,18 @@ +--- +- name: Verify + hosts: all + gather_facts: false + tasks: + - ansible.builtin.include_vars: + file: ../../defaults/main.yml + + - name: Get Silverbullet container state + community.docker.docker_container: + name: "{{ silverbullet_container_name }}" + register: result + + - name: Check if Silverbullet containers are running + ansible.builtin.assert: + that: + - result.container['State']['Status'] == "running" + - result.container['State']['Restarting'] == false diff --git a/roles/silverbullet/molecule/default/verify_stopped.yml b/roles/silverbullet/molecule/default/verify_stopped.yml new file mode 100644 index 0000000000..0af081b63d --- /dev/null +++ b/roles/silverbullet/molecule/default/verify_stopped.yml @@ -0,0 +1,18 @@ +--- +- name: Verify + hosts: all + gather_facts: false + tasks: + - ansible.builtin.include_vars: + file: ../../defaults/main.yml + + - name: Try and stop and remove Silverbullet + community.docker.docker_container: + name: "{{ silverbullet_container_name }}" + state: absent + register: result + + - name: Check if Silverbullet is stopped + ansible.builtin.assert: + that: + - not result.changed diff --git a/roles/silverbullet/tasks/main.yml b/roles/silverbullet/tasks/main.yml new file mode 100644 index 0000000000..1fa3ea572e --- /dev/null +++ b/roles/silverbullet/tasks/main.yml @@ -0,0 +1,39 @@ +--- +- name: Start Silverbullet + block: + - name: Create Silverbullet Directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + with_items: + - "{{ silverbullet_data_directory }}" + + - name: silverbullet Docker Container + community.docker.docker_container: + name: "{{ silverbullet_container_name }}" + image: "{{ silverbullet_image_name }}:{{ silverbullet_image_version }}" + pull: true + ports: + - "{{ silverbullet_port }}:3000" + volumes: + - "{{ silverbullet_data_directory }}:/space" + restart_policy: unless-stopped + memory: "{{ silverbullet_memory }}" + env: + SB_USER: "{{ silverbullet_username }}:{{ silverbullet_password }}" + labels: + traefik.enable: "{{ silverbullet_available_externally | string }}" + traefik.http.routers.silverbullet.rule: "Host(`{{ silverbullet_hostname }}.{{ ansible_nas_domain }}`)" + traefik.http.routers.silverbullet.tls.certresolver: "letsencrypt" + traefik.http.routers.silverbullet.tls.domains[0].main: "{{ ansible_nas_domain }}" + traefik.http.routers.silverbullet.tls.domains[0].sans: "*.{{ ansible_nas_domain }}" + traefik.http.services.silverbullet.loadbalancer.server.port: "3000" + when: silverbullet_enabled is true + +- name: Stop silverbullet + block: + - name: Stop silverbullet + community.docker.docker_container: + name: "{{ silverbullet_container_name }}" + state: absent + when: silverbullet_enabled is false diff --git a/website/docs/applications/other/silverbullet.md b/website/docs/applications/other/silverbullet.md new file mode 100644 index 0000000000..b79c42a53a --- /dev/null +++ b/website/docs/applications/other/silverbullet.md @@ -0,0 +1,22 @@ +--- +title: "Silverbullet" +--- + +Homepage: [https://silverbullet.md](https://silverbullet.md) + +SilverBullet is a note-taking application optimized for people with a +[hacker mindset](https://en.wikipedia.org/wiki/Hacker). We all take notes. +There’s a million note taking applications out there. [Literally](https://www.noteapps.ca/). +Wouldn’t it be nice to have one where your notes are _more_ than plain text files? +Where your notes essentially become a _database_ that you can query; that you can build custom +knowledge applications on top of? + +## Usage + +Set `silverbullet_enabled: true` in your `inventories//group_vars/nas.yml` file. + +The Silverbullet web interface can be found at [http://ansible_nas_host_or_ip:3002](http://ansible_nas_host_or_ip:3002). + +## Additional Configuration + +Set `silverbullet_username` and `silverbullet_password` to customise the login username and password.