Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Grocy #635

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ If you have a spare domain name you can configure applications to be accessible
## Available Applications

* [Airsonic](https://airsonic.github.io/) - catalog and stream music
* [Barcode Buddy](https://github.com/Forceu/barcodebuddy/) - Barcode system for Grocy
* [Bazarr](https://github.com/morpheus65535/bazarr) - companion to Radarr and Sonarr for downloading subtitles
* [Bitwarden](https://github.com/dani-garcia/vaultwarden) - Password Manger (Technically Vaultwarden, a lightweight implementation in Rust)
* [Booksonic](https://booksonic.org/) - The selfhosted audiobook server
Expand All @@ -42,6 +43,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Glances](https://nicolargo.github.io/glances/) - for seeing the state of your system via a web browser
* [Gotify](https://gotify.net/) - Self-hosted server for sending push notifications
* [Grafana](https://grafana.com/) - Query, visualize, alert on, and understand your data no matter where it’s stored (via stats role).
* [Grocy](https://grocy.info/) - web-based self-hosted groceries & household management solution for your home
* [Guacamole](https://guacamole.apache.org/) - Web based remote desktop gateway, supports VNC, RDP and SSH
* [healthchecks.io](https://healthchecks.io/) - Ensure your NAS is online and get notified otherwise
* [Heimdall](https://heimdall.site/) - Home server dashboard
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@
- gotify
when: (gotify_enabled | default(False))

- role: grocy
tags:
- grocy

- role: guacamole
tags:
- guacamole
Expand Down
37 changes: 37 additions & 0 deletions roles/grocy/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
grocy_enabled: false
grocy_bbuddy_enabled: false
grocy_available_externally: false
grocy_bbuddy_available_externally: false

# directories
grocy_data_directory: "{{ docker_home }}/grocy"

# network
grocy_port: "9283"
grocy_hostname: "grocy"
grocy_bbuddy_http_port: "9284"
grocy_bbuddy_https_port: "9285"
grocy_bbuddy_hostname: "barcodebuddy"

# specs
grocy_memory: 1g
grocy_bbuddy_memory: 1g

# docker
grocy_container_name: "grocy"
grocy_image: "lscr.io/linuxserver/grocy"
grocy_tag: "latest"
grocy_user_id: "1000"
grocy_group_id: "1000"
grocy_bbuddy_container_name: "barcodebuddy"
grocy_bbuddy_image: "f0rc3/barcodebuddy"
grocy_bbuddy_tag: "latest"
grocy_bbuddy_user_id: "1000"
grocy_bbuddy_group_id: "1000"

# barcode buddy
grocy_bbuddy_scanner: false
grocy_bbuddy_ignore_ssl_ca: true
grocy_bbuddy_ignore_ssl_host: true
grocy_bbuddy_grocy_url: "https://{{ grocy_hostname }}.{{ ansible_nas_domain }}"
7 changes: 7 additions & 0 deletions roles/grocy/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
provisioner:
inventory:
group_vars:
all:
grocy_enabled: true
grocy_bbuddy_enabled: true
11 changes: 11 additions & 0 deletions roles/grocy/molecule/default/side_effect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Stop
hosts: all
become: true
tasks:
- name: "Include {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }} role"
include_role:
name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
vars:
grocy_enabled: false
grocy_bbuddy_enabled: false
26 changes: 26 additions & 0 deletions roles/grocy/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
include_vars:
file: ../../defaults/main.yml

- name: Get grocy container state
docker_container_info:
name: "{{ grocy_container_name }}"
register: result

- name: Get barcodebuddy container state
docker_container_info:
name: "{{ grocy_bbuddy_container_name }}"
register: result_bbuddy

- name: Check if grocy docker container is running
assert:
that:
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
- result_bbuddy.container['State']['Status'] == "running"
- result_bbuddy.container['State']['Restarting'] == false
26 changes: 26 additions & 0 deletions roles/grocy/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
include_vars:
file: ../../defaults/main.yml

- name: Try and stop and remove grocy
docker_container:
name: "{{ grocy_container_name }}"
state: absent
register: result

- name: Try and stop and remove barcodebuddy
docker_container:
name: "{{ grocy_bbuddy_container_name }}"
state: absent
register: result_bbuddy

- name: Check if grocy containers are stopped
assert:
that:
- not result.changed
- not result_bbuddy.changed
89 changes: 89 additions & 0 deletions roles/grocy/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
- name: Start Grocy
block:
- name: Create Grocy Directory
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ grocy_data_directory }}"

- name: Grocy Docker Container
community.docker.docker_container:
name: "{{ grocy_container_name }}"
image: "{{ grocy_image }}:{{ grocy_tag }}"
pull: true
volumes:
- "{{ grocy_data_directory }}:/config:rw"
ports:
- "{{ grocy_port }}:80"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ grocy_user_id }}"
PGID: "{{ grocy_group_id }}"
labels:
traefik.enable: "{{ grocy_available_externally | string }}"
traefik.http.routers.grocy.rule: "Host(`{{ grocy_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.grocy.tls.certresolver: "letsencrypt"
traefik.http.routers.grocy.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.grocy.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.middlewares.grocy-whitelist.ipwhitelist.ipstrategy.depth: "1"
traefik.http.middlewares.grocy-whitelist.ipwhitelist.sourcerange: "127.0.0.1/32, 192.168.0.0/16"
traefik.http.routers.grocy.middlewares: "grocy-whitelist"
traefik.http.services.grocy.loadbalancer.server.port: "80"
restart_policy: unless-stopped
memory: "{{ grocy_memory }}"

- name: Install Barcodebuddy
block:
- name: Create Barcodebuddy Directory
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ grocy_data_directory }}/barcodebuddy"

- name: Barcodebuddy Docker Container
community.docker.docker_container:
name: "{{ grocy_bbuddy_container_name }}"
image: "{{ grocy_bbuddy_image }}:{{ grocy_bbuddy_tag }}"
pull: true
volumes:
- "{{ grocy_data_directory }}/barcodebuddy:/config:rw"
ports:
- "{{ grocy_bbuddy_http_port }}:80"
- "{{ grocy_bbuddy_https_port }}:443"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ grocy_bbuddy_user_id }}"
PGID: "{{ grocy_bbuddy_group_id }}"
ATTACH_BARCODESCANNER: "{{ grocy_bbuddy_scanner | string }}"
IGNORE_SSL_CA: "{{ grocy_bbuddy_ignore_ssl_ca | string }}"
IGNORE_SSL_HOST: "{{ grocy_bbuddy_ignore_ssl_host | string }}"
BBUDDY_EXTERNAL_GROCY_URL: "{{ grocy_bbuddy_grocy_url }}"
labels:
traefik.enable: "{{ grocy_bbuddy_available_externally | string }}"
traefik.http.routers.barcodebuddy.rule: "Host(`{{ grocy_bbuddy_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.barcodebuddy.tls.certresolver: "letsencrypt"
traefik.http.routers.barcodebuddy.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.barcodebuddy.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.barcodebuddy.loadbalancer.server.port: "80"
restart_policy: unless-stopped
memory: "{{ grocy_bbuddy_memory }}"
when: grocy_bbuddy_enabled is true
when: grocy_enabled is true

- name: Stop grocy
block:
- name: Stop grocy
community.docker.docker_container:
name: "{{ grocy_container_name }}"
state: absent

- name: Stop Barcodebuddy
community.docker.docker_container:
name: "{{ grocy_bbuddy_container_name }}"
state: absent
when: grocy_bbuddy_enabled is false

when: grocy_enabled is false
16 changes: 16 additions & 0 deletions website/docs/applications/other/grocy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: "Grocy"
---

Homepage: <https://grocy.info/>

grocy is a web-based self-hosted groceries & household management solution for your home.

## Usage

Set `grocy_enabled: true` in your `inventories/<your_inventory>/nas.yml` file. Optionally, set `grocy_bbuddy_enabled: true` to install Barcode Buddy - a barcode system for Grocy.

Set all `grocy_*` variables in `inventories/<your_inventory>/group_vars/all.yml`.

The grocy web interface can be found at <http://ansible_nas_host_or_ip:9283>.
Optionally, Barcode Buddy interface can be found at <http://ansible_nas_host_or_ip:9284>.