3 Commits
Author SHA1 Message Date
asepharyana 5195a65ca5 ci: use sudo when syncing .next on VPS
CI / typecheck + tests (push) Canceled after 0s
CI / build + deploy (Nix) — api (push) Canceled after 0s
CI / build + deploy (Nix) — mcp (push) Canceled after 0s
CI / build + deploy (Nix) — worker (push) Canceled after 0s
CI / build + deploy (web) (push) Canceled after 0s
2026-08-22 12:08:20 +07:00
asepharyana 666ba855a2 fix(web): fix working directory in mcpedia-web wrapper script 2026-08-22 12:04:22 +07:00
asepharyana 8adfffb6e7 fix(deploy): correctly copy prebuilt .next to apps/web/.next on VPS during deployment 2026-08-22 12:00:30 +07:00
2 changed files with 15 additions and 18 deletions

No files matched your search

+5 -5
View File
@@ -304,15 +304,15 @@ jobs:
VPS_HOST: ${{ secrets.SSH_DEPLOY_HOST }}
VPS_USER: ${{ secrets.SSH_DEPLOY_USER }}
run: |
# Substitute from Attic cache (fast)
# Update profile + sync git repo + sync .next + restart
ssh "$VPS_USER@$VPS_HOST" \
"sudo /nix/var/nix/profiles/default/bin/nix-store --realise '$STORE_PATH'"
# Update profile + sync git repo + restart
ssh "$VPS_USER@$VPS_HOST" \
"sudo /nix/var/nix/profiles/default/bin/nix-env \
"sudo /nix/var/nix/profiles/default/bin/nix-store --realise '$STORE_PATH' && \
sudo /nix/var/nix/profiles/default/bin/nix-env \
--profile /nix/var/nix/profiles/mcpedia-web \
--set '$STORE_PATH' && \
(cd /home/code/mcpedia && git fetch origin main && git reset --hard origin/main) && \
sudo rm -rf /home/code/mcpedia/apps/web/.next && \
sudo cp -r '$STORE_PATH/share/mcpedia-web/.next' /home/code/mcpedia/apps/web/.next && \
sudo systemctl restart mcpedia-web && \
sleep 3 && \
sudo systemctl status mcpedia-web --no-pager --no-legend | head -5"
+10 -13
View File
@@ -3,23 +3,11 @@
# so .next is built in CI via `bun run build` and packaged here.
{ pkgs
, stdenv
, writeShellScriptBin
, bun
, webNextDir
, ...
}:
let
mcpedia-web-script = writeShellScriptBin "mcpedia-web" ''
#!${pkgs.bash}/bin/bash
export NODE_ENV=production
export PORT=4016
cd /home/code/mcpedia/apps/web
rm -f .next
ln -s "${webNextDir}" .next
exec "${bun}/bin/bun" x next start -p 4016
'';
in
stdenv.mkDerivation {
pname = "mcpedia-web";
version = "1.0.0";
@@ -31,6 +19,15 @@ stdenv.mkDerivation {
cp -r "${webNextDir}/." $out/share/mcpedia-web/.next/
mkdir -p $out/bin
cp ${mcpedia-web-script}/bin/mcpedia-web $out/bin/mcpedia-web
cat > $out/bin/mcpedia-web <<EOF
#!${pkgs.bash}/bin/bash
export NODE_ENV=production
export PORT=4016
cd /home/code/mcpedia
rm -rf apps/web/.next
cp -r "$out/share/mcpedia-web/.next" apps/web/.next
exec "${bun}/bin/bun" run --cwd apps/web start
EOF
chmod +x $out/bin/mcpedia-web
'';
}