Project

General

Profile

Operations » History » Version 2

Redmine Admin, 10/26/2026 02:24 AM
deploy-publish.sh

1 1 Redmine Admin
## Services
2
3 2 Redmine Admin
```bash
4 1 Redmine Admin
systemctl --user daemon-reload                        # after editing any Quadlet file
5
systemctl --user list-units 'db-*' 'site-*' 'net-*' 'nginx-proxy-manager*'
6
systemctl --user status  db-<name>.service site-<name>.service
7
systemctl --user restart db-<name>.service site-<name>.service
8
journalctl --user -u site-<name>.service -e
9
/usr/libexec/podman/quadlet -dryrun -user             # validate Quadlet syntax
10
```
11
12
## Listing / inspecting
13
14 2 Redmine Admin
```bash
15 1 Redmine Admin
podman ps -a
16
podman network ls ; podman volume ls ; podman secret ls
17
podman inspect <ctr> --format '{{.ImageName}}'
18
podman inspect <ctr> --format '{{range .Mounts}}{{.Name}} -> {{.Destination}}{{"\n"}}{{end}}'
19
podman inspect <ctr> | jq '.[0].Config.Env'
20
podman logs -f <ctr>
21
podman exec -it <ctr> bash                            # root shell inside, no password
22
```
23
24
## Environment variables inside a container
25
26 2 Redmine Admin
```bash
27 1 Redmine Admin
podman exec <ctr> printenv
28
podman exec <ctr> printenv | grep -iE 'ROOT|PASSWORD|KEY'
29
podman exec <ctr> printenv MYSQL_ROOT_PASSWORD | od -c | tail -3   # reveals a stray trailing \n
30
```
31
32
## Secrets
33
34 2 Redmine Admin
Injected as env at container start (`Secret=<secret>,type=env,target=VAR`).
35
MariaDB/PostgreSQL only read their `*_PASSWORD` env on **first**
36
initialisation of an empty data dir; afterwards the env var is inert and the
37 1 Redmine Admin
real password is whatever is in the DB.
38
39 2 Redmine Admin
```bash
40 1 Redmine Admin
podman secret inspect --showsecret <secret>
41
podman secret inspect --showsecret --format '{{.SecretData}}' <secret>
42
43
# always create WITHOUT a trailing newline
44
printf '%s' 'VALUE' | podman secret create <secret> -
45
printf '%s' "$(openssl rand -base64 32)" | podman secret create <secret> -
46
47
# replace: rm + create, then restart the consumers
48
podman secret rm <secret> && printf '%s' 'VALUE' | podman secret create <secret> -
49
```
50
51
## Fixing a secret that has a trailing `\n` (legacy WordPress sites)
52
53 2 Redmine Admin
```bash
54 1 Redmine Admin
cat > ~/tmp/fixpw.sh <<'EOF'
55
ROOTPW="$(printf '%s' "$MYSQL_ROOT_PASSWORD")"   # $(...) strips the trailing \n
56
WPPW="$(printf '%s' "$MYSQL_PASSWORD")"
57
mariadb -uroot -p"$MYSQL_ROOT_PASSWORD" <<SQL
58
ALTER USER 'root'@'localhost' IDENTIFIED BY '$ROOTPW';
59
ALTER USER 'root'@'%'         IDENTIFIED BY '$ROOTPW';
60
ALTER USER 'wordpress'@'%'    IDENTIFIED BY '$WPPW';
61
FLUSH PRIVILEGES;
62
SQL
63
EOF
64
podman exec -i db-<name> sh < ~/tmp/fixpw.sh
65
for s in <name>-db-root-password <name>-db-password; do
66
  v="$(podman secret inspect --showsecret --format '{{.SecretData}}' "$s")"
67
  podman secret rm "$s"; printf '%s' "$v" | podman secret create "$s" -
68
done
69
systemctl --user restart db-<name>.service site-<name>.service   # run back to back with the SQL half
70
```
71
72
73 2 Redmine Admin
---
74
_Source: `dmz-web-podman-cheatsheet.md` v1.1.1 in the `dmz-web-deploy` repo ([[Releases]]). Edit the wiki and the repo copy together._