Project

General

Profile

Snipe-IT » History » Version 2

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

1 2 Redmine Admin
Deployed by `~/deploy/snipeit-install.sh [domain] [--force] [--skip-npm-api]` (same
2
pattern as `add-wordpress-site.sh`; restarts NPM at step 6).
3
Containers `site-snipeit` (`docker.io/snipe/snipe-it`, Apache :80) +
4
`db-snipeit` (`mariadb:11`) on `net-snipeit`. Data volume `app-snipeit-data`
5
at **`/var/lib/snipeit`** (uploads, backups, OAuth keys) — app code is in the
6
image. Secrets: `snipeit-db-root-password`, `snipeit-db-password`,
7 1 Redmine Admin
`snipeit-app-key`.
8
9 2 Redmine Admin
Key env (behind NPM): `APP_URL=https://assets.mdsdefense.com`,
10
`APP_FORCE_TLS=true`, `APP_TRUSTED_PROXIES=*`, `SECURE_COOKIES=true`,
11
`DB_HOST=db-snipeit`, `APP_KEY` from secret. **`APP_KEY` must never change**
12 1 Redmine Admin
— it encrypts fields in the DB; back the secret up with the DB.
13
14 2 Redmine Admin
```bash
15 1 Redmine Admin
# generate APP_KEY once (before first start)
16
podman run --rm docker.io/snipe/snipe-it:latest php artisan key:generate --show
17
printf '%s' 'base64:...' | podman secret create snipeit-app-key -
18
19
# first start runs migrations; watch it
20
podman logs -f site-snipeit
21
22
# artisan inside the container
23
podman exec -it site-snipeit php artisan about
24
podman exec -it site-snipeit php artisan snipeit:backup
25
podman exec -it site-snipeit php artisan config:clear   # after env changes + restart
26
27
# DB (same MariaDB recipe as WordPress)
28
podman exec -it db-snipeit sh -c 'mariadb -uroot -p"$MYSQL_ROOT_PASSWORD"'
29
podman exec db-snipeit sh -c 'mariadb-dump -uroot -p"$MYSQL_ROOT_PASSWORD" snipeit' > ~/tmp/snipeit-$(date +%F).sql
30
```
31
32 2 Redmine Admin
## First-run pre-flight (Configuration Check)
33 1 Redmine Admin
34 2 Redmine Admin
Screenshot (2026-10-25, Snipe-IT v8.8.3):
35 1 Redmine Admin
36 2 Redmine Admin
![Snipe-IT pre-flight behind NPM](snipeit-preflight.png)
37 1 Redmine Admin
38 2 Redmine Admin
Behind NPM the check shows **two red rows that are expected and can be ignored**;
39
"Next: Create database tables" stays enabled:
40
41
| Row | What it says | Why it is red here | Verdict | How it was verified |
42
|-----|--------------|--------------------|---------|---------------------|
43
| **URL** | "thinks your URL is https://… but your real URL is http://…" | NPM owns 443 and terminates TLS; it talks plain HTTP to `site-snipeit:80`, so the app sees `http`. `APP_URL=https://assets.mdsdefense.com` in the unit is correct. There is no `.env` to edit — config is the unit's `Environment=` lines. | Normal behind a TLS-terminating proxy — **ignore** | After setup: login works without a redirect loop and every link/redirect is `https://`. Header test below. |
44
| **Config File** | "cannot determine if your config file is exposed" | The check can't probe from outside. In the image `.env` is outside Apache's document root (`public/`). | **ignore** | `/.env` returns **403** through NPM (command below). |
45
| Email | test button | `MAIL_MAILER=log` | skip until the SMTP relay is on — but the From address must be valid even now (see Mail) | — |
46
47
Verification commands (websvcmaster):
48
49
```bash
50
# Config File: .env must not be served -> 403/404
51
curl -sI --resolve assets.mdsdefense.com:444:127.0.0.1 https://assets.mdsdefense.com:444/.env | head -1
52
53
# URL: the app must build https redirects when NPM's forwarded header is present
54
podman exec site-snipeit sh -c 'curl -sI -H "X-Forwarded-Proto: https" -H "Host: assets.mdsdefense.com" http://127.0.0.1/ | grep -i ^location'
55
#   https://assets.mdsdefense.com/...  -> OK
56
#   http://...                          -> APP_TRUSTED_PROXIES not honoured: set it to the
57
#                                          net-snipeit subnet (podman network inspect net-snipeit | jq -r '.[0].subnets[0].subnet'),
58
#                                          cp unit, daemon-reload, restart
59
# If OK here but the browser still gets http links: NPM isn't sending the header ->
60
#   proxy host -> Advanced -> proxy_set_header X-Forwarded-Proto https;
61
62
# Overall: 302 to /login (or /setup before setup) is the healthy answer
63
check-sites.sh | grep snipeit
64
```
65
66
## Mail (SMTP relay)
67
68
Same Exchange Online IP connector as Redmine — no credentials. **From and Reply-To
69
must always be set to real addresses, even while the mailer is `log`.** The image's
70
default is the unresolved placeholder `${MAIL_ENV_FROM_ADDR}`, which is not a valid
71
address, so Snipe-IT answers HTTP 500 whenever it builds *any* email (creating a user,
72
the Test Email button, a password reset) — whatever the mailer. Found 2026-10-25:
73
500 while creating the first admin; the user was saved, only the email step failed.
74
The setup form pre-fills the same placeholder in its address field and rejects it (no `@`);
75
typing a real address there fixes the form only — the From used when a mail is sent still
76
comes from the environment variable, so the 500 stays until the unit is fixed.
77
78
`snipeit-install.sh` v1.1 writes the unit like this (v1.0 had the From lines commented out):
79
80
```ini
81
Environment=MAIL_FROM_ADDR=sysadmin@mdsdefense.com
82
Environment=MAIL_FROM_NAME=Snipe-IT
83
Environment=MAIL_REPLYTO_ADDR=sysadmin@mdsdefense.com
84
Environment=MAIL_REPLYTO_NAME=Snipe-IT
85
Environment=MAIL_MAILER=log
86
#Environment=MAIL_MAILER=smtp
87
#Environment=MAIL_HOST=mdsdefense-com.mail.protection.outlook.com
88
#Environment=MAIL_PORT=25
89
#Environment=MAIL_ENCRYPTION=tls
90
```
91
92
To fix a unit generated by v1.0 **and** switch SMTP on in one go (repo copy, websvcmaster;
93
for a v1.1 unit drop the last two `-e` lines, they would duplicate Reply-To):
94
95
```bash
96
cd ~/deploy
97
sed -i -e '/^Environment=MAIL_MAILER=log$/d' \
98
       -e 's/^#\(Environment=MAIL_\)/\1/' \
99
       -e 's/<tenant>\.mail\.protection\.outlook\.com/mdsdefense-com.mail.protection.outlook.com/' \
100
       -e '/^Environment=MAIL_FROM_NAME=/a Environment=MAIL_REPLYTO_ADDR=sysadmin@mdsdefense.com' \
101
       -e '/^Environment=MAIL_FROM_NAME=/a Environment=MAIL_REPLYTO_NAME=Snipe-IT' \
102
       quadlet/site-snipeit.container
103
grep -n MAIL quadlet/site-snipeit.container      # eight active MAIL_ lines (MAILER, HOST, PORT, ENCRYPTION, FROM x2, REPLYTO x2), no =log
104
```
105
106
Commit (root: `deploy-commit.sh -m "snipeit: From/Reply-To + SMTP via Exchange Online IP connector"`),
107
then go live — restarts only `site-snipeit` (a few seconds, other sites untouched):
108
109
```bash
110
cp ~/deploy/quadlet/site-snipeit.container ~/.config/containers/systemd/
111
systemctl --user daemon-reload && systemctl --user restart site-snipeit.service
112
podman exec site-snipeit printenv | grep ^MAIL_
113
```
114
115
**Testing mail.** GUI: Admin Settings → **General Settings** → *Test Email* (not under
116
Notifications). Command line alternative, with the actual SMTP error printed (websvcmaster;
117
it only sends a single message, nothing is changed). Use an **`@mdsdefense.com` recipient**:
118
119
```bash
120
podman exec site-snipeit php artisan tinker --execute='Mail::raw("Snipe-IT SMTP test", fn($m) => $m->to("sysadmin@mdsdefense.com")->subject("Snipe-IT test")); echo "sent\n";'
121
```
122
123
`sent` plus the mail in the mailbox = relay works. Another end-to-end check: log out →
124
*Forgot password*; that form asks for the **username**, not the e-mail address, and shows
125
"sent" even for an unknown username, so a wrong entry silently sends nothing. If the TLS handshake fails, set
126
`MAIL_ENCRYPTION=` (empty) and restart.
127
128
**Result 2026-10-26:** mail to an `@mdsdefense.com` mailbox is delivered (Redmine, which uses the
129
same connector, delivers too). The same test to an external address (gmail.com) is refused by
130
Exchange Online: `451 4.4.4 Mail received as unauthenticated, incoming to a recipient domain
131
configured in a hosted tenant which has no mail-enabled subscriptions. ATTR5`. TLS and
132
From/Reply-To are fine and the connector does recognise the host's IP (internal mail passes);
133
the refusal is on Exchange's side for non-tenant recipients. Cause not yet established — check
134
the connector in the Exchange admin center (type "Your organization's email server", status
135
On, and whether relay to external recipients is permitted) and use *Mail flow → Message trace*
136
for the failing attempt. Until then Snipe-IT can notify `@mdsdefense.com` addresses only.
137
138
## Image versions and upgrades
139
140
**Pinned state (2026-10-26, commit `4a9a464`):** `site-snipeit` runs
141
`docker.io/snipe/snipe-it:v8.8.3` (build 26143-g80b2dc5768, same build that `latest` was at install);
142
`db-snipeit` runs MariaDB 11.8.9 pinned by digest (`mariadb@sha256:2439dcd7…`, the image that was
143
running — the `11.8` tag had already moved to a different image). `snipeit-install.sh` v1.1 still
144
defaults to `:latest`; for a new install pass `--app-image docker.io/snipe/snipe-it:v8.8.3`.
145
146
Why pinned: `latest` does not update by itself (podman does not re-pull an image that exists
147
locally), but it silently moves whenever the image is pulled or the container is recreated, and
148
Snipe-IT runs database migrations at start — an unplanned version jump changes the schema. With a
149
pin, the version in use is in the unit file and in git, and an upgrade is a deliberate edit.
150
151
**There is no upgrade from the GUI.** Snipe-IT shows a "new version available" notice (it checks
152
GitHub), but the code lives in the image; the only way to upgrade is to replace the image.
153
Anything changed inside the container is lost when the image changes.
154
155
Upgrade procedure (websvcmaster unless stated):
156
157
1. New release noticed (GUI notice, or the `snipe/snipe-it` tags on Docker Hub): note the tag, e.g. `v8.8.4`. Tags are `v<major>.<minor>.<patch>`; `-alpine` variants exist, the unit uses the non-alpine one.
158
2. **Backup first:** DB dump, the `app-snipeit-data` volume, the `snipeit-app-key` secret (the migration at step 5 cannot be undone without the dump).
159
3. Change one line in the repo copy: `Image=docker.io/snipe/snipe-it:v8.8.4`.
160
4. Commit (root: `deploy-commit.sh -m "snipeit: upgrade to v8.8.4"`), then `cp` the unit to `~/.config/containers/systemd/`, `systemctl --user daemon-reload`, `systemctl --user restart site-snipeit.service`. Only Snipe-IT is down for a few seconds.
161
5. Migrations run on start: `podman logs -f site-snipeit`, then `~/deploy/check-sites.sh` (expect 302 for assets), then log in and check Admin → System information for the version.
162
6. If it breaks: put the old `Image=` line back, restart; if the schema already changed, restore the DB dump.
163
164
MariaDB patch updates are the same idea: change the digest (or the `11.8` tag) on purpose, with a dump
165
taken first. Rules for unit files: a comment must be on its own line — `Image=… # note` makes the
166
comment part of the image name. Read the running digest with
167
`podman image inspect <image-id> --format '{{.Digest}}'`.
168
169
---
170
_Source: `dmz-web-podman-cheatsheet.md` v1.4.1 in the `dmz-web-deploy` repo ([[Releases]]). Edit the wiki and the repo copy together._