Switch Blinko to bun for runtime and seed
Replace Node.js usage with bun across install and control scripts: run /opt/blinko/dist/seed.js with bun during install and update, and start the service with bun using --env-file. Also remove the hardcoded PORT from the generated .env. These changes unify the runtime, ensure migrations and seeding use bun, and load environment variables directly when starting the service.
This commit is contained in:
@@ -53,6 +53,7 @@ function update_script() {
|
|||||||
mkdir -p /opt/blinko/server/public
|
mkdir -p /opt/blinko/server/public
|
||||||
cp -r /opt/blinko/dist/public/. /opt/blinko/server/public/ 2>/dev/null || true
|
cp -r /opt/blinko/dist/public/. /opt/blinko/server/public/ 2>/dev/null || true
|
||||||
$STD bunx prisma migrate deploy
|
$STD bunx prisma migrate deploy
|
||||||
|
$STD bun /opt/blinko/dist/seed.js
|
||||||
msg_ok "Updated Application"
|
msg_ok "Updated Application"
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Starting Service"
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ msg_info "Setting up Blinko"
|
|||||||
cd /opt/blinko
|
cd /opt/blinko
|
||||||
cat <<EOF >/opt/blinko/.env
|
cat <<EOF >/opt/blinko/.env
|
||||||
NODE_ENV=production
|
NODE_ENV=production
|
||||||
PORT=1111
|
|
||||||
DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@127.0.0.1:5432/${PG_DB_NAME}
|
DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@127.0.0.1:5432/${PG_DB_NAME}
|
||||||
NEXTAUTH_URL=http://${LOCAL_IP}:1111
|
NEXTAUTH_URL=http://${LOCAL_IP}:1111
|
||||||
NEXTAUTH_SECRET=$(openssl rand -base64 32)
|
NEXTAUTH_SECRET=$(openssl rand -base64 32)
|
||||||
@@ -43,7 +42,7 @@ $STD bun run build:seed
|
|||||||
mkdir -p /opt/blinko/server/public
|
mkdir -p /opt/blinko/server/public
|
||||||
cp -r /opt/blinko/dist/public/. /opt/blinko/server/public/ 2>/dev/null || true
|
cp -r /opt/blinko/dist/public/. /opt/blinko/server/public/ 2>/dev/null || true
|
||||||
$STD bunx prisma migrate deploy
|
$STD bunx prisma migrate deploy
|
||||||
$STD node /opt/blinko/dist/seed.js
|
$STD bun /opt/blinko/dist/seed.js
|
||||||
msg_ok "Set up Blinko"
|
msg_ok "Set up Blinko"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
@@ -56,8 +55,7 @@ After=network.target postgresql.service
|
|||||||
Type=simple
|
Type=simple
|
||||||
User=root
|
User=root
|
||||||
WorkingDirectory=/opt/blinko/server
|
WorkingDirectory=/opt/blinko/server
|
||||||
EnvironmentFile=/opt/blinko/.env
|
ExecStart=/usr/local/bin/bun --env-file /opt/blinko/.env /opt/blinko/dist/index.js
|
||||||
ExecStart=/usr/bin/node /opt/blinko/dist/index.js
|
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user