4
0

config.yaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. # There is a built-in micro proxy that will host the webui and REST API all on
  2. # one port (this is called the "Single HTTP Frontend") and means you just need
  3. # one open port in the container/firewalls/etc.
  4. #
  5. # Listen on all addresses available, port 1337.
  6. # If the PORT environment variable is set, it overrides this port (host is kept).
  7. listenAddressSingleHTTPFrontend: 0.0.0.0:1337
  8. # Choose from INFO (default), WARN and DEBUG
  9. # Docs: https://docs.olivetin.app/advanced_configuration/logs.html
  10. logLevel: "INFO"
  11. # Actions are commands that are executed by OliveTin, and normally show up as
  12. # buttons on the WebUI.
  13. #
  14. # Docs: https://docs.olivetin.app/action_buttons/create_your_first.html
  15. actions:
  16. # Lots of people use OliveTin to build web interfaces for their electronics
  17. # projects. It's best to install OliveTin as a native package (eg, .deb), and
  18. # then you can use either a python script or the `gpio` command.
  19. - title: Toggle GPIO light
  20. shell: gpioset gpiochip1 9=1 || true # The "|| true" is to ignore errors the demo environment doesn't have GPIO access.
  21. icon: light
  22. # Lots of people also use OliveTin to monitor their servers, like checking
  23. # disk space, or checking logs. `onclick: execution-dialog` shows output.
  24. - title: Check disk space
  25. acls: [guest_actions]
  26. icon: disk
  27. exec: ["df", "-h", "/"]
  28. onclick: execution-dialog
  29. # Second webhook example: POST /webhooks?demo=disk-space
  30. execOnWebhook:
  31. - authType: none
  32. matchQuery:
  33. demo: disk-space
  34. # This uses `onclick: execution-dialog` to show a dialog with more
  35. # information about the command that was run.
  36. - title: Check shell history
  37. shell: cat ~/.bash_history
  38. icon: logs
  39. onclick: execution-dialog
  40. # Every action can still be run on demand from the web UI or API. The keys
  41. # below are optional *additional* triggers (see each action and
  42. # https://docs.olivetin.app/action_execution/ ).
  43. #
  44. # This is the most simple action, it just runs the command and flashes the
  45. # button to indicate status.
  46. #
  47. # If you are running OliveTin in a container remember to pass through the
  48. # docker socket! https://docs.olivetin.app/solutions/container-control-panel/index.html
  49. - title: Ping the Internet
  50. acls: [guest_actions]
  51. shell: ping -c 3 1.1.1.1
  52. icon: ping
  53. onclick: execution-dialog
  54. # https://docs.olivetin.app/action_execution/onstartup.html
  55. execOnStartup: true
  56. # You can also rate-limit actions too.
  57. - title: Sync Disks
  58. acls: [guest_actions]
  59. shell: sync
  60. id: syncdisks
  61. icon: disk
  62. onclick: execution-button
  63. maxRate:
  64. - limit: 3
  65. duration: 1m
  66. # You are not limited to operating system commands, and of course you can run
  67. # your own scripts. The backup-jobs action group limits how many backup-related
  68. # actions can run at once; extra requests are queued instead of blocked.
  69. # There is also a timeout that will kill the command if it runs for too long.
  70. - title: Run backup script
  71. shell: /opt/backupScript.sh
  72. shellAfterCompleted: "apprise -t 'Notification: Backup script completed' -b 'The backup script completed with code {{ exitCode}}. The log is: \n {{ output }} '"
  73. groups: [ backup-jobs ]
  74. timeout: 10
  75. icon: backup
  76. onclick: execution-dialog
  77. # https://docs.olivetin.app/action_execution/oncalendar.html
  78. # execOnCalendarFile: examples/demo-olivetin-calendar.yaml
  79. - title: Verify backup archive
  80. acls: [guest_actions]
  81. shell: sleep 3 && echo "Backup archive verified"
  82. groups: [ backup-jobs ]
  83. timeout: 30
  84. icon: backup
  85. onclick: execution-dialog
  86. # When you want to prompt users for input, that is when you should use
  87. # `arguments` - this presents a popup dialog and asks for argument values.
  88. #
  89. # Docs: https://docs.olivetin.app/action_examples/ping.html
  90. - title: Ping host
  91. acls: [guest_actions]
  92. id: ping_host
  93. shell: ping {{ host }} -c {{ count }}
  94. icon: ping
  95. timeout: 100
  96. onclick: history
  97. arguments:
  98. - name: host
  99. title: Host
  100. type: ascii_identifier
  101. default: example.com
  102. description: The host that you want to ping
  103. - name: count
  104. title: Count
  105. type: int
  106. default: 3
  107. description: How many times to do you want to ping?
  108. # Actions can be started by a webhook, as well as from the web UI. Webhook
  109. # actions must use `exec:`, not `shell:`. This one takes no arguments, so a
  110. # webhook request can only start it, not change what it runs. Replace the
  111. # command with your own script.
  112. #
  113. # Every webhook needs an `authType`. These demo webhooks use `authType: none`,
  114. # so anyone who can reach /webhooks can start them. For your own scripts, use
  115. # `authType: bearer` (or hmac-sha256) with a `secret`.
  116. #
  117. # Docs: https://docs.olivetin.app/action_execution/onwebhook.html
  118. # POST to /webhooks with the header X-OliveTin-Demo: run-script
  119. - title: Run script on webhook
  120. id: run_script_on_webhook
  121. icon: '🔗'
  122. exec: ["echo", "Webhook received. Replace this with your own script."]
  123. onclick: execution-dialog
  124. execOnWebhook:
  125. - authType: none
  126. matchHeaders:
  127. X-OliveTin-Demo: run-script
  128. # OliveTin can control containers - docker is just a command line app.
  129. #
  130. # However, if you are running in a container you will need to do some setup,
  131. # see the docs below.
  132. #
  133. # Docs: https://docs.olivetin.app/solutions/container-control-panel/index.html
  134. - title: Restart Docker Container
  135. icon: restart
  136. shell: docker restart {{ container }}
  137. arguments:
  138. - name: container
  139. title: Container name
  140. choices:
  141. - value: plex
  142. - value: traefik
  143. - value: grafana
  144. # There is a special `confirmation` argument to help against accidental clicks
  145. # on "dangerous" actions.
  146. #
  147. # Docs: https://docs.olivetin.app/args/input_confirmation.html
  148. - title: Delete old backups
  149. icon: ashtonished
  150. # A single space requires justification with no prefilled template (empty disables it).
  151. justification: " "
  152. shell: rm -rf /opt/oliveTinOldBackups/ && sleep 5
  153. arguments:
  154. - type: html
  155. title: Description
  156. default:
  157. The documentation for this action can be found at <a href = "example.com">example.com</a>.
  158. - type: confirmation
  159. title: Are you sure?!
  160. # Checklist arguments let users pick multiple predefined options. Selected
  161. # values are passed to the action as a JSON array string.
  162. #
  163. # Docs: https://docs.olivetin.app/args/input_checklist.html
  164. - title: Backup selected directories
  165. acls: [guest_actions]
  166. icon: backup
  167. shell: 'echo "Backing up: {{ directories }}"'
  168. arguments:
  169. - name: directories
  170. title: Directories to back up
  171. type: checklist
  172. description: Select one or more directories to include in the backup.
  173. choices:
  174. - title: Documents
  175. value: documents
  176. - title: Photos
  177. value: photos
  178. - title: Music
  179. value: music
  180. - title: Videos
  181. value: videos
  182. default: '["documents","photos"]'
  183. # This is an action that runs a script included with OliveTin, that will
  184. # download themes. You will still need to set theme "themeName" in your config.
  185. #
  186. # Docs: https://docs.olivetin.app/reference/reference_themes_for_users.html
  187. - title: Get OliveTin Theme
  188. exec:
  189. - "olivetin-get-theme"
  190. - "{{ themeGitRepo }}"
  191. - "{{ themeFolderName }}"
  192. icon: theme
  193. arguments:
  194. - name: themeGitRepo
  195. title: Theme's Git Repository
  196. description: Find new themes at https://olivetin.app/themes
  197. type: url
  198. - name: themeFolderName
  199. title: Theme's Folder Name
  200. type: ascii_identifier
  201. # Sometimes you want to run actions on other servers - don't overcomplicate
  202. # it, just use SSH! OliveTin includes a helper to make this easier, which is
  203. # entirely optional. You can also setup SSH manually.
  204. #
  205. # Docs: https://docs.olivetin.app/action_examples/ssh-easy.html
  206. # Docs: https://docs.olivetin.app/action_examples/ssh-manual.html
  207. - title: "Setup easy SSH"
  208. icon: ssh
  209. shell: olivetin-setup-easy-ssh
  210. onclick: execution-dialog
  211. # Here's how to use SSH with the "easy" config, to restart a service on
  212. # another server.
  213. #
  214. # Docs: https://docs.olivetin.app/action_examples/ssh-easy.html
  215. # Docs: https://docs.olivetin.app/action_examples/systemd_service.html
  216. - title: Restart httpd on server1
  217. id: restart_httpd
  218. icon: restart
  219. timeout: 1
  220. shell: ssh -F /config/ssh/easy.cfg root@server1 'service httpd restart'
  221. # There are several built-in shortcuts for the `icon` option, but you
  222. # can also just specify any HTML, this includes any unicode character,
  223. # or a <img = "..." /> link to a custom icon.
  224. #
  225. # Docs: https://docs.olivetin.app/action_customization/icons.html
  226. #
  227. # Lots of people use OliveTin to easily execute ansible-playbooks. You
  228. # probably want a much longer timeout as well (so that ansible completes).
  229. #
  230. # Docs: https://docs.olivetin.app/action_examples/ansible.html
  231. - title: "Run Automation Playbook"
  232. icon: '&#129302;'
  233. shell: ansible-playbook -i /etc/hosts /root/myRepo/myPlaybook.yaml
  234. timeout: 120
  235. # The following actions are "dummy" actions, used in a Dashboard. As long as
  236. # you have these referenced in a dashboard, they will not show up in the
  237. # `actions` view.
  238. - title: Ping hypervisor1
  239. acls: [guest_actions]
  240. shell: echo "hypervisor1 online"
  241. - title: Ping hypervisor2
  242. acls: [guest_actions]
  243. shell: echo "hypervisor2 online"
  244. - title: Ping hypervisor3
  245. acls: [guest_actions]
  246. shell: echo "hypervisor3 online"
  247. - title: Ping hypervisor4
  248. acls: [guest_actions]
  249. shell: echo "hypervisor4 online"
  250. - title: "{{ server.name }} Wake on Lan"
  251. acls: [guest_actions]
  252. shell: echo "Sending Wake on LAN to {{ server.hostname }}"
  253. icon: <iconify-icon icon="carbon:awake"></iconify-icon>
  254. entity: server
  255. - title: "{{ server.name }} Power Off"
  256. acls: [guest_actions]
  257. shell: "echo 'Power Off Server: {{ server.hostname }}'"
  258. icon: <iconify-icon icon="carbon:flash-off"></iconify-icon>
  259. entity: server
  260. - title: "{{ server.name }} Print server name"
  261. acls: [guest_actions]
  262. shell: 'echo "Server name: {{ server.name }}"'
  263. entity: server
  264. - title: Ping All Servers
  265. acls: [guest_actions]
  266. shell: "echo 'Ping all servers'"
  267. icon: ping
  268. # https://docs.olivetin.app/action_execution/onfilecreated.html
  269. # mkdir -p /tmp/olivetin-demo-file-created
  270. # execOnFileCreatedInDir:
  271. # - /tmp/olivetin-demo-file-created
  272. - title: Start {{ .CurrentEntity.Names }}
  273. icon: box
  274. shell: docker start {{ .CurrentEntity.Names }}
  275. entity: container
  276. triggers: ["Update container entity file"]
  277. - title: Stop {{ .CurrentEntity.Names }}
  278. icon: box
  279. shell: docker stop {{ .CurrentEntity.Names }}
  280. entity: container
  281. triggers: ["Update container entity file"]
  282. - title: Long running action
  283. acls: [guest_actions]
  284. shell: sleep 300
  285. timeout: 300
  286. icon: logs
  287. onclick: execution-dialog
  288. groups: [ con2queue10 ]
  289. execOnCron:
  290. - "@hourly"
  291. # Lastly, you can hide actions from the web UI, this is useful for creating
  292. # background helpers that execute only on startup or a cron, for updating
  293. # entity files.
  294. # - title: Update container entity file
  295. # shell: 'docker ps -a --format json > /etc/OliveTin/entities/containers.json'
  296. # hidden: true
  297. # execOnStartup: true
  298. # execOnCron: '*/1 * * * *'
  299. # An entity is something that exists - a "thing", like a VM, or a Container
  300. # is an entity. OliveTin allows you to then dynamically generate actions based
  301. # around these entities.
  302. #
  303. # This is really useful if you want to generate wake on lan or poweroff actions
  304. # for `server` entities, for example.
  305. #
  306. # A very popular use case that entities were designed for was for `container`
  307. # entities - in a similar way you could generate `start`, `stop`, and `restart`
  308. # container actions.
  309. #
  310. # Entities are just loaded fome files on disk, OliveTin will also watch these
  311. # files for updates while OliveTin is running, and update entities.
  312. #
  313. # Entities can have properties defined in those files, and those can be used
  314. # in your configuration as variables. For example; `container.status`,
  315. # or `vm.hostname`.
  316. #
  317. # Docs: https://docs.olivetin.app/entities/intro.html
  318. entities:
  319. # YAML files are the default expected format, so you can use .yml or .yaml,
  320. # or even .txt, as long as the file contains valid a valid yaml LIST, then it
  321. # will load properly.
  322. #
  323. # Docs: https://docs.olivetin.app/entities/intro.html
  324. - file: entities/servers.yaml
  325. name: server
  326. icon: ssh
  327. properties:
  328. - name: hostname
  329. title: Hostname
  330. - name: ip
  331. title: IP
  332. - file: entities/containers.json
  333. name: container
  334. # Action groups share a concurrency limit across multiple actions. When the
  335. # limit is reached, additional requests are queued and run in order.
  336. # Docs: https://docs.olivetin.app/action_customization/concurrency.html#action-groups
  337. actionGroups:
  338. backup-jobs:
  339. maxConcurrent: 1
  340. icon: backup
  341. con2queue10:
  342. maxConcurrent: 2
  343. queueSize: 10
  344. # Dashboards are a way of taking actions from the default "actions" view, and
  345. # organizing them into groups - either into folders, or fieldsets.
  346. #
  347. # The only way to properly use entities, are to use them with a `fieldset` on
  348. # a dashboard.
  349. #
  350. # Docs: https://docs.olivetin.app/dashboards/intro.html
  351. dashboards:
  352. # Top level items are dashboards. Optional `category` groups them under
  353. # collapsible headings in the sidebar (same label = same group).
  354. - title: My Servers
  355. category: Infrastructure
  356. contents:
  357. - title: All Servers
  358. type: fieldset
  359. contents:
  360. # The contents of a dashboard will try to look for an action with a
  361. # matching title IF the `contents: ` property is empty.
  362. - title: Ping All Servers
  363. # If you create an item with some "contents:", OliveTin will show that as
  364. # directory.
  365. - title: Hypervisors
  366. contents:
  367. - title: Ping hypervisor1
  368. - title: Ping hypervisor2
  369. - title: More hypervisors
  370. type: directory
  371. contents:
  372. - title: Ping hypervisor3
  373. - title: Ping hypervisor4
  374. # If you specify `type: fieldset` and some `contents`, it will show your
  375. # actions grouped together without a folder.
  376. - type: fieldset
  377. entity: server
  378. title: 'Server: {{ .CurrentEntity.hostname }}'
  379. contents:
  380. # By default OliveTin will look for an action with a matching title
  381. # and put it on the dashboard.
  382. #
  383. # Fieldsets also support `type: display`, which can display arbitary
  384. # text. This is useful for displaying things like a container's state.
  385. - type: display
  386. title: |
  387. Hostname: <strong>{{ server.name }}</strong>
  388. IP Address: <strong>{{ server.ip }}</strong>
  389. # These are the actions (defined above) that we want on the dashboard.
  390. - title: '{{ server.name }} Wake on Lan'
  391. - title: '{{ server.name }} Power Off'
  392. - title: More Options
  393. type: directory
  394. contents:
  395. - title: '{{ server.name }} Print server name'
  396. # Second dashboard — same category as My Servers, so both appear under
  397. # "Infrastructure" in the sidebar.
  398. - title: My Containers
  399. category: Infrastructure
  400. contents:
  401. - title: 'Container {{ .CurrentEntity.Names }} ({{ .CurrentEntity.Image }})'
  402. entity: container
  403. type: fieldset
  404. contents:
  405. - type: display
  406. title: |
  407. {{ container.RunningFor }} <br /><br /><strong>{{ container.State }}</strong>
  408. - title: 'Start {{ .CurrentEntity.Names }}'
  409. - title: 'Stop {{ .CurrentEntity.Names }}'
  410. # Security - Authentication
  411. # This setting effectively enables or disables guests.
  412. # If set to "true", then users will have to login to do anything.
  413. authRequireGuestsToLogin: false
  414. # This form of auth is the simplest to setup - just define users and passwords
  415. # in the config. OliveTin also supports header-based auth, OAuth2,
  416. # and JWT authentication which are documented separately.
  417. #
  418. # Docs: https://docs.olivetin.app/security/local.html
  419. #
  420. # How to get a hashed password:
  421. # Docs: https://docs.olivetin.app/security/local.html#_get_a_argon2id_hashed_password
  422. authLocalUsers:
  423. enabled: true
  424. # users:
  425. # - username: alice
  426. # usergroup: admins
  427. # password: "$argon2id$v=19$m=65536,t=4,p=2$puyxA0s555TSFx7hnFLCXA$PyhLGpZtvpMMvc2DgMWkM8OJMKO55euwV5gm//1iwx4"
  428. # Security - Access Control
  429. # Policies affect the whole app (eg: ability to view the log list).
  430. # Docs: https://docs.olivetin.app/security/acl.html
  431. defaultPolicy:
  432. showDiagnostics: true
  433. showLogList: true
  434. # Permissions affect actions (eg: ability to view a specific log).
  435. #
  436. # Guests can see every action, but can only run the harmless demo actions that
  437. # carry `acls: [guest_actions]`. Everything else needs a user in the "admins"
  438. # usergroup. Only give guests actions that you are happy for anyone who can
  439. # reach OliveTin to run.
  440. # Docs: https://docs.olivetin.app/security/acl.html
  441. defaultPermissions:
  442. view: true
  443. exec: false
  444. logs: false
  445. kill: false
  446. # OliveTin uses access control lists to match up policy and permissions to users.
  447. # Docs: https://docs.olivetin.app/security/acl.html
  448. accessControlLists:
  449. # Admins can do everything with every action.
  450. - name: admin_acl
  451. matchUsergroups: ["admins"]
  452. addToEveryAction: true
  453. policy:
  454. showDiagnostics: true
  455. permissions:
  456. view: true
  457. exec: true
  458. logs: true
  459. kill: true
  460. # Guests can run the demo actions that list this ACL. Add your own
  461. # usergroups here to let logged in users run them too.
  462. - name: guest_actions
  463. matchUsergroups: ["guest"]
  464. permissions:
  465. view: true
  466. exec: true
  467. logs: true
  468. kill: true
  469. # Actions started by execOnStartup, execOnCron, execOnWebhook and the other
  470. # triggers run as the "system" usergroup. Triggers only start the actions
  471. # you configured them on.
  472. - name: system_triggers
  473. matchUsergroups: ["system"]
  474. addToEveryAction: true
  475. permissions:
  476. exec: true
  477. # OliveTin contains many more configuration options not in this default config.
  478. # Check out docs.olivetin.app for a setting if you feel like you're missing something.