mirror of
https://github.com/dani-garcia/bitwarden_rs
synced 2024-11-22 01:48:09 +01:00
add link to podman generate command docs, add RH article on podman generate, add install section to systemd unit examples
parent
a758e49145
commit
717a6917cf
@ -1,7 +1,7 @@
|
||||
[Podman](https://podman.io/) is a daemonless alternative to Docker, which is mostly compatible with Docker containers.
|
||||
|
||||
# Creating a systemd service file
|
||||
Podman is easier to run in systemd than Docker due to its daemonless architechture. It comes with a handy generate command which can generate systemd files, here's a [good article going into more detail](https://www.redhat.com/sysadmin/podman-shareable-systemd-services).
|
||||
Podman is easier to run in systemd than Docker due to its daemonless architechture. It comes with a handy [generate systemd command](http://docs.podman.io/en/latest/markdown/podman-generate-systemd.1.html) which can generate systemd files. Here is a [good article that goes into more detail](https://www.redhat.com/sysadmin/podman-shareable-systemd-services) as well as [this article detailing some more recent updates](https://www.redhat.com/sysadmin/improved-systemd-podman).
|
||||
```sh
|
||||
$ podman run -d --name bitwarden -v /bw-data/:/data/:Z -e ROCKET_PORT=8080 -p 8080:8080 bitwardenrs/server:latest
|
||||
54502f309f3092d32b4c496ef3d099b270b2af7b5464e7cb4887bc16a4d38597
|
||||
@ -21,6 +21,9 @@ ExecStop=/usr/bin/podman stop -t 10 bitwarden
|
||||
KillMode=none
|
||||
Type=forking
|
||||
PIDFile=/run/user/1000/overlay-containers/54502f309f3092d32b4c496ef3d099b270b2af7b5464e7cb4887bc16a4d38597/userdata/conmon.pid
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target default.target
|
||||
```
|
||||
|
||||
You can provide a `--files` flag to dedicate a specific file to output the systemd service file to. With this we can enable and start the container as any normal service file.
|
||||
@ -32,14 +35,21 @@ $ systemctl --user start container-bitwarden.service
|
||||
## New container every restart
|
||||
If we want to create a new container every time the service starts we can edit the service file to contain the following:
|
||||
```sh
|
||||
[Unit]
|
||||
Description=Podman container-bitwarden.service
|
||||
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
ExecStartPre=/usr/bin/rm -f /%t/%n-pid /%t/%n-cid
|
||||
ExecStart=/usr/bin/podman run --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid --env-file=/home/spytec/Bitwarden/bitwarden.conf -d -p 8080:8080 -v /home/spytec/Bitwarden/bw-data:/data/:Z bitwardenrs/server:latest
|
||||
ExecStop=/usr/bin/podman stop -t "15" --cidfile /%t/%n-cid
|
||||
ExecStop=/usr/bin/podman rm -f --cidfile /%t/%n-cid
|
||||
KillMode=none
|
||||
Type=forking
|
||||
PIDFile=/%t/%n-pid
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target default.target
|
||||
```
|
||||
Where `bitwarden.conf` environment file can contain all the container environment values you need
|
||||
```conf
|
||||
|
Loading…
Reference in New Issue
Block a user