瀏覽代碼

fix: release tests

Nicolas Meienberger 2 年之前
父節點
當前提交
4a5eb2d430

+ 0 - 3
docker-compose.dev.yml

@@ -51,13 +51,10 @@ services:
     ports:
     ports:
       - 3001:3001
       - 3001:3001
     volumes:
     volumes:
-      ## Docker sock
-      - /var/run/docker.sock:/var/run/docker.sock:ro
       - ${PWD}/apps:/runtipi/apps:ro
       - ${PWD}/apps:/runtipi/apps:ro
       - ${PWD}/repos:/runtipi/repos:ro
       - ${PWD}/repos:/runtipi/repos:ro
       - ${PWD}/state:/runtipi/state
       - ${PWD}/state:/runtipi/state
       - ${PWD}/packages/system-api/src:/api/src
       - ${PWD}/packages/system-api/src:/api/src
-      - ${PWD}/logs:/app/logs
       - ${STORAGE_PATH}:/app/storage
       - ${STORAGE_PATH}:/app/storage
       - ${PWD}/.env.dev:/runtipi/.env
       - ${PWD}/.env.dev:/runtipi/.env
       # - /api/node_modules
       # - /api/node_modules

+ 0 - 2
docker-compose.rc.yml

@@ -44,8 +44,6 @@ services:
       tipi-db:
       tipi-db:
         condition: service_healthy
         condition: service_healthy
     volumes:
     volumes:
-      ## Docker sock
-      - /var/run/docker.sock:/var/run/docker.sock:ro
       - ${PWD}/apps:/runtipi/apps:ro
       - ${PWD}/apps:/runtipi/apps:ro
       - ${PWD}/repos:/runtipi/repos:ro
       - ${PWD}/repos:/runtipi/repos:ro
       - ${PWD}/state:/runtipi/state
       - ${PWD}/state:/runtipi/state

+ 0 - 2
docker-compose.yml

@@ -44,8 +44,6 @@ services:
       tipi-db:
       tipi-db:
         condition: service_healthy
         condition: service_healthy
     volumes:
     volumes:
-      ## Docker sock
-      - /var/run/docker.sock:/var/run/docker.sock:ro
       - ${PWD}/apps:/runtipi/apps:ro
       - ${PWD}/apps:/runtipi/apps:ro
       - ${PWD}/repos:/runtipi/repos:ro
       - ${PWD}/repos:/runtipi/repos:ro
       - ${PWD}/state:/runtipi/state
       - ${PWD}/state:/runtipi/state

+ 2 - 1
package.json

@@ -11,7 +11,8 @@
     "start:rc": "docker-compose -f docker-compose.rc.yml --env-file .env up --build",
     "start:rc": "docker-compose -f docker-compose.rc.yml --env-file .env up --build",
     "start:prod": "docker-compose --env-file .env up --build",
     "start:prod": "docker-compose --env-file .env up --build",
     "start:pg": "docker run --name test-db -p 5433:5432 -d --rm -e POSTGRES_PASSWORD=postgres postgres",
     "start:pg": "docker run --name test-db -p 5433:5432 -d --rm -e POSTGRES_PASSWORD=postgres postgres",
