Skip to content

Commit

Permalink
✨ Add LubeLogger (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
anarion80 authored May 1, 2024
1 parent ca41962 commit 828224b
Show file tree
Hide file tree
Showing 11 changed files with 202 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ If you have a spare domain name you can configure applications to be accessible
* [Listmonk](https://listmonk.app/) - High performance, self-hosted, newsletter and mailing list manager
* [Littlelink](https://github.com/techno-tim/littlelink-server) - Self-hosted alternative to linktree
* [Loki](https://grafana.com/oss/loki/) - Loki is a horizontally scalable, highly available, multi-tenant log aggregation system inspired by Prometheus.
* [LubeLogger](https://github.com/hargata/lubelog) - LubeLogger is a web-based vehicle maintenance and fuel mileage tracker.
* [Mattermost](https://mattermost.com/) - open source platform for secure collaboration across the entire software development lifecycle
* [MariaDB](https://mariadb.org/) - one of the most popular open source relational databases
* [Mealie](https://hay-kot.github.io/mealie/) - A self-hosted recipe manager and meal planner
Expand Down
4 changes: 4 additions & 0 deletions nas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@
tags:
- loki

- role: lubelogger
tags:
- lubelogger

- role: mattermost
tags:
- mattermost
Expand Down
41 changes: 41 additions & 0 deletions roles/lubelogger/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
lubelogger_enabled: false
lubelogger_available_externally: false

# directories
lubelogger_data_directory: "{{ docker_home }}/lubelogger"

# network
lubelogger_port: "8135"
lubelogger_hostname: "lubelogger"

# specs
lubelogger_memory: 1g

# docker
lubelogger_container_name: lubelogger
lubelogger_image_name: "ghcr.io/hargata/lubelogger"
lubelogger_image_version: latest
lubelogger_user_id: "1000"
lubelogger_group_id: "1000"

# lubelogger
lubelogger_lc_all: "en_US.UTF-8"
lubelogger_lang: "en_US.UTF-8"
lubelogger_email_server: ""
lubelogger_email_from: ""
lubelogger_email_use_ssl: "false"
lubelogger_email_port: "587"
lubelogger_email_username: ""
lubelogger_email_password: ""
lubelogger_log_level: "ERROR"
lubelogger_openidconfig_name: "" # Name of the OpenID Connect Provider
lubelogger_openidconfig_clientid: "" # Client Id to Authenticate with the Provider
lubelogger_openidconfig_clientsecret: "" # Client Secret to Authenticate with the Provider
lubelogger_openidconfig_authurl: "" # Authorization URL to the Provider's Login Page
lubelogger_openidconfig_tokenurl: "" # URL to retrieve user JWT from the Provider
lubelogger_openidconfig_redirecturl: "" # https://<yourlubeloggerdomain.com>/Login/RemoteAuth(must be HTTPS)
lubelogger_openidconfig_scope: "" # The scope for retrieving the user's email claim(usually it's just 'email')
lubelogger_openidconfig_validatestate: "false" # true/false(default: false) - whether LubeLogger should validate state.
lubelogger_openidconfig_disableregularlogin: "false" # true/false(default: false) - auto re-direct user to OIDC login.
lubelogger_openidconfig_logouturl: "" # Log Out URL for OIDC Provider, required if DisableRegularLogin=true.
11 changes: 11 additions & 0 deletions roles/lubelogger/docs/lubelogger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# LubeLogger

Homepage: [https://github.com/hargata/lubelog](https://github.com/hargata/lubelog)

LubeLogger is a web-based vehicle maintenance and fuel mileage tracker

## Usage

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

lubelogger web interface can be found at [http://ansible_nas_host_or_ip:8135](http://ansible_nas_host_or_ip:8135).
6 changes: 6 additions & 0 deletions roles/lubelogger/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
provisioner:
inventory:
group_vars:
all:
lubelogger_enabled: true
10 changes: 10 additions & 0 deletions roles/lubelogger/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:
lubelogger_enabled: false
19 changes: 19 additions & 0 deletions roles/lubelogger/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 lubelogger container state
community.docker.docker_container:
name: "{{ lubelogger_container_name }}"
register: result

- name: Check if lubelogger containers are running
ansible.builtin.assert:
that:
- result.container['State']['Status'] == "running"
- result.container['State']['Restarting'] == false
19 changes: 19 additions & 0 deletions roles/lubelogger/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 lubelogger
community.docker.docker_container:
name: "{{ lubelogger_container_name }}"
state: absent
register: result

- name: Check if lubelogger is stopped
ansible.builtin.assert:
that:
- not result.changed
1 change: 1 addition & 0 deletions roles/lubelogger/requirements.yml
76 changes: 76 additions & 0 deletions roles/lubelogger/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
- name: Start Lubelogger
block:
- name: Create Lubelogger Directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
with_items:
- "{{ lubelogger_data_directory }}"
- "{{ lubelogger_data_directory }}/config"
- "{{ lubelogger_data_directory }}/data"
- "{{ lubelogger_data_directory }}/translations"
- "{{ lubelogger_data_directory }}/documents"
- "{{ lubelogger_data_directory }}/images"
- "{{ lubelogger_data_directory }}/temp"
- "{{ lubelogger_data_directory }}/log"
- "{{ lubelogger_data_directory }}/keys"

- name: Create Lubelogger Docker Container
community.docker.docker_container:
container_default_behavior: no_defaults
name: "{{ lubelogger_container_name }}"
image: "{{ lubelogger_image_name }}:{{ lubelogger_image_version }}"
pull: true
volumes:
- "{{ lubelogger_data_directory }}/config:/App/config"
- "{{ lubelogger_data_directory }}/data:/App/data"
- "{{ lubelogger_data_directory }}/translations:/App/wwwroot/translations"
- "{{ lubelogger_data_directory }}/documents:/App/wwwroot/documents"
- "{{ lubelogger_data_directory }}/images:/App/wwwroot/images"
- "{{ lubelogger_data_directory }}/temp:/App/wwwroot/temp"
- "{{ lubelogger_data_directory }}/log:/App/log"
- "{{ lubelogger_data_directory }}/keys:/root/.aspnet/DataProtection-Keys"
ports:
- "{{ lubelogger_port }}:8080"
env:
TZ: "{{ ansible_nas_timezone }}"
PUID: "{{ lubelogger_user_id | quote }}"
PGID: "{{ lubelogger_group_id | quote }}"
LC_ALL: "{{ lubelogger_lc_all }}"
LANG: "{{ lubelogger_lang }}"
MailConfig__EmailServer: "{{ lubelogger_email_server }}"
MailConfig__EmailFrom: "{{ lubelogger_email_from }}"
MailConfig__UseSSL: "{{ lubelogger_email_use_ssl }}"
MailConfig__Port: "{{ lubelogger_email_port }}"
MailConfig__Username: "{{ lubelogger_email_username }}"
MailConfig__Password: "{{ lubelogger_email_password }}"
LOGGING__LOGLEVEL__DEFAULT: "{{ lubelogger_log_level }}"
OpenIDConfig__Name: "{{ lubelogger_openidconfig_name }}"
OpenIDConfig__ClientId: "{{ lubelogger_openidconfig_clientid }}"
OpenIDConfig__ClientSecret: "{{ lubelogger_openidconfig_clientsecret }}"
OpenIDConfig__AuthURL: "{{ lubelogger_openidconfig_authurl }}"
OpenIDConfig__TokenURL: "{{ lubelogger_openidconfig_tokenurl }}"
OpenIDConfig__RedirectURL: "{{ lubelogger_openidconfig_redirecturl }}"
OpenIDConfig__Scope: "{{ lubelogger_openidconfig_scope }}"
OpenIDConfig__ValidateState: "{{ lubelogger_openidconfig_validatestate }}"
OpenIDConfig__DisableRegularLogin: "{{ lubelogger_openidconfig_disableregularlogin }}"
OpenIDConfig__LogOutURL: "{{ lubelogger_openidconfig_logouturl }}"
restart_policy: unless-stopped
memory: "{{ lubelogger_memory }}"
labels:
traefik.enable: "{{ lubelogger_available_externally | string }}"
traefik.http.routers.lubelogger.rule: "Host(`{{ lubelogger_hostname }}.{{ ansible_nas_domain }}`)"
traefik.http.routers.lubelogger.tls.certresolver: "letsencrypt"
traefik.http.routers.lubelogger.tls.domains[0].main: "{{ ansible_nas_domain }}"
traefik.http.routers.lubelogger.tls.domains[0].sans: "*.{{ ansible_nas_domain }}"
traefik.http.services.lubelogger.loadbalancer.server.port: "8080"
when: lubelogger_enabled is true

- name: Stop Lubelogger
block:
- name: Stop Lubelogger
community.docker.docker_container:
name: "{{ lubelogger_container_name }}"
state: absent
when: lubelogger_enabled is false
14 changes: 14 additions & 0 deletions website/docs/applications/other/lubelogger.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: "LubeLogger"
description: "LubeLogger is a web-based vehicle maintenance and fuel mileage tracker"
---

Homepage: [https://github.com/hargata/lubelog](https://github.com/hargata/lubelog)

LubeLogger is a web-based vehicle maintenance and fuel mileage tracker

## Usage

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

lubelogger web interface can be found at [http://ansible_nas_host_or_ip:8135](http://ansible_nas_host_or_ip:8135).

0 comments on commit 828224b

Please sign in to comment.