Support direct HTTP IP access on port 5187 without hostname registration or a required proxy. Preserve dashboard/machine authentication and CSRF checks. Update Proxmox setup, D14, tests and documentation for 1.2.3. Closes #25
193 lines
9.7 KiB
Markdown
193 lines
9.7 KiB
Markdown
# Proxmox LXC install and update
|
|
|
|
Use the **Proxmox host only to create the container**. Updates run **inside the LXC**.
|
|
Open the dashboard at **`http://<container-ip>:5187`**. No hostname, HTTPS or proxy is required;
|
|
FinalToken installs no Caddy or other proxy. This follows
|
|
[D14](decisions.md#d14--self-hosted-dashboard-and-workers).
|
|
|
|
## Install the server
|
|
|
|
As root on the Proxmox host, with Git and Python 3 installed:
|
|
|
|
```bash
|
|
git clone --branch master --single-branch https://git.finalfactory.de/FinalFactory/FinalToken.git /opt/finaltoken-src && \
|
|
bash /opt/finaltoken-src/tools/proxmox.sh install --role server --ctid 201 \
|
|
--storage local-lvm --timezone Europe/Berlin
|
|
```
|
|
|
|
Use a free CT id and your storage and timezone. Omit `--ctid` for the next free id.
|
|
The optional legacy `--domain` argument is accepted but does not restrict dashboard access.
|
|
Add `--dry-run` to validate without creating a CT. Anonymous HTTPS clone needs no Git login.
|
|
|
|
The installer prints the container IP URL. You can also find the address with `hostname -I`
|
|
inside the CT. HTTP transport is unencrypted. If you choose to use an HTTPS reverse proxy:
|
|
|
|
- Public URL: `https://usage.example.com` (your chosen hostname).
|
|
- Backend: `http://<LXC-IP>:5187`.
|
|
- Preserve the public `Host` and browser `Origin` headers.
|
|
- Allow worker metadata POST bodies up to 32 MiB, matching the server's request-size limit.
|
|
- TLS/certificates stay on your existing proxy. The LXC needs no inbound 80/443 or certificates.
|
|
|
|
The dashboard key, machine keys and CSRF checks remain required. Browser mutation Origins must
|
|
match the actual request Host; no fixed hostname allowlist applies. HTTPS sessions use Secure
|
|
cookies, and direct HTTP login works. No forwarded-header trust is enabled.
|
|
The proxy must not log authorization headers or request bodies containing login responses.
|
|
|
|
Read the dashboard key on the CT's root console:
|
|
|
|
```bash
|
|
cat /etc/finaltoken/dashboard-key
|
|
```
|
|
|
|
`--role server` installs no coding CLIs or worker. Optional `--email` seeds provider account
|
|
metadata; no provider email/login is needed to install the server. Configure account/machine
|
|
bindings and distinct machine keys as in [web setup](web-dashboard.md#run-locally).
|
|
|
|
## Update inside the container
|
|
|
|
Open the LXC console as root and run:
|
|
|
|
```bash
|
|
finaltoken-update
|
|
```
|
|
|
|
This fetches public `master` into temporary source, builds NativeAOT as the isolated build user,
|
|
and activates the update **inside this container**. It does not call `pct`, contact the Proxmox
|
|
host or require the original host checkout. It preserves the CT role, service keys, settings,
|
|
CLI profiles and history. Official provider CLIs keep their own update/login lifecycle.
|
|
The updater is included in each binary release, so switching/rolling back releases updates it too.
|
|
Its root-executed code comes directly from the verified source archive; build-user modifications
|
|
to extracted source or build output cannot replace the installed updater.
|
|
The command is installed in `/usr/local/bin`; the updater also prints its absolute path for
|
|
shells with a custom PATH. Version 1.2.1 used `/usr/local/sbin`, which some container shells omit.
|
|
For that version you can invoke `/usr/local/sbin/finaltoken-update` directly, or add the normal
|
|
command without rebuilding:
|
|
|
|
```bash
|
|
mkdir -p /usr/local/bin
|
|
ln -s /opt/finaltoken/current/finaltoken-update /usr/local/bin/finaltoken-update
|
|
finaltoken-update --dry-run
|
|
```
|
|
|
|
This does not overwrite an existing file. Later updates preserve the matching managed link;
|
|
the old valid sbin link can remain for compatibility.
|
|
|
|
```bash
|
|
finaltoken-update --dry-run
|
|
```
|
|
|
|
Dry-run reads the managed marker and prints the plan without downloading or changing services.
|
|
Concurrent updates are refused. A new binary release is built before switching `current`;
|
|
only previously running services restart, and a failed local health check restores the old binaries.
|
|
Stopped services stay stopped. Package/configuration/history rollback is not implied by binary rollback.
|
|
|
|
### Existing 1.2.0 containers
|
|
|
|
The old installer did not install this command and bundled a proxy. Run the following **once as
|
|
root inside that LXC** to fetch the corrected updater and perform the update:
|
|
|
|
```bash
|
|
(
|
|
set -e
|
|
update_script=$(mktemp)
|
|
trap 'rm -f -- "$update_script"' EXIT
|
|
curl --fail --silent --show-error --location --proto '=https' --tlsv1.2 \
|
|
https://git.finalfactory.de/FinalFactory/FinalToken/raw/branch/master/tools/lxc_update.py \
|
|
--output "$update_script"
|
|
python3 "$update_script"
|
|
)
|
|
```
|
|
|
|
This installs Git in the CT if needed, updates the app, changes the old known loopback listener
|
|
to `0.0.0.0:5187` and disables **only** `finaltoken-proxy.service`. Open the container IP on
|
|
HTTP port 5187. Keys, old environment settings, profiles, history, certificate files and installed packages
|
|
are retained. It does not stop an unrelated `caddy.service` or purge packages/configuration.
|
|
|
|
The old server environment is backed up as root-only `server.env.pre-external-proxy`. If the
|
|
backend health check fails, its listener and prior service states are restored. A custom listener
|
|
is retained and migration reports that it needs manual configuration. The application update
|
|
may already have succeeded when a later network migration fails; retry after fixing the cause.
|
|
Subsequent updates need only `finaltoken-update`. The old host updater refuses deployment and
|
|
points to this in-container command.
|
|
|
|
## Install dashboard and client
|
|
|
|
Omit `--role server` (or choose `--role both`) to create a CT that also collects its own coding
|
|
CLI usage. Add `--email [email protected]`; provider-specific emails override it independently.
|
|
The installer installs official CLIs as their own user and never performs provider login.
|
|
Open the dashboard and use **Log in / renew** for the selected profile.
|
|
It observes only coding activity inside this CT, not desktop activity on another machine.
|
|
|
|
For a worker-only CT, configure the matching machine/account/key on the existing server first:
|
|
|
|
```bash
|
|
bash tools/proxmox.sh install --ctid 202 --storage local-lvm --role worker \
|
|
--server-url http://10.0.30.150:5187 --machine-id lxc_202 \
|
|
--worker-key-file /root/lxc_202.key --email [email protected]
|
|
```
|
|
|
|
The enrollment file holds a FinalToken transport key, not a provider token. The worker's OS user
|
|
is `finaltoken`; selected provider names are its profile ids. Workers connect outbound over
|
|
the configured HTTP or HTTPS URL.
|
|
Use `finaltoken-update` inside worker CTs too.
|
|
|
|
## Host and container requirements
|
|
|
|
The host needs `pct`, `pvesh`, `pveam`, `pvesm` and Python 3. Its package repositories are untouched.
|
|
Creation uses an unprivileged Debian 13 amd64 standard CT, DHCP on `vmbr0`, on-boot startup,
|
|
2 cores, 4096 MiB RAM, 2048 MiB swap and a 20 GiB root disk. No privileged mode/nesting is enabled.
|
|
The CT needs DNS/outbound HTTPS and working package repositories. Builds install .NET 10/native
|
|
prerequisites and Git in the CT and run under `finaltoken-build`, not root. Increase resources
|
|
when needed. This is not an offline or byte-for-byte reproducible dependency build.
|
|
|
|
For static IPv4, add `--ip 192.0.2.20/24 --gateway 192.0.2.1`; `--bridge`, `--vlan`,
|
|
`--template-storage` and `--template` select host-specific resources. No host firewall, DNS or NAT
|
|
rules are changed. Your browser and workers must reach the CT on port 5187.
|
|
|
|
The host installer snapshots the selected local checkout, including uncommitted source, through
|
|
the shared allowlist in `tools/proxmox/source_bundle.py`. It excludes recognized local config,
|
|
credentials and runtime data independently of Git ignore rules, rejects symlinks and bounds size.
|
|
`--source` selects a different local checkout. It never overwrites an existing CT.
|
|
|
|
## Files and service ownership
|
|
|
|
| Location | Purpose |
|
|
|---|---|
|
|
| `/etc/finaltoken/install.json` | Managed identity, role, source checksum and successful release |
|
|
| `/etc/finaltoken/server.json`, `worker.json` | Operator account/profile configuration |
|
|
| `/etc/finaltoken/server.env`, `worker.env` | Root-only service environment and transport keys |
|
|
| `/opt/finaltoken/releases/`, `/opt/finaltoken/current` | Root-owned native releases and updater |
|
|
| `/usr/local/bin/finaltoken-update` | Link to the active release's in-container updater |
|
|
| `/var/lib/finaltoken-server/`, `/var/lib/finaltoken-worker/` | Metadata, history and CLI-owned profiles |
|
|
| `/var/cache/finaltoken-build/` | Separate build user's cache; temporary source is removed |
|
|
|
|
No CT or old release is automatically deleted. A future incompatible schema needs its own
|
|
migration/backup plan. Update/restart interrupts pending CLI login attempts.
|
|
|
|
```bash
|
|
systemctl status finaltoken-server finaltoken-worker
|
|
journalctl -u finaltoken-server -u finaltoken-worker --since today
|
|
```
|
|
|
|
Units use non-root users, restrictive permissions and process-group shutdown. Application output
|
|
is discarded to keep CLI/login material out of the journal; service lifecycle events remain.
|
|
Never dump provider credential files into support reports. For coding in a worker CT use
|
|
`su - finaltoken`; its installed CLIs are in `~/.local/bin`.
|
|
|
|
## Verification and limits
|
|
|
|
```text
|
|
python -B tools/proxmox/test_installer.py
|
|
python -B tools/proxmox/test_update.py
|
|
bash -n tools/proxmox.sh
|
|
bash -n tools/proxmox-update.sh
|
|
python -B tools/docs/check_docs.py
|
|
```
|
|
|
|
Tests substitute Proxmox, systemd, native publishing, package operations and Linux locking.
|
|
They cover source safety, service/config/key preservation, failed activation and legacy proxy
|
|
migration rollback. Updater tests use real local Git clones with a synthetic guest provisioner.
|
|
The npm regression uses an offline synthetic package and real npm; Windows adapts its global
|
|
prefix boundary to the expected Linux launcher directory. It explicitly skips without Node/npm.
|
|
No real Linux/LXC update, NativeAOT publish, advisory locking or provider login is claimed by these tests.
|