fix(kan,puter): use .env + source for build env vars, fix Puter unreachable via IP

- kan: write .env before build, source it + export for build-time validation
  instead of inline exports (cleaner, consistent with codebase pattern)
- puter: set domain to container IP + experimental_no_subdomain so Puter
  accepts Host header when accessed via raw IP (default puter.localhost
  rejects all non-matching hosts)
This commit is contained in:
MickLesk
2026-04-05 18:32:49 +02:00
parent 363df9ddac
commit 77e1490b7c
2 changed files with 18 additions and 18 deletions

View File

@@ -29,16 +29,25 @@ msg_ok "Installed pnpm"
fetch_and_deploy_gh_tag "kan" "kanbn/kan"
msg_info "Configuring Application"
AUTH_SECRET=$(openssl rand -base64 32)
cat <<EOF >/opt/kan/.env
NEXT_PUBLIC_BASE_URL=http://${LOCAL_IP}:3000
BETTER_AUTH_SECRET=${AUTH_SECRET}
POSTGRES_URL=postgres://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}
HOSTNAME=0.0.0.0
PORT=3000
NODE_ENV=production
EOF
msg_ok "Configured Application"
msg_info "Building Application"
cd /opt/kan
AUTH_SECRET=$(openssl rand -base64 32)
export NEXT_PUBLIC_USE_STANDALONE_OUTPUT=true
export NEXT_PUBLIC_BASE_URL="http://${LOCAL_IP}:3000"
export BETTER_AUTH_SECRET="${AUTH_SECRET}"
export POSTGRES_URL="postgres://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}"
source /opt/kan/.env
export NEXT_PUBLIC_USE_STANDALONE_OUTPUT=true NEXT_PUBLIC_BASE_URL BETTER_AUTH_SECRET POSTGRES_URL
$STD pnpm install
$STD pnpm build --filter=@kan/web
unset NEXT_PUBLIC_USE_STANDALONE_OUTPUT NEXT_PUBLIC_BASE_URL BETTER_AUTH_SECRET POSTGRES_URL
unset NEXT_PUBLIC_USE_STANDALONE_OUTPUT
msg_ok "Built Application"
msg_info "Setting up Standalone"
@@ -52,17 +61,6 @@ cd /opt/kan/packages/db
POSTGRES_URL="postgres://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}" $STD pnpm exec drizzle-kit migrate
msg_ok "Ran Database Migrations"
msg_info "Configuring Application"
cat <<EOF >/opt/kan/.env
NEXT_PUBLIC_BASE_URL=http://${LOCAL_IP}:3000
BETTER_AUTH_SECRET=${AUTH_SECRET}
POSTGRES_URL=postgres://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}
HOSTNAME=0.0.0.0
PORT=3000
NODE_ENV=production
EOF
msg_ok "Configured Application"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/kan.service
[Unit]

View File

@@ -40,7 +40,9 @@ msg_info "Configuring Application"
cat <<EOF >/etc/puter/config.json
{
"config_name": "proxmox",
"allow_nipio_domains": true
"domain": "${LOCAL_IP}",
"http_port": 4100,
"experimental_no_subdomain": true
}
EOF
msg_ok "Configured Application"