fix: standardize deployment data directory and CI linting
Rust CI / Test & Quality Checks (push) Canceled after 0s
Rust CI / Build Docker Image (push) Canceled after 0s

This commit is contained in:
thakares committed 2026-08-27 15:41:24 +05:30
1 parent c2e138f823
commit e42d1a5d80
4 files changed
+49 -40

No files matched your search

+8 -6
View File
@@ -7,7 +7,7 @@ set -euo pipefail
SERVICE_USER="bzod"
INSTALL_PATH="/usr/local/bin/bzod"
CONFIG_DIR="/etc/bzod"
DATA_DIR="/var/lib/bzod/data"
NX9_BZOD_DATA_DIR="/var/lib/bzod/data"
ENV_FILE="${CONFIG_DIR}/bzod.env"
SYSTEMD_UNIT="/etc/systemd/system/bzod.service"
@@ -110,7 +110,7 @@ fi
# 4. Setup Directories
echo -e "\n${BLUE}[4/8] Setting up directories...${NC}"
mkdir -p "${CONFIG_DIR}" "${DATA_DIR}"
mkdir -p "${CONFIG_DIR}" "${NX9_BZOD_DATA_DIR}"
chown -R "${SERVICE_USER}:${SERVICE_USER}" "/var/lib/bzod"
chmod 700 "${CONFIG_DIR}"
@@ -121,7 +121,7 @@ if [ ! -f "${ENV_FILE}" ]; then
cat <<EOF > "${ENV_FILE}"
HOST=0.0.0.0
PORT=8654
NX9_BZOD_DATA_DIR=${DATA_DIR}
NX9_BZOD_DATA_DIR=${NX9_BZOD_DATA_DIR}
COOKIE_SECURE=true
RUST_LOG=info
SESSION_SECRET=$(openssl rand -hex 32)
@@ -175,11 +175,13 @@ systemctl daemon-reload
# 7. Initialize & Start
echo -e "\n${BLUE}[7/8] Initializing and starting service...${NC}"
if [ ! -f "${DATA_DIR}/content.db" ] && [ ! -f "${DATA_DIR}/admin.db" ] && [ ! -f "${DATA_DIR}/analytics.db" ]; then
runuser -u "${SERVICE_USER}" -- "${INSTALL_PATH}" init-db --data-dir "${DATA_DIR}"
echo -e "${GREEN}✓ Databases initialized${NC}"
if [ ! -f "${NX9_BZOD_DATA_DIR}/admin/users.db" ] && [ ! -f "${NX9_BZOD_DATA_DIR}/admin.db" ]; then
runuser -u "${SERVICE_USER}" -- "${INSTALL_PATH}" migrate --data-dir "${NX9_BZOD_DATA_DIR}"
echo -e "${GREEN}✓ Database topology initialized${NC}"
else
echo -e "${GREEN}✓ Existing database detected (upgrade mode)${NC}"
runuser -u "${SERVICE_USER}" -- "${INSTALL_PATH}" migrate --data-dir "${NX9_BZOD_DATA_DIR}"
echo -e "${GREEN}✓ Migrations verified${NC}"
fi
systemctl enable --now bzod