From b2727d05e386b7f4a2c0b0c076fe02c9b68a6ae6 Mon Sep 17 00:00:00 2001 From: Harvey Chua Date: Tue, 31 Mar 2026 16:07:48 +0800 Subject: [PATCH 1/4] Pin isolate version to fix image build --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index aeb282b..756178a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ RUN apt-get install -y pkg-config libcap-dev libsystemd-dev git make gcc # Checkout and get isolate RUN git clone https://github.com/ioi/isolate /isolate/ +RUN git checkout b5e87ec10c5c83830b0ab4b9d908437e4c14e426 # Build isolate RUN make isolate From 0c2650d2ed3856ccf69b8b508f828a489a9d2c1f Mon Sep 17 00:00:00 2001 From: Harvey Chua Date: Tue, 31 Mar 2026 16:08:16 +0800 Subject: [PATCH 2/4] Use a different npm cache directory to allow running npm_ci.sh as non-root --- scripts/local/npm_ci.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/local/npm_ci.sh b/scripts/local/npm_ci.sh index aaa6af4..1d50430 100755 --- a/scripts/local/npm_ci.sh +++ b/scripts/local/npm_ci.sh @@ -8,4 +8,5 @@ docker run \ -v "$PROJECT_ROOT:/app" \ -w /app \ --user $(id -u):$(id -g) \ + -e NPM_CONFIG_CACHE=/app/.npm \ noiph/hurado:latest npm ci From 25ab4c068aae56860aaaa134f74480f4d7aa4be4 Mon Sep 17 00:00:00 2001 From: Harvey Chua Date: Tue, 31 Mar 2026 17:52:23 +0800 Subject: [PATCH 3/4] Rebuild image when deploying --- scripts/hrd.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/scripts/hrd.sh b/scripts/hrd.sh index 7561cbc..8557500 100755 --- a/scripts/hrd.sh +++ b/scripts/hrd.sh @@ -84,14 +84,6 @@ function hrd_deploy() { # This does a full deploy to the staging or production server # This assumes that the .env file is already set up on the respective server # and no new dependencies are needed to be installed (i.e. no need to rebuild the docker image) - # If you need to do any of those, you'll want to do it manually by doing the following: - # - # git push origin main - # hrd connect production - # git pull --ff-only origin main - # ./tools/docker_build.sh - # vim .env - # hrd restart # # Pre-requisites for this command: # You need to add something like the following to your ~/.ssh/config file: @@ -144,6 +136,7 @@ function hrd_deploy_server() { # Server-side script for deploying the latest changes to the production server set -e cd ~/hurado/ + ./scripts/docker_build.sh ./scripts/next_build.sh $HRD_CMD compose restart $HRD_CMD shell npm run db:migrate From ee690606c7c5debb13439951535b9fd117696139 Mon Sep 17 00:00:00 2001 From: Harvey Chua Date: Tue, 31 Mar 2026 20:07:28 +0800 Subject: [PATCH 4/4] Add autodeploy hook setup script --- scripts/setup_hooks.sh | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 scripts/setup_hooks.sh diff --git a/scripts/setup_hooks.sh b/scripts/setup_hooks.sh new file mode 100755 index 0000000..3898129 --- /dev/null +++ b/scripts/setup_hooks.sh @@ -0,0 +1,56 @@ +#!/bin/bash +if [ -z "$1" ]; then + echo "Error: Missing bare repository directory parameter." + echo "Usage: $0 " + exit 1 +fi + +BARE_REPO_DIR="$1" +WORK_TREE=$(pwd) + +if [ -d "$BARE_REPO_DIR" ]; then + read -p "Directory '$BARE_REPO_DIR' already exists. Delete it? (y/N): " confirm + + if [[ "$confirm" =~ ^[Yy]$ ]]; then + rm -rf "$BARE_REPO_DIR" + echo "Deleted '$BARE_REPO_DIR'." + else + echo "Setup aborted. Existing directory was kept." + exit 1 + fi +fi + +git init --bare "$BARE_REPO_DIR" + +HOOK_FILE="$BARE_REPO_DIR/hooks/post-receive" +cat > "$HOOK_FILE" <