diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 04186dc..d35387b 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -5,7 +5,10 @@ push: branches: - main - + pull_request: + branches: + - '**' + jobs: deploy: runs-on: ubuntu-latest @@ -32,6 +35,7 @@ CI: false - name: Build & Start Server with PM2 + if: github.ref == 'refs/heads/main' && github.event_name == 'push' uses: appleboy/ssh-action@master with: host: ${{ secrets.HOST_IP }} diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..f8fa91a --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,20 @@ +module.exports = { + apps: [{ + name: 'chesstools', + script: 'npm', + args: 'run start -- -p 3001', + cwd: '/root/chesstools/chesstools', + env: { + NODE_ENV: 'production', + PORT: 3001 + }, + instances: 1, + autorestart: true, + watch: false, + max_memory_restart: '1G', + error_file: '/var/log/chesstools-error.log', + out_file: '/var/log/chesstools-out.log', + log_file: '/var/log/chesstools.log', + time: true + }] +}; diff --git a/package-lock.json b/package-lock.json index 201ee7d..e508d09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -755,9 +755,9 @@ } }, "node_modules/@next/env": { - "version": "15.5.7", - "resolved": "https://registry.npmjs.org/@next/env/-/env-15.5.7.tgz", - "integrity": "sha512-4h6Y2NyEkIEN7Z8YxkA27pq6zTkS09bUSYC0xjd0NpwFxjnIKeZEeH591o5WECSmjpUhLn3H2QLJcDye3Uzcvg==", + "version": "15.5.9", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.5.9.tgz", + "integrity": "sha512-4GlTZ+EJM7WaW2HEZcyU317tIQDjkQIyENDLxYJfSWlfqguN+dHkZgyQTV/7ykvobU7yEH5gKvreNrH4B6QgIg==", "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { @@ -5526,12 +5526,12 @@ "license": "MIT" }, "node_modules/next": { - "version": "15.5.7", - "resolved": "https://registry.npmjs.org/next/-/next-15.5.7.tgz", - "integrity": "sha512-+t2/0jIJ48kUpGKkdlhgkv+zPTEOoXyr60qXe68eB/pl3CMJaLeIGjzp5D6Oqt25hCBiBTt8wEeeAzfJvUKnPQ==", + "version": "15.5.9", + "resolved": "https://registry.npmjs.org/next/-/next-15.5.9.tgz", + "integrity": "sha512-agNLK89seZEtC5zUHwtut0+tNrc0Xw4FT/Dg+B/VLEo9pAcS9rtTKpek3V6kVcVwsB2YlqMaHdfZL4eLEVYuCg==", "license": "MIT", "dependencies": { - "@next/env": "15.5.7", + "@next/env": "15.5.9", "@swc/helpers": "0.5.15", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", diff --git a/python_env/requirements.txt b/python_env/requirements.txt index 1b9ea4d..1d42350 100644 --- a/python_env/requirements.txt +++ b/python_env/requirements.txt @@ -3,5 +3,5 @@ chess==1.11.1 fentoimage==0.1.0 future==0.18.2 macholib==1.15.2 -Pillow==10.3.0 +Pillow==9.5.0 six==1.15.0 diff --git a/startup.sh b/startup.sh index dd64ae1..b03a959 100755 --- a/startup.sh +++ b/startup.sh @@ -26,3 +26,14 @@ npm install echo "Generating docker image" docker build -t fen-generator . + +echo "Building Next.js app..." +npm run build + +echo "Starting Next.js app with PM2 on port 3001..." +pm2 delete chesstools 2>/dev/null || true +pm2 start ecosystem.config.js +pm2 save + +echo "App started with PM2. Use 'pm2 logs chesstools' to view logs." +echo "Use 'pm2 status' to check status."