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:
@@ -29,16 +29,25 @@ msg_ok "Installed pnpm"
|
|||||||
|
|
||||||
fetch_and_deploy_gh_tag "kan" "kanbn/kan"
|
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"
|
msg_info "Building Application"
|
||||||
cd /opt/kan
|
cd /opt/kan
|
||||||
AUTH_SECRET=$(openssl rand -base64 32)
|
source /opt/kan/.env
|
||||||
export NEXT_PUBLIC_USE_STANDALONE_OUTPUT=true
|
export NEXT_PUBLIC_USE_STANDALONE_OUTPUT=true NEXT_PUBLIC_BASE_URL BETTER_AUTH_SECRET POSTGRES_URL
|
||||||
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}"
|
|
||||||
$STD pnpm install
|
$STD pnpm install
|
||||||
$STD pnpm build --filter=@kan/web
|
$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_ok "Built Application"
|
||||||
|
|
||||||
msg_info "Setting up Standalone"
|
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
|
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_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"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/systemd/system/kan.service
|
cat <<EOF >/etc/systemd/system/kan.service
|
||||||
[Unit]
|
[Unit]
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ msg_info "Configuring Application"
|
|||||||
cat <<EOF >/etc/puter/config.json
|
cat <<EOF >/etc/puter/config.json
|
||||||
{
|
{
|
||||||
"config_name": "proxmox",
|
"config_name": "proxmox",
|
||||||
"allow_nipio_domains": true
|
"domain": "${LOCAL_IP}",
|
||||||
|
"http_port": 4100,
|
||||||
|
"experimental_no_subdomain": true
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
msg_ok "Configured Application"
|
msg_ok "Configured Application"
|
||||||
|
|||||||
Reference in New Issue
Block a user