fix(trek): extract admin creds from log; fix(slink): export APP_ENV=prod for all symfony commands

This commit is contained in:
MickLesk
2026-04-02 22:53:30 +02:00
parent 5c02002a19
commit f13616e3b9
2 changed files with 24 additions and 1 deletions

View File

@@ -41,7 +41,8 @@ cd /opt/slink/services/api
APP_SECRET=$(openssl rand -hex 16)
sed -i "s|^APP_SECRET=.*|APP_SECRET=${APP_SECRET}|" .env
sed -i "s|^APP_ENV=.*|APP_ENV=prod|" .env
APP_ENV=prod $STD composer install --no-dev --optimize-autoloader --no-interaction
export APP_ENV=prod
$STD composer install --no-dev --optimize-autoloader --no-interaction
mkdir -p /opt/slink/{data,images}
$STD php bin/console cache:warm --no-optional-warmers 2>/dev/null || true
msg_ok "Set up API"

View File

@@ -69,6 +69,28 @@ EOF
systemctl enable -q --now trek
msg_ok "Created Service"
msg_info "Waiting for initial setup"
for i in $(seq 1 15); do
if journalctl -u trek --no-pager -q 2>/dev/null | grep -q "Admin Account Created"; then
TREK_PW=$(journalctl -u trek --no-pager -q 2>/dev/null | grep "Password:" | tail -1 | sed 's/.*Password: *//;s/ *║.*//')
TREK_EMAIL=$(journalctl -u trek --no-pager -q 2>/dev/null | grep "Email:" | tail -1 | sed 's/.*Email: *//;s/ *║.*//')
break
fi
sleep 1
done
msg_ok "Initial setup complete"
if [[ -n "${TREK_PW:-}" ]]; then
{
echo ""
echo "TREK Admin Credentials"
echo "Email: ${TREK_EMAIL}"
echo "Password: ${TREK_PW}"
echo "(Change password after first login)"
echo ""
} >>~/trek.creds
fi
motd_ssh
customize
cleanup_lxc