feature: entities wip (#226)
This commit is contained in:
parent
759e747f54
commit
5b0cfb5c33
38
config.yaml
38
config.yaml
|
|
@ -8,26 +8,40 @@ listenAddressSingleHTTPFrontend: 0.0.0.0:1337
|
||||||
# Choose from INFO (default), WARN and DEBUG
|
# Choose from INFO (default), WARN and DEBUG
|
||||||
logLevel: "INFO"
|
logLevel: "INFO"
|
||||||
|
|
||||||
|
entities:
|
||||||
|
- name: container
|
||||||
|
file: /etc/OliveTin/entities/containers.yaml
|
||||||
|
icon: container
|
||||||
|
|
||||||
|
helpers:
|
||||||
|
- title: refresh container file
|
||||||
|
shell: "docker ps --format '{{ .state }}' > /etc/OliveTin/entities/containers.yaml"
|
||||||
|
execOnStartup: true
|
||||||
|
execOnCron:
|
||||||
|
- "*/1 * * * * *"
|
||||||
|
|
||||||
# Actions (buttons) to show up on the WebUI:
|
# Actions (buttons) to show up on the WebUI:
|
||||||
actions:
|
actions:
|
||||||
- title: date
|
- title: date
|
||||||
shell: date
|
shell: date
|
||||||
icon: clock
|
icon: clock
|
||||||
popupOnStart: true
|
popupOnStart: true
|
||||||
|
|
||||||
|
- title: start
|
||||||
|
shell: docker start {{ container.name }}
|
||||||
|
icon: start
|
||||||
|
entity: container
|
||||||
|
|
||||||
# This will run a simple script that you create.
|
# This will run a simple script that you create.
|
||||||
- title: Run backup script
|
- title: Run backup script
|
||||||
shell: /opt/backupScript.sh
|
shell: /opt/backupScript.sh
|
||||||
shellAfterCompleted: "apprise -t 'Notification: Backup script completed' -b 'The backup script completed with code {{ exitCode}}. The log is: \n {{ stdout }} '"
|
shellAfterCompleted: "apprise -t 'Notification: Backup script completed' -b 'The backup script completed with code {{ exitCode}}. The log is: \n {{ stdout }} '"
|
||||||
maxConcurrent: 1
|
maxConcurrent: 1
|
||||||
icon: backup
|
icon: backup
|
||||||
execOnCron: # https://docs.olivetin.app/exec-cron.html
|
|
||||||
- "@monthly" # Once per month
|
|
||||||
- "0 12 25 12 *" # And on Christmas day!
|
|
||||||
|
|
||||||
# This will send 1 ping (-c 1)
|
# This will send 1 ping (-c 1)
|
||||||
# Docs: https://docs.olivetin.app/action-ping.html
|
# Docs: https://docs.olivetin.app/action-ping.html
|
||||||
- title: Ping host
|
- title: Ping host
|
||||||
shell: ping {{ host }} -c {{ count }}
|
shell: ping {{ host }} -c {{ count }}
|
||||||
icon: ping
|
icon: ping
|
||||||
timeout: 100
|
timeout: 100
|
||||||
|
|
@ -46,7 +60,7 @@ actions:
|
||||||
|
|
||||||
# Restart lightdm on host "server1"
|
# Restart lightdm on host "server1"
|
||||||
# Docs: https://docs.olivetin.app/action-ping.html
|
# Docs: https://docs.olivetin.app/action-ping.html
|
||||||
- title: restart httpd
|
- title: restart httpd
|
||||||
titleAlias: restart_httpd
|
titleAlias: restart_httpd
|
||||||
icon: restart
|
icon: restart
|
||||||
shell: ssh root@server1 'service httpd restart'
|
shell: ssh root@server1 'service httpd restart'
|
||||||
|
|
@ -57,7 +71,7 @@ actions:
|
||||||
# you are running OliveTin, or in the container.
|
# you are running OliveTin, or in the container.
|
||||||
#
|
#
|
||||||
# You probably want a much longer timeout as well (so that ansible completes).
|
# You probably want a much longer timeout as well (so that ansible completes).
|
||||||
- title: "Run Ansible Playbook"
|
- title: "Run Ansible Playbook"
|
||||||
icon: "🇦"
|
icon: "🇦"
|
||||||
shell: ansible-playbook -i /etc/hosts /root/myRepo/myPlaybook.yaml
|
shell: ansible-playbook -i /etc/hosts /root/myRepo/myPlaybook.yaml
|
||||||
timeout: 120
|
timeout: 120
|
||||||
|
|
@ -68,7 +82,7 @@ actions:
|
||||||
# see the docs below.
|
# see the docs below.
|
||||||
#
|
#
|
||||||
# Docs: https://docs.olivetin.app/action-container-control.html
|
# Docs: https://docs.olivetin.app/action-container-control.html
|
||||||
- title: Restart Docker Container
|
- title: Restart Docker Container
|
||||||
icon: restart
|
icon: restart
|
||||||
shell: docker restart {{ container }}
|
shell: docker restart {{ container }}
|
||||||
arguments:
|
arguments:
|
||||||
|
|
@ -79,17 +93,17 @@ actions:
|
||||||
- value: traefik
|
- value: traefik
|
||||||
- value: grafana
|
- value: grafana
|
||||||
|
|
||||||
- title: Slow Script
|
- title: Slow Script
|
||||||
shell: sleep 3
|
shell: sleep 3
|
||||||
timeout: 5
|
timeout: 5
|
||||||
icon: "🥱"
|
icon: "🥱"
|
||||||
|
|
||||||
- title: Broken Script (timeout)
|
- title: Broken Script (timeout)
|
||||||
shell: sleep 5
|
shell: sleep 5
|
||||||
timeout: 5
|
timeout: 5
|
||||||
icon: "😪"
|
icon: "😪"
|
||||||
|
|
||||||
- title: Delete old backups
|
- title: Delete old backups
|
||||||
icon: ashtonished
|
icon: ashtonished
|
||||||
shell: rm -rf /opt/oldBackups/
|
shell: rm -rf /opt/oldBackups/
|
||||||
arguments:
|
arguments:
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ type Action struct {
|
||||||
CSS map[string]string `mapstructure:"omitempty"`
|
CSS map[string]string `mapstructure:"omitempty"`
|
||||||
Timeout int
|
Timeout int
|
||||||
Acls []string
|
Acls []string
|
||||||
|
Entity []string
|
||||||
ExecOnStartup bool
|
ExecOnStartup bool
|
||||||
ExecOnCron []string
|
ExecOnCron []string
|
||||||
ExecOnFileCreatedInDir []string
|
ExecOnFileCreatedInDir []string
|
||||||
|
|
@ -37,12 +38,22 @@ type ActionArgumentChoice struct {
|
||||||
Title string
|
Title string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HelperAction is an action that is used normally to generate entities, it cannot be started manually.
|
||||||
|
type HelperAction struct {
|
||||||
|
Title string
|
||||||
|
Shell string
|
||||||
|
ExecOnStartup bool
|
||||||
|
ExecOnCron []string
|
||||||
|
ExecOnFileCreatedInDir []string
|
||||||
|
ExecOnFileChangedInDir []string
|
||||||
|
}
|
||||||
|
|
||||||
// Entity represents a "thing" that can have multiple actions associated with it.
|
// Entity represents a "thing" that can have multiple actions associated with it.
|
||||||
// for example, a media player with a start and stop action.
|
// for example, a media player with a start and stop action.
|
||||||
type Entity struct {
|
type EntityFile struct {
|
||||||
Title string
|
File string
|
||||||
|
Name string
|
||||||
Icon string
|
Icon string
|
||||||
Actions []Action `mapstructure:"actions"`
|
|
||||||
CSS map[string]string
|
CSS map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,8 +83,8 @@ type Config struct {
|
||||||
ExternalRestAddress string
|
ExternalRestAddress string
|
||||||
LogLevel string
|
LogLevel string
|
||||||
Actions []Action `mapstructure:"actions"`
|
Actions []Action `mapstructure:"actions"`
|
||||||
|
Entities []EntityFile `mapstructure:"entities"`
|
||||||
Dashboards []DashboardItem `mapstructure:"dashboards"`
|
Dashboards []DashboardItem `mapstructure:"dashboards"`
|
||||||
Entities []Entity `mapstructure:"entities"`
|
|
||||||
CheckForUpdates bool
|
CheckForUpdates bool
|
||||||
PageTitle string
|
PageTitle string
|
||||||
ShowFooter bool
|
ShowFooter bool
|
||||||
|
|
@ -89,6 +100,7 @@ type Config struct {
|
||||||
DefaultPermissions PermissionsList
|
DefaultPermissions PermissionsList
|
||||||
AccessControlLists []AccessControlList
|
AccessControlLists []AccessControlList
|
||||||
WebUIDir string
|
WebUIDir string
|
||||||
|
HelperActions []HelperAction `mapstructure:"helperActions"`
|
||||||
CronSupportForSeconds bool
|
CronSupportForSeconds bool
|
||||||
SectionNavigationStyle string
|
SectionNavigationStyle string
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
sonarr:
|
||||||
|
state: started
|
||||||
|
plex:
|
||||||
|
state: started
|
||||||
|
sabnzbd:
|
||||||
|
state: stopped
|
||||||
Loading…
Reference in New Issue