-    "version": "echo $npm_package_version"
+    "version": "echo $npm_package_version",
+    "release:rc": "./scripts/deploy/release-rc.sh"
   },
   },
   "devDependencies": {
   "devDependencies": {
     "@commitlint/cli": "^17.0.3",
     "@commitlint/cli": "^17.0.3",

+ 1 - 1
packages/system-api/src/core/config/TipiConfig.ts

@@ -9,7 +9,7 @@ if (process.env.NODE_ENV !== 'production') {
   dotenv.config({ path: '.env' });
   dotenv.config({ path: '.env' });
 }
 }
 const {
 const {
-  LOGS_FOLDER = 'logs',
+  LOGS_FOLDER = '/app/logs',
   LOGS_APP = 'app.log',
   LOGS_APP = 'app.log',
   LOGS_ERROR = 'error.log',
   LOGS_ERROR = 'error.log',
   NODE_ENV = 'development',
   NODE_ENV = 'development',

+ 2 - 1
scripts/common.sh

@@ -68,7 +68,8 @@ function clean_logs() {
 }
 }
 
 
 function kill_watcher() {
 function kill_watcher() {
-    watcher_pid=$(pgrep -f "runtipi/state/events")
+    watcher_pid="$(ps aux | grep "scripts/watcher" | grep -v grep | awk '{print $2}')"
+
     # kill it if it's running
     # kill it if it's running
     if [[ -n $watcher_pid ]]; then
     if [[ -n $watcher_pid ]]; then
         # If multiline kill each pid
         # If multiline kill each pid

+ 3 - 0
scripts/deploy/release-rc.sh

@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t meienberger/runtipi:rc-"$(npm run version --silent)" . --push

+ 1 - 1
scripts/start-dev.sh

@@ -4,8 +4,8 @@ source "${BASH_SOURCE%/*}/common.sh"
 ROOT_FOLDER="${PWD}"
 ROOT_FOLDER="${PWD}"
 
 
 kill_watcher
 kill_watcher
-"${ROOT_FOLDER}/scripts/watcher.sh" &
 chmod -R a+rwx "${ROOT_FOLDER}/state/events"
 chmod -R a+rwx "${ROOT_FOLDER}/state/events"
 chmod -R a+rwx "${ROOT_FOLDER}/state/system-info.json"
 chmod -R a+rwx "${ROOT_FOLDER}/state/system-info.json"
+"${ROOT_FOLDER}/scripts/watcher.sh" &
 
 
 docker compose -f docker-compose.dev.yml --env-file "${ROOT_FOLDER}/.env.dev" up --build
 docker compose -f docker-compose.dev.yml --env-file "${ROOT_FOLDER}/.env.dev" up --build

+ 3 - 5
scripts/start.sh

@@ -100,10 +100,11 @@ if [[ "${NGINX_PORT}" != "80" ]] && [[ "${DOMAIN}" != "tipi.localhost" ]]; then
   exit 1
   exit 1
 fi
 fi
 
 
+kill_watcher
 # Configure Tipi
 # Configure Tipi
 "${ROOT_FOLDER}/scripts/configure.sh"
 "${ROOT_FOLDER}/scripts/configure.sh"
-
-kill_watcher
+chmod -R a+rwx "${ROOT_FOLDER}/state/events"
+chmod -R a+rwx "${ROOT_FOLDER}/state/system-info.json"
 "${ROOT_FOLDER}/scripts/watcher.sh" &
 "${ROOT_FOLDER}/scripts/watcher.sh" &
 
 
 # Copy the config sample if it isn't here
 # Copy the config sample if it isn't here
@@ -201,9 +202,6 @@ mv -f "$ENV_FILE" "$ROOT_FOLDER/.env"
 # Run system-info.sh
 # Run system-info.sh
 echo "Running system-info.sh..."
 echo "Running system-info.sh..."
 bash "${ROOT_FOLDER}/scripts/system-info.sh"
 bash "${ROOT_FOLDER}/scripts/system-info.sh"
-echo "Fixing permissions for events file"
-chmod -R a+rwx "${ROOT_FOLDER}/state/events"
-chmod -R a+rwx "${ROOT_FOLDER}/state/system-info.json"
 
 
 ## Don't run if config-only
 ## Don't run if config-only
 if [[ ! $ci == "true" ]]; then
 if [[ ! $ci == "true" ]]; then

+ 1 - 1
scripts/watcher.sh

@@ -17,7 +17,7 @@ function set_status() {
     write_log "Setting status for ${id} to ${status}"
     write_log "Setting status for ${id} to ${status}"
 
 
     # Update the status of the event
     # Update the status of the event
-    sed -i '' "s/${id} [a-z]*/${id} ${status}/g" "${WATCH_FILE}"
+    sed -i "s/${id}.*$/$(echo "${id} ${status}" | sed 's/\//\\\//g')/" "$WATCH_FILE"
 }
 }
 
 
 function run_command() {
 function run_command() {