Skip to content

Commit

Permalink
Add Silverbullet 🗒️
Browse files Browse the repository at this point in the history
  • Loading branch information
davestephens committed Mar 10, 2024
1 parent 15a8c7d commit b7550c9
Show file tree
Hide file tree
Showing 9 changed files with 140 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@
tags:
- sickchill

- role: silverbullet
tags:
- silverbullet

- role: sonarr
tags:
- sonarr
Expand Down
22 changes: 22 additions & 0 deletions roles/silverbullet/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions roles/silverbullet/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
silverbullet_enabled: true
10 changes: 10 additions & 0 deletions roles/silverbullet/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:
silverbullet_enabled: false
18 changes: 18 additions & 0 deletions roles/silverbullet/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions roles/silverbullet/molecule/default/verify_stopped.yml
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions roles/silverbullet/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions website/docs/applications/other/silverbullet.md
Original file line number Diff line number Diff line change
@@ -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/<your_inventory>/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.

0 comments on commit b7550c9

Please sign in to comment.