User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
services:olivetin [2025/05/06 07:44] – [OliveTin on subdomain] willyservices:olivetin [2025/05/11 18:27] (current) – [Configuration] willy
Line 97: Line 97:
 ===== Configuration ===== ===== Configuration =====
  
 +<file - config.yaml>
 +listenAddressSingleHTTPFrontend: 127.0.0.1:1337
 +logLevel: "INFO"
 +themeName: home
 +
 +checkForUpdates: true
 +webUIDir: /opt/olivetin/webui
 +
 +actions:
 +  - title: Check Internet
 +    shell: 'ping -c 1 1.1.1.1'
 +    icon: ping
 +    popupOnStart: default
 +
 +  - title: ISP_1
 +    shell: 'ping -c 1 192.168.0.1'
 +    icon: ping
 +    popupOnStart: default
 +
 +  - title: ISP_2
 +    shell: 'ping -c 1 192.168.1.254'
 +    icon: ping
 +    popupOnStart: default
 +
 +# Actions for containers
 +  - title: Update containers
 +    shell: '/etc/OliveTin/update_containers.sh'
 +    hidden: true
 +    execOnStartup: true
 +    execOnCron: '*/5 * * * *'
 +
 +  - title: Stop {{ container.name }}
 +    shell: '{{ container.command }} stop'
 +    icon: ping
 +    popupOnStart: execution-dialog-stdout-only
 +    entity: container
 +    triggers:
 +      - Update containers
 +
 +  - title: Update {{ container.name }}
 +    shell: '{{ container.command }} update'
 +    icon: ping
 +    popupOnStart: execution-dialog-stdout-only
 +    entity: container
 +    triggers:
 +      - Update containers
 +
 +  - title: Start {{ container.name }}
 +    shell: '{{ container.command }} start'
 +    icon: ping
 +    popupOnStart: execution-dialog-stdout-only
 +    entity: container
 +    triggers:
 +      - Update containers
 +
 +# Actions for servers
 +  - title: Update servers
 +    shell: '/etc/OliveTin/update_servers.sh'
 +    hidden: true
 +    execOnStartup: true
 +    execOnCron: '*/5 * * * *'
 +
 +  - title: ping {{ server.ip }}
 +    shell: 'ping {{ server.ip }} -c 1'
 +    icon: ping
 +    entity: server
 +
 +entities:
 +  - file: entities/servers.yaml
 +    name: server
 +
 +  - file: entities/containers.yaml
 +    name: container
 +
 +dashboards:
 +  - title: Home network
 +    contents:
 +      - title: Server {{ server.name }}
 +        type: fieldset
 +        entity: server
 +        contents:
 +          - type: display
 +            cssClass: '{{ server.status }}'
 +            title: |
 +              <strong>{{ server.name }}</strong>
 +              <strong>{{ server.ip }}</strong>
 +          - title: ping {{ server.ip }}
 +
 +  - title: servizi
 +    contents:
 +      - title: Servizio {{ container.name }}
 +        type: fieldset
 +        entity: container
 +        contents:
 +          - type: display
 +            cssClass: '{{ container.state }}'
 +            title: |
 +              <strong>{{ container.state }}</strong>
 +          - title: "Start {{ container.name }}"
 +          - title: "Stop {{ container.name }}"
 +          - title: "Update {{ container.name }}"
 +</file>
 +
 +<file - update_containers.sh>
 +#!/bin/bash
 +
 +TARGET=/etc/OliveTin/entities/containers.yaml
 +TARGET_TEMP=${TARGET}.tmp
 +
 +test -e ${TARGET_TEMP} && rm -f ${TARGET_TEMP}
 +for i in /etc/init.d/user-containers.*
 +do
 +        name=${i##*.}
 +        $i status 2> /dev/null | grep started > /dev/null
 +        if [ $? -eq 0 ]
 +        then
 +                running=running
 +        else
 +                running=stopped
 +        fi
 +        echo "
 +- name: $name
 +  state: $running
 +  command: $i
 +" >> ${TARGET_TEMP}
 +
 +done
 +
 +test -e ${TARGET_TEMP} && mv ${TARGET_TEMP} ${TARGET}
 +</file>
 +
 +<file - update_servers.sh>
 +#!/bin/bash
 +
 +
 +TARGET=/etc/OliveTin/entities/servers.yaml
 +TARGET_TEMP=${TARGET}.tmp
 +
 +test -e ${TARGET_TEMP} && rm -f ${TARGET_TEMP}
 +
 +while read -r line
 +do
 +        clean_line=${line%%#*}
 +        ip=${clean_line%%[[:space:]]*}
 +        name=${clean_line##*[[:space:]]}
 +        status=offline
 +        if [ "$ip" != "" -a "$name" != "" -a "$ip" != "127.0.0.1" -a "$ip" != "::1" ]
 +        then
 +                (ping -c 1 -w 1 $ip 2> /dev/null > /dev/null
 +                if [ $? -eq 0 ]
 +                then
 +                        status=online
 +                fi
 +                echo "
 +- name: $name
 +  ip: $ip
 +  status: $status" >> ${TARGET_TEMP})
 +        fi
 +done < "/etc/hosts"
 +
 +wait
 +test -e ${TARGET_TEMP} && mv ${TARGET_TEMP} ${TARGET}
 +</file>
 +
 +
 +<file - theme.css>
 +div.display.running {
 +  background-color: green;
 +  color: white;
 +}
 +
 +div.display.stopped {
 +  background-color: red;
 +}
 +
 +div.display.online {
 +  background-color: green;
 +  color: white;
 +}
 +
 +div.display.offline {
 +  background-color: red;
 +}
 +</file>
  
 ===== Autostart ===== ===== Autostart =====

This website uses technical cookies only. No information is shared with anybody or used in any way but provide the website in your browser.

More information