bundles/octoprint: introduce
This commit is contained in:
parent
d6799088c4
commit
04c632953d
3 changed files with 56 additions and 0 deletions
15
bundles/octoprint/files/octoprint.service
Normal file
15
bundles/octoprint/files/octoprint.service
Normal file
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=OctoPrint
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=octoprint
|
||||
Group=octoprint
|
||||
Environment="VIRTUAL_ENV=/opt/octoprint/venv"
|
||||
Environment="PATH=/opt/octoprint/venv/bin:/usr/local/bin:/usr/bin:/bin"
|
||||
ExecStart=/opt/octoprint/venv/bin/octoprint serve --ipv6 --host ::1 --port 22030
|
||||
WorkingDirectory=/opt/octoprint
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
34
bundles/octoprint/items.py
Normal file
34
bundles/octoprint/items.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
actions = {
|
||||
'octoprint_create_virtualenv': {
|
||||
'command': 'sudo -u octoprint /usr/bin/python3 -m virtualenv -p python3 /opt/octoprint/venv/',
|
||||
'unless': 'test -d /opt/octoprint/venv/',
|
||||
'needs': {
|
||||
'directory:/opt/octoprint', # provided by bundle:users
|
||||
'user:octoprint',
|
||||
},
|
||||
},
|
||||
'octoprint_install_octoprint': {
|
||||
'command': 'sudo -u octoprint /opt/octoprint/venv/bin/pip install OctoPrint',
|
||||
'unless': 'test -f /opt/octoprint/venv/bin/octoprint',
|
||||
'needs': {
|
||||
'action:octoprint_create_virtualenv',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
svc_systemd = {
|
||||
'octoprint': {
|
||||
'needs': {
|
||||
'file:/etc/systemd/system/octoprint.service',
|
||||
'action:octoprint_install_octoprint',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
files = {
|
||||
'/etc/systemd/system/octoprint.service': {
|
||||
'triggers': {
|
||||
'action:systemd-reload',
|
||||
},
|
||||
},
|
||||
}
|
7
bundles/octoprint/metadata.py
Normal file
7
bundles/octoprint/metadata.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
defaults = {
|
||||
'users': {
|
||||
'octoprint': {
|
||||
'home': '/opt/octoprint',
|
||||
},
|
||||
},
|
||||
}
|
Loading…
Reference in a new issue