diff --git a/docker/services/web/entrypoint.sh b/docker/services/web/entrypoint.sh index b6a5c23..e81ddc1 100644 --- a/docker/services/web/entrypoint.sh +++ b/docker/services/web/entrypoint.sh @@ -2,15 +2,8 @@ cd /app -rm -rf /app/node_modules -rm -rf /app/.next - -bun install -npm rebuild better-sqlite3 - -bun twui:add -bun twui:init -bun twui:update +chmod +x init.sh +./init.sh if [ $NODE_ENV = "production" ]; then echo "Production Environment" diff --git a/package.json b/package.json index 4e1bde1..75ea4bf 100644 --- a/package.json +++ b/package.json @@ -3,18 +3,19 @@ "version": "1.0.0", "private": true, "scripts": { - "dev": "next dev", - "pm2:dev": "pm2 start --name turboci-web 'bunx next dev' && pm2 start --name turboci-cron 'bun --watch src/cron/index.ts'", - "pm2:start": "pm2 start --name turboci-web 'bunx next start' && pm2 start --name turboci-cron 'bun src/cron/index.ts'", + "dev": "next dev -p 3772", + "pm2:dev": "./src/scripts/shell/start-dev.sh", + "pm2:start": "./src/scripts/shell/start-prod.sh", "pm2:kill": "pm2 kill", - "twui:init": "git submodule update twui --init", + "twui:init": "git submodule update --init twui", "twui:update": "git submodule update --remote", "twui:add": "git submodule add https://git.tben.me/Moduletrace/tailwind-ui-library.git twui", - "db:schema": "bunx bun-sqlite schema -t", + "db:schema": "bunx nsqlite schema -t", "docker:start": "docker compose down && docker compose up --build -d", "docker:logs": "docker compose logs -f -n 50", "rebuild:better-sqlite3": "npm rebuild better-sqlite3", "chown:root-dir": "sudo chown -R archben:archben .", + "git:push": "git add . && git commit -m 'Updates' && git push", "build": "next build" }, "dependencies": { diff --git a/src/scripts/shell/init.sh b/src/scripts/shell/init.sh new file mode 100755 index 0000000..ea2beaf --- /dev/null +++ b/src/scripts/shell/init.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +rm -rf /app/node_modules +rm -rf /app/.next + +bun install +npm rebuild better-sqlite3 + +bun twui:add || echo "TWUI Already Added" +bun twui:init || echo "TWUI Already Initialized" +bun twui:update + +bunx nsqlite schema -t \ No newline at end of file diff --git a/src/scripts/shell/start-dev.sh b/src/scripts/shell/start-dev.sh new file mode 100755 index 0000000..ab4a7ed --- /dev/null +++ b/src/scripts/shell/start-dev.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +pm2 start --name turboci-web 'bunx next dev -p 3772' +pm2 start --name turboci-cron 'bun --watch src/cron/index.ts' +pm2 start --name turboci-websocket 'bun --watch src/websocket/index.ts' \ No newline at end of file diff --git a/src/scripts/shell/start-prod.sh b/src/scripts/shell/start-prod.sh new file mode 100755 index 0000000..1a69e8c --- /dev/null +++ b/src/scripts/shell/start-prod.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +pm2 start --name turboci-web 'bunx next start -p 3772' +pm2 start --name turboci-cron 'bun src/cron/index.ts' +pm2 start --name turboci-websocket 'bun src/websocket/index.ts' \ No newline at end of file