Skip to content

Commit

Permalink
Merge pull request #126 from anarion80/add_homarr
Browse files Browse the repository at this point in the history
✨ Add Homarr
  • Loading branch information
anarion80 authored May 8, 2024
2 parents 2c51c1e + 0a4d796 commit 803ccb3
Show file tree
Hide file tree
Showing 11 changed files with 177 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ If you have a spare domain name you can configure applications to be accessible
* [HA Fusion](https://github.com/matt8707/ha-fusion) - A modern, easy-to-use and performant custom Home Assistant dashboard
* [healthchecks.io](https://healthchecks.io/) - Ensure your NAS is online and get notified otherwise
* [Heimdall](https://heimdall.site/) - Home server dashboard
* [Homarr](https://github.com/ajnart/homarr) - Customizable browser's home page
* [Home Assistant](https://www.home-assistant.io) - Open source home automation
* [Homebridge](https://github.com/nfarina/homebridge) - Emulate the iOS HomeKit API
* [Homepage](https://gethomepage.dev/) - Highly customizable application dashboard with integrations for over 100 services.
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@
tags:
- hello_world

- role: homarr
tags:
- homarr

- role: homeassistant
tags:
- homeassistant
Expand Down
36 changes: 36 additions & 0 deletions roles/homarr/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
homarr_enabled: false
homarr_available_externally: false

# directories
homarr_data_directory: "{{ docker_home }}/homarr"

# network
homarr_port: "7575"
homarr_hostname: "homarr"

# specs
homarr_memory: 1g

# docker
homarr_container_name: homarr
homarr_image_name: "ghcr.io/ajnart/homarr"
homarr_image_version: latest
homarr_user_id: "1000"
homarr_group_id: "1000"

# homarr
homarr_database_url: "file:/data/db.sqlite"

# Next Auth
# You can generate a new secret on the command line with:
# openssl rand -base64 32
# https://next-auth.js.org/configuration/options#secret
homarr_nextauth_url: "http://localhost:7575"

homarr_nextauth_secret: "anything"

# Disable analytics
homarr_next_public_disable_analytics: "true"

homarr_default_color_scheme: "light"
11 changes: 11 additions & 0 deletions roles/homarr/docs/homarr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Homarr

Homepage: [https://github.com/ajnart/homarr](https://github.com/ajnart/homarr)

Customizable browser's home page to interact with your homeserver's Docker containers (e.g. Sonarr/Radarr)

## Usage

Set `homarr_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file.

homarr web interface can be found at [http://ansible_nas_host_or_ip:7575](http://ansible_nas_host_or_ip:7575).
6 changes: 6 additions & 0 deletions roles/homarr/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
homarr_enabled: true
10 changes: 10 additions & 0 deletions roles/homarr/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:
homarr_enabled: false
19 changes: 19 additions & 0 deletions roles/homarr/molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Include vars
ansible.builtin.include_vars:
file: ../../defaults/main.yml

- name: Get homarr container state
community.docker.docker_container:
name: "{{ homarr_container_name }}"
register: result

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

- name: Check if homarr is stopped
ansible.builtin.assert:
that:
- not result.changed
1 change: 1 addition & 0 deletions roles/homarr/requirements.yml
56 changes: 56 additions & 0 deletions roles/homarr/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
- name: Start Homarr
block:
- name: Create Homarr Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ homarr_data_directory }}"

- name: Create Homarr Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ homarr_container_name }}"
image: "{{ homarr_image_name }}:{{ homarr_image_version }}"
pull: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock # Optional, only if you want docker integration
- "{{ homarr_data_directory }}/configs:/app/data/configs"
- "{{ homarr_data_directory }}/icons:/app/public/icons"
- "{{ homarr_data_directory }}/data:/data"
ports:
- "{{ homarr_port }}:7575"
env:
TZ: "{{ ansible_nas_timezone }}"
UID: "{{ homarr_user_id | quote }}"
GID: "{{ homarr_group_id | quote }}"
DATABASE_URL: "{{ homarr_database_url }}"

# Next Auth
# You can generate a new secret on the command line with:
# openssl rand -base64 32
# https://next-auth.js.org/configuration/options#secret
NEXTAUTH_URL: "{{ homarr_nextauth_url }}"
NEXTAUTH_SECRET: "{{ homarr_nextauth_secret }}"
# Disable analytics
NEXT_PUBLIC_DISABLE_ANALYTICS: "{{ homarr_next_public_disable_analytics }}"
DEFAULT_COLOR_SCHEME: "{{ homarr_default_color_scheme }}"
restart_policy: unless-stopped
memory: "{{ homarr_memory }}"
labels:
traefik.enable: "{{ homarr_available_externally | string }}"
traefik.http.routers.homarr.rule: "Host(`{{ homarr_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.homarr.tls.certresolver: "letsencrypt"
traefik.http.routers.homarr.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.homarr.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.homarr.loadbalancer.server.port: "7575"
when: homarr_enabled is true

- name: Stop Homarr
block:
- name: Stop Homarr
community.docker.docker_container:
name: "{{ homarr_container_name }}"
state: absent
when: homarr_enabled is false
14 changes: 14 additions & 0 deletions website/docs/applications/dashboards/homarr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: "Homarr"
description: "Customizable browser's home page to interact with your homeserver's Docker containers (e.g. Sonarr/Radarr)"
---

Homepage: [https://github.com/ajnart/homarr](https://github.com/ajnart/homarr)

Customizable browser's home page to interact with your homeserver's Docker containers (e.g. Sonarr/Radarr)

## Usage

Set `homarr_enabled: true` in your `inventories/<your_inventory>/group_vars/nas.yml` file.

homarr web interface can be found at [http://ansible_nas_host_or_ip:7575](http://ansible_nas_host_or_ip:7575).

0 comments on commit 803ccb3

Please sign in to comment.