Skip to content

Commit

Permalink
✨ Add Standard Notes (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
anarion80 authored Nov 20, 2023
1 parent 148fa28 commit 3018cb6
Show file tree
Hide file tree
Showing 10 changed files with 541 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ If you have a spare domain name you can configure applications to be accessible
* [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.
* [Standard Notes](https://standardnotes.com/) - An end-to-end encrypted notes app
* [Stirling-PDF](https://github.com/Frooodle/Stirling-PDF) - locally hosted web application that allows you to perform various operations on PDF files
* [Syncthing](https://syncthing.net/) - sync directories with another device
* [Tautulli](http://tautulli.com/) - Monitor Your Plex Media Server
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,10 @@
tags:
- speedtest-tracker

- role: standardnotes
tags:
- standardnotes

- role: stats
tags:
- stats
Expand Down
88 changes: 88 additions & 0 deletions roles/standardnotes/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
standardnotes_enabled: false
standardnotes_available_externally: false
standardnotes_app_client_enabled: false
standardnotes_enable_subscription: false

# directories
standardnotes_data_directory: "{{ docker_home }}/standardnotes"

# network
standardnotes_port: "3011"
standardnotes_files_port: "3013"
standardnotes_app_port: "8128"
standardnotes_app_hostname: "standardnotes"
standardnotes_server_hostname: "standardnotes-server"
standardnotes_files_hostname: "standardnotes-files"
standardnotes_network_name: "standardnotes"

# specs
standardnotes_memory: 1g
standardnotes_localstack_memory: 1g
standardnotes_db_memory: 1g
standardnotes_redis_memory: 1g
standardnotes_app_memory: 4g

# docker
standardnotes_container_name: standardnotes
standardnotes_image_name: "standardnotes/server"
standardnotes_image_version: latest

standardnotes_app_container_name: standardnotes-app
standardnotes_app_image_name: "ghcr.io/jackyzy823/standardnotes-web"
standardnotes_app_image_version: latest

standardnotes_localstack_container_name: standardnotes-localstack
standardnotes_localstack_image_name: "localstack/localstack"
standardnotes_localstack_image_version: "1.4"

standardnotes_db_container_name: standardnotes-db
standardnotes_db_image_name: "mysql"
standardnotes_db_image_version: "8"

standardnotes_redis_container_name: standardnotes-redis
standardnotes_redis_image_name: "redis"
standardnotes_redis_image_version: "6.0-alpine"
standardnotes_user_id: "1000"
standardnotes_group_id: "1000"

# standardnotes
standardnotes_db_database: "standardnotes"
standardnotes_db_user: "standardnotes"
standardnotes_db_root_password: "supersecure"
standardnotes_db_password: "changeme"
standardnotes_db_host: "{{ standardnotes_db_container_name }}"
standardnotes_db_port: "3306"
standardnotes_db_type: "mysql"
standardnotes_db_charset: "utf8mb4"
standardnotes_db_lang: "C.UTF-8"

#########
# CACHE #
#########

standardnotes_redis_port: "6379"
standardnotes_redis_host: "{{ standardnotes_redis_container_name }}"
standardnotes_cache_type: "redis"

########
# KEYS #
########

standardnotes_jwt_secret: "change_me1"
standardnotes_encryption_server_key: "change_me2"
standardnotes_valet_token_secret: "change_me3"

#######
# APP #
#######
standardnotes_sf_default_server: "https://{{ standardnotes_server_hostname }}.{{ ansible_nas_domain }}"
standardnotes_app_env_port: "3001"
standardnotes_app_host: "https://{{ standardnotes_app_hostname }}.{{ ansible_nas_domain }}"
# Subscription related endpoints
standardnotes_app_dashboard_url: "http://standardnotes.com/dashboard"
standardnotes_app_plans_url: "https://standardnotes.com/plans"
standardnotes_app_purchase_url: "https://standardnotes.com/purchase"

standardnotes_subscription_email: ""
standardnotes_public_files_server_url: "https://{{ standardnotes_files_hostname }}.{{ ansible_nas_domain }}"
15 changes: 15 additions & 0 deletions roles/standardnotes/docs/standardnotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Standard Notes

Homepage: <https://standardnotes.com/>

Standard Notes is a free, secure note-taking app with powerful end-to-end encryption, unparalleled privacy features, and seamless cross-platform syncing on unlimited devices.

## Usage

Set `standardnotes_enabled: true` in your `inventories/<your_inventory>/nas.yml` file to install Standard Notes sync server.

Standard Notes sync server interface can be then found at <http://ansible_nas_host_or_ip:3011>.

Optionally, set `standardnotes_app_client_enabled: true` to install Standard Notes Client Web App.

After server installation and creating of admin user, set `standardnotes_subscription_email` to the admin user email, set `standardnotes_enable_subscription: true` and re-run the playbook to enable subscription features.
7 changes: 7 additions & 0 deletions roles/standardnotes/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
provisioner:
inventory:
group_vars:
all:
standardnotes_enabled: true
standardnotes_app_client_enabled: true
10 changes: 10 additions & 0 deletions roles/standardnotes/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:
standardnotes_enabled: false
47 changes: 47 additions & 0 deletions roles/standardnotes/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Include vars
ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Get standardnotes localstack container state
community.docker.docker_container:
name: "{{ standardnotes_localstack_container_name }}"
register: result_localstack

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

- name: Get standardnotes redis container state
community.docker.docker_container:
name: "{{ standardnotes_redis_container_name }}"
register: result_redis

- name: Get standardnotes container state
community.docker.docker_container:
name: "{{ standardnotes_container_name }}"
register: result

- name: Get standardnotes web app container state
community.docker.docker_container:
name: "{{ standardnotes_app_container_name }}"
register: result_app

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

- name: Try and stop and remove standardnotes redis
community.docker.docker_container:
name: "{{ standardnotes_redis_container_name }}"
state: absent
register: result_redis

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

- name: Try and stop and remove standardnotes localstack
community.docker.docker_container:
name: "{{ standardnotes_localstack_container_name }}"
state: absent
register: result_localstack

- name: Try and stop and remove standardnotes web app
community.docker.docker_container:
name: "{{ standardnotes_app_container_name }}"
state: absent
register: result_app

- name: Check if standardnotes is stopped
ansible.builtin.assert:
that:
- not result.changed
- not result_redis.changed
- not result_db.changed
- not result_localstack.changed
- not result_app.changed
Loading

0 comments on commit 3018cb6

Please sign in to comment.