Add system-run wrapper
This commit is contained in:
parent
e29a48913a
commit
6cca18c895
3 changed files with 32 additions and 1 deletions
10
README.md
10
README.md
|
@ -20,7 +20,7 @@ Pyinfra that deploy PhotoPrism un-dockerized on a Debian 11 LXD container.
|
||||||
If required, you can mount external volumes. Example:
|
If required, you can mount external volumes. Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
lxc config device add <name> <name>_disk disk source=/dev/vdf path=/mnt/pictures readonly=true raw.mount.options=noload
|
# lxc config device add <name> <name>_disk disk source=/dev/vdf path=/mnt/pictures readonly=true raw.mount.options=noload
|
||||||
```
|
```
|
||||||
|
|
||||||
Then add it to `group_data/production.py`:
|
Then add it to `group_data/production.py`:
|
||||||
|
@ -28,3 +28,11 @@ Then add it to `group_data/production.py`:
|
||||||
```
|
```
|
||||||
photoprism_originals_src='/mnt/pictures'
|
photoprism_originals_src='/mnt/pictures'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Run photoprism command
|
||||||
|
|
||||||
|
A systemd-run wrapper is installed and you can use it via `/usr/local/bin/photoprism`.
|
||||||
|
|
||||||
|
```
|
||||||
|
# /usr/local/bin/photoprism config
|
||||||
|
```
|
||||||
|
|
|
@ -120,3 +120,11 @@ systemd.service(
|
||||||
restarted=True,
|
restarted=True,
|
||||||
enabled=True,
|
enabled=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
files.template(
|
||||||
|
name='Set systemd-run wrapper',
|
||||||
|
src='templates/systemd-run.sh.j2',
|
||||||
|
dest='/usr/local/bin/photoprism',
|
||||||
|
mode='755',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
15
templates/systemd-run.sh.j2
Normal file
15
templates/systemd-run.sh.j2
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
systemd-run \
|
||||||
|
--pty \
|
||||||
|
--description='photoprism binary call' \
|
||||||
|
--property=User={{ host.data.unix_user }} \
|
||||||
|
--property=Group={{ host.data.unix_group }} \
|
||||||
|
--property=StateDirectory={{ host.data.unix_user }} \
|
||||||
|
--property=EnvironmentFile={{ host.data.systemd_env }} \
|
||||||
|
--property=WorkingDirectory=/photoprism \
|
||||||
|
--property=RootDirectory={{ host.data.undocker_dst }} \
|
||||||
|
--property='BindPaths={{ host.data.photoprism_storage_src }}:/photoprism/storage {{ host.data.photoprism_originals_src }}:/photoprism/originals {{ host.data.photoprism_import_src }}:/photoprism/import' \
|
||||||
|
--property='BindReadOnlyPaths=/etc/resolv.conf /proc' \
|
||||||
|
/photoprism/bin/photoprism $1
|
Reference in a new issue