crafty-controller: seed felhom-generated admin password (gokapi pattern) instead of Crafty's random one; app-page card reads default.json

This commit is contained in:
2026-06-26 11:22:26 +02:00
parent 8fd9c007af
commit 5a403d1003
3 changed files with 47 additions and 6 deletions
+15
View File
@@ -1,5 +1,20 @@
# Changelog
## 2026-06-26 — crafty-controller: seed a felhom-generated admin password (replaces Crafty's ugly random one)
- **crafty-controller**: instead of reading Crafty's auto-generated (long, symbol-laden) random admin
password, we now **seed** a clean felhom-generated one — same pattern as gokapi, so initial passwords are
consistent across the catalog.
- Crafty's image ships `app/config_original/default.json = {"username":"admin","password":"crafty"}`;
"crafty" is 6 chars < Crafty's 8-char minimum, so Crafty rejected it and generated a random password.
- New `CRAFTY_PASSWORD` deploy field (`type: password`, `generate: password:24`, locked after deploy —
mirrors gokapi's `GOKAPI_PASSWORD`). The compose **entrypoint** overwrites the `default.json` template
with this password before the launcher runs; on fresh install Crafty creates the `admin` user with it.
- `initial_credentials.file` repointed `default-creds.txt``default.json` (same json/username/password
keys), so the controller's app-page "Kezdeti belépési adatok" card shows the **seeded** password — the
customer sees the same value at deploy time and on the app page.
- Catalog-only change (reuses felhom-controller v0.84.0's initial_credentials reader + the gokapi-style
seed). Requires a fresh install to take effect (the seed is only read on first run).
## 2026-06-26 — crafty-controller: surface the auto-generated initial admin password on the app page
- **crafty-controller**: Crafty writes a random admin password to `/crafty/app/config/default-creds.txt`
at first boot (its built-in default is rejected as "too short"). Customers had to read the container
+13 -6
View File
@@ -32,6 +32,13 @@ deploy_fields:
locked_after_deploy: true
description: "Az alkalmazás aldomainje"
- env_var: CRAFTY_PASSWORD
label: "Admin jelszó"
type: password
generate: password:24
locked_after_deploy: true
description: "A Crafty admin felhasználó (admin) kezdeti jelszava — ezzel tudsz belépni a kezelőfelületre"
# --- App info (info page content) ---
app_info:
tagline: "Minecraft szerver kezelő - hozd létre a saját világodat"
@@ -61,13 +68,13 @@ healthcheck:
- type: tcp
port: 8443
# --- Initial auto-generated login ---
# Crafty writes a random admin password to this file on first boot (its built-in default is rejected
# as "too short"). The controller reads + parses it live and shows it on the app page so customers
# don't have to dig through the container logs.
# --- Initial login (felhom-seeded) ---
# The admin password is seeded into default.json by the compose entrypoint (CRAFTY_PASSWORD deploy
# field). The controller reads it back from default.json and shows it on the app page under "Kezdeti
# belépési adatok" — same value the customer set at deploy time.
initial_credentials:
file: /crafty/app/config/default-creds.txt
file: /crafty/app/config/default.json
format: json
username_key: username
password_key: password
note: "Kezdeti, automatikusan generált jelszó. Az első belépés után változtasd meg a Crafty felületén (ez a fájl a régi jelszót mutatja, nem itt módosítható)."
note: "Kezdeti admin jelszó (a telepítéskor beállított). Az első belépés után változtasd meg a Crafty felületén ez a kártya továbbra is a kezdeti jelszót mutatja."
@@ -5,6 +5,15 @@
#
# Environment variables:
# DOMAIN - Your domain (e.g., demo-felhom.eu)
# CRAFTY_PASSWORD - felhom-generated initial admin password (seeded into default.json, see below)
#
# Initial admin password (seeding): Crafty's image ships
# app/config_original/default.json = {"username":"admin","password":"crafty"} — only 6 chars, below
# Crafty's 8-char minimum, so Crafty rejects it and generates an ugly random password into
# default-creds.txt. The entrypoint below overwrites that template with a felhom-generated password
# BEFORE the launcher runs; on fresh install the launcher copies it into the config volume and Crafty
# creates the admin user with it. The seeded default.json stays in the volume as the source the
# controller reads for the "Kezdeti belépési adatok" card (initial_credentials in .felhom.yml).
services:
crafty-controller:
@@ -13,6 +22,16 @@ services:
restart: unless-stopped
environment:
- TZ=Europe/Budapest
- CRAFTY_PASSWORD=${CRAFTY_PASSWORD}
# Seed the felhom-generated admin password via Crafty's default.json template, then hand off to the
# image's normal launcher (entrypoint /crafty/docker_launcher.sh, default cmd "-d -i"). $$ escapes
# the compose interpolation so CRAFTY_PASSWORD is read from the container env at runtime.
entrypoint:
- /bin/sh
- -c
- |
printf '{"username":"admin","password":"%s"}\n' "$${CRAFTY_PASSWORD}" > /crafty/app/config_original/default.json
exec /crafty/docker_launcher.sh -d -i
volumes:
- crafty_backups:/crafty/backups
- crafty_logs:/crafty/logs