feat(ci): enhance deployment process
This commit is contained in:
@@ -24,6 +24,7 @@ jobs:
|
|||||||
cd /var/www/html/basango.io
|
cd /var/www/html/basango.io
|
||||||
git pull origin main --rebase
|
git pull origin main --rebase
|
||||||
bun install --frozen-lockfile
|
bun install --frozen-lockfile
|
||||||
|
make deploy
|
||||||
curl -X POST "https://api.telegram.org/bot${{ secrets.DEVY_TOKEN }}/sendMessage" \
|
curl -X POST "https://api.telegram.org/bot${{ secrets.DEVY_TOKEN }}/sendMessage" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
.PHONY: default
|
||||||
|
default: help
|
||||||
|
|
||||||
|
.PHONY: help
|
||||||
|
help:
|
||||||
|
@echo Tasks:
|
||||||
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||||
|
|
||||||
|
# -----------------------------------
|
||||||
|
# Variables
|
||||||
|
# -----------------------------------
|
||||||
|
BUN ?= bun
|
||||||
|
BUNX ?= bunx
|
||||||
|
PM2 ?= pm2
|
||||||
|
PWD := $(shell pwd)
|
||||||
|
DRIZZLE_CONFIG ?= packages/db/drizzle.config.ts
|
||||||
|
|
||||||
|
# -----------------------------------
|
||||||
|
# Deployment
|
||||||
|
# -----------------------------------
|
||||||
|
.PHONY: deploy
|
||||||
|
deploy:
|
||||||
|
$(BUN) install --frozen-lockfile. # Install dependencies
|
||||||
|
$(BUN) run build:dashboard # Build dashboard app
|
||||||
|
cd packages/db # Change directory to packages/db
|
||||||
|
$(BUNX) drizzle-kit migrate # Run database migrations
|
||||||
|
cd $(PWD) # Change back to root directory
|
||||||
|
$(PM2) reload ecosystem.config.js --env production # Reload PM2 processes
|
||||||
|
|
||||||
|
|
||||||
|
# -----------------------------------
|
||||||
|
# PM2 Commands
|
||||||
|
# -----------------------------------
|
||||||
|
.PHONY: start
|
||||||
|
start:
|
||||||
|
$(PM2) start ecosystem.config.js --env production
|
||||||
|
|
||||||
|
.PHONY: restart
|
||||||
|
restart:
|
||||||
|
$(PM2) reload ecosystem.config.js --env production
|
||||||
|
|
||||||
|
.PHONY: stop
|
||||||
|
stop:
|
||||||
|
$(PM2) stop ecosystem.config.js --env production
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
const path = require("node:path");
|
||||||
|
|
||||||
|
const sharedEnv = {
|
||||||
|
NODE_ENV: "production",
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
apps: [
|
||||||
|
{
|
||||||
|
args: "run crawler:worker",
|
||||||
|
autorestart: true,
|
||||||
|
cwd: path.join(__dirname, "apps", "crawler"),
|
||||||
|
env: sharedEnv,
|
||||||
|
max_restarts: 5,
|
||||||
|
name: "worker.basango.io",
|
||||||
|
script: "bun",
|
||||||
|
watch: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
args: "run start",
|
||||||
|
autorestart: true,
|
||||||
|
cwd: path.join(__dirname, "apps", "api"),
|
||||||
|
env: sharedEnv,
|
||||||
|
max_restarts: 5,
|
||||||
|
name: "api.basango.io",
|
||||||
|
script: "bun",
|
||||||
|
watch: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
args: "run start",
|
||||||
|
autorestart: true,
|
||||||
|
cwd: path.join(__dirname, "apps", "dashboard"),
|
||||||
|
env: sharedEnv,
|
||||||
|
max_restarts: 5,
|
||||||
|
name: "dashboard.basango.io",
|
||||||
|
script: "bun",
|
||||||
|
watch: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user