diff --git a/README.md b/README.md index 755c1c5bc0..c6be4d950b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/nas.yml b/nas.yml index 1027d5e1fa..71433ce97f 100644 --- a/nas.yml +++ b/nas.yml @@ -386,6 +386,10 @@ tags: - loki + - role: lubelogger + tags: + - lubelogger + - role: mattermost tags: - mattermost diff --git a/roles/lubelogger/defaults/main.yml b/roles/lubelogger/defaults/main.yml new file mode 100644 index 0000000000..ed1554cebf --- /dev/null +++ b/roles/lubelogger/defaults/main.yml @@ -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:///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. diff --git a/roles/lubelogger/docs/lubelogger.md b/roles/lubelogger/docs/lubelogger.md new file mode 100644 index 0000000000..35b5a06124 --- /dev/null +++ b/roles/lubelogger/docs/lubelogger.md @@ -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//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). diff --git a/roles/lubelogger/molecule/default/molecule.yml b/roles/lubelogger/molecule/default/molecule.yml new file mode 100644 index 0000000000..83b5fac155 --- /dev/null +++ b/roles/lubelogger/molecule/default/molecule.yml @@ -0,0 +1,6 @@ +--- +provisioner: + inventory: + group_vars: + all: + lubelogger_enabled: true diff --git a/roles/lubelogger/molecule/default/side_effect.yml b/roles/lubelogger/molecule/default/side_effect.yml new file mode 100644 index 0000000000..bf6c9e9bf2 --- /dev/null +++ b/roles/lubelogger/molecule/default/side_effect.yml @@ -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 diff --git a/roles/lubelogger/molecule/default/verify.yml b/roles/lubelogger/molecule/default/verify.yml new file mode 100644 index 0000000000..445a9e11fd --- /dev/null +++ b/roles/lubelogger/molecule/default/verify.yml @@ -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 diff --git a/roles/lubelogger/molecule/default/verify_stopped.yml b/roles/lubelogger/molecule/default/verify_stopped.yml new file mode 100644 index 0000000000..f2f8415258 --- /dev/null +++ b/roles/lubelogger/molecule/default/verify_stopped.yml @@ -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 diff --git a/roles/lubelogger/requirements.yml b/roles/lubelogger/requirements.yml new file mode 120000 index 0000000000..9a736435ab --- /dev/null +++ b/roles/lubelogger/requirements.yml @@ -0,0 +1 @@ +../../requirements.yml \ No newline at end of file diff --git a/roles/lubelogger/tasks/main.yml b/roles/lubelogger/tasks/main.yml new file mode 100644 index 0000000000..cb9bcdde74 --- /dev/null +++ b/roles/lubelogger/tasks/main.yml @@ -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 diff --git a/website/docs/applications/other/lubelogger.md b/website/docs/applications/other/lubelogger.md new file mode 100644 index 0000000000..15398b8040 --- /dev/null +++ b/website/docs/applications/other/lubelogger.md @@ -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//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).