diff --git a/docker/migration/Dockerfile b/docker/migration/Dockerfile index deeb0fefb..fc1540c25 100644 --- a/docker/migration/Dockerfile +++ b/docker/migration/Dockerfile @@ -35,4 +35,4 @@ WORKDIR /app/packages/server RUN git clone https://github.com/vishnubob/wait-for-it.git # Once we listen the mysql port run the migration task. -CMD ./wait-for-it/wait-for-it.sh mysql:3306 -- sh -c "pnpm run system:migrate:latest && pnpm run tenants:migrate:latest" +CMD ./wait-for-it/wait-for-it.sh mysql:3306 -- sh -c "node dist/cli.js system:migrate:latest && node dist/cli.js tenants:migrate:latest" diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index 0acd51a23..9a10f2a27 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -75,6 +75,9 @@ COPY --from=builder --chown=nodejs:nodejs /app/packages/server/src/i18n ./packag COPY --from=builder --chown=nodejs:nodejs /app/packages/server/public ./packages/server/public COPY --from=builder --chown=nodejs:nodejs /app/packages/server/static ./packages/server/static +# Copy database migration files (needed for running migrations) +COPY --from=builder --chown=nodejs:nodejs /app/packages/server/src/database ./packages/server/src/database + # Copy built shared packages (dist folders and package.json for module resolution) COPY --from=builder --chown=nodejs:nodejs /app/shared/bigcapital-utils/dist ./shared/bigcapital-utils/dist COPY --from=builder --chown=nodejs:nodejs /app/shared/pdf-templates/dist ./shared/pdf-templates/dist diff --git a/packages/server/nest-cli.json b/packages/server/nest-cli.json index 4767fad13..20fb98ab7 100644 --- a/packages/server/nest-cli.json +++ b/packages/server/nest-cli.json @@ -2,10 +2,23 @@ "$schema": "https://json.schemastore.org/nest-cli", "collection": "@nestjs/schematics", "sourceRoot": "src", + "entryFile": "main", "compilerOptions": { "deleteOutDir": true, "assets": [ - { "include": "i18n/**/*", "watchAssets": true } + { "include": "i18n/**/*", "watchAssets": true }, + { "include": "database/**/*", "watchAssets": true } ] + }, + "projects": { + "cli": { + "type": "application", + "root": "src", + "entryFile": "cli", + "sourceRoot": "src", + "compilerOptions": { + "tsConfigPath": "tsconfig.json" + } + } } } diff --git a/setup.sh b/setup.sh index bad522bbd..6ce9a61a4 100644 --- a/setup.sh +++ b/setup.sh @@ -2,7 +2,6 @@ # Initialize the essential variables. BRANCH=main CURRENT=$PWD -BIGCAPITAL_INSTALL_DIR=$PWD/bigcapital-$(echo $BRANCH | sed -r 's@(\/|" "|\.)@-@g') BIGCAPITAL_CLONE_TEMP_DIR=$(mktemp -d) CPU_ARCH=$(uname -m) @@ -20,8 +19,6 @@ else COMPOSE_CMD="docker compose" fi -REPO=https://github.com/bigcapitalhq/bigcapital - # Prints the Bigcapital logo once running the script. function print_logo() { clear @@ -142,8 +139,8 @@ function askForAction() { } function install() { - echo "Installing Bigcaoital.........." - echo "installing is going to take few mintues..." + echo "Installing Bigcapital.........." + echo "installing is going to take few minutes..." download setup_env } @@ -203,10 +200,11 @@ function startServices() { done printf "\r\033[K" echo " API server started successfully ✅" - source "${DOCKER_ENV_PATH}" + ACCESS_URL=$(grep -E '^BASE_URL=' "$DOCKER_ENV_PATH" 2>/dev/null | cut -d= -f2-) + [ -z "$ACCESS_URL" ] && ACCESS_URL="http://localhost" echo " Bigcapital server started successfully ✅" echo "" - echo " You can access the application at $WEB_URL" + echo " You can access the application at $ACCESS_URL" echo "" } @@ -223,20 +221,19 @@ function restartServices() { } function viewLogs(){ - ARG_SERVICE_NAME=$2 echo echo "Select a Service you want to view the logs for:" echo " 1) Webapp" echo " 2) API" echo " 3) Migration" - echo " 4) Nginx Proxy" + echo " 4) Envoy Proxy" echo " 5) MariaDB" echo " 0) Back to Main Menu" echo read -p "Service: " DOCKER_SERVICE_NAME until (( DOCKER_SERVICE_NAME >= 0 && DOCKER_SERVICE_NAME <= 5 )); do - echo "Invalid selection. Please enter a number between 1 and 11." + echo "Invalid selection. Please enter a number between 0 and 5." read -p "Service: " DOCKER_SERVICE_NAME done @@ -248,7 +245,7 @@ function viewLogs(){ 1) viewSpecificLogs "webapp";; 2) viewSpecificLogs "server";; 3) viewSpecificLogs "database_migration";; - 4) viewSpecificLogs "nginx";; + 4) viewSpecificLogs "proxy";; 5) viewSpecificLogs "mysql";; 0) askForAction;; *) echo "INVALID SERVICE NAME SUPPLIED";;