Initial project setup with dependencies and deployment config
This commit is contained in:
21
.env.example
Normal file
21
.env.example
Normal file
@@ -0,0 +1,21 @@
|
||||
# Server
|
||||
PORT=5100
|
||||
HOST=0.0.0.0
|
||||
|
||||
# Redis (your existing silver-redis)
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PORT=6379
|
||||
REDIS_PASSWORD=your_redis_password_here
|
||||
REDIS_DB=2
|
||||
|
||||
# Storage
|
||||
UPLOAD_DIR=./uploads
|
||||
OUTPUT_DIR=./processed
|
||||
MAX_FILE_SIZE=20971520
|
||||
|
||||
# Worker
|
||||
CONCURRENCY=2
|
||||
|
||||
# Bull Board (admin dashboard)
|
||||
BULL_BOARD_USER=admin
|
||||
BULL_BOARD_PASS=changeme
|
||||
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
node_modules/
|
||||
uploads/
|
||||
processed/
|
||||
.env
|
||||
*.log
|
||||
39
ecosystem.config.js
Normal file
39
ecosystem.config.js
Normal file
@@ -0,0 +1,39 @@
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
// Single process: API + Worker together (good for your server size)
|
||||
// To split later: separate into api + worker entries
|
||||
name: "imgforge",
|
||||
script: "src/index.js",
|
||||
cwd: "/opt/apps/imgforge",
|
||||
env: {
|
||||
NODE_ENV: "production",
|
||||
PORT: 5100,
|
||||
},
|
||||
// Restart on crashes
|
||||
max_restarts: 10,
|
||||
restart_delay: 2000,
|
||||
// Log rotation
|
||||
log_date_format: "YYYY-MM-DD HH:mm:ss",
|
||||
error_file: "/opt/logs/apps/imgforge-error.log",
|
||||
out_file: "/opt/logs/apps/imgforge-out.log",
|
||||
merge_logs: true,
|
||||
},
|
||||
|
||||
// Uncomment below to run worker as a separate process for heavier loads:
|
||||
// {
|
||||
// name: "imgforge-worker",
|
||||
// script: "src/workers/image.worker.js",
|
||||
// cwd: "/opt/apps/imgforge",
|
||||
// env: {
|
||||
// NODE_ENV: "production",
|
||||
// },
|
||||
// instances: 1,
|
||||
// max_restarts: 10,
|
||||
// restart_delay: 2000,
|
||||
// error_file: "/opt/logs/apps/imgforge-worker-error.log",
|
||||
// out_file: "/opt/logs/apps/imgforge-worker-out.log",
|
||||
// merge_logs: true,
|
||||
// },
|
||||
],
|
||||
};
|
||||
24
nginx.conf
Normal file
24
nginx.conf
Normal file
@@ -0,0 +1,24 @@
|
||||
# /opt/infrastructure/nginx/sites/imgforge.conf
|
||||
server {
|
||||
server_name imgforge.silverwal.com;
|
||||
|
||||
client_max_body_size 25M;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:5100;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
|
||||
# WebSocket timeout (keep alive for progress streaming)
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
}
|
||||
|
||||
listen 80;
|
||||
}
|
||||
2069
package-lock.json
generated
Normal file
2069
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
package.json
Normal file
25
package.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "imgforge",
|
||||
"version": "1.0.0",
|
||||
"description": "Self-hosted image processing queue — resize, convert, compress, watermark with Bull + Sharp",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"start": "node src/index.js",
|
||||
"worker": "node src/workers/image.worker.js",
|
||||
"dev": "node --watch src/index.js",
|
||||
"dev:worker": "node --watch src/workers/image.worker.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"bull": "^4.12.9",
|
||||
"bullmq": "^5.20.0",
|
||||
"express": "^4.21.0",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"sharp": "^0.33.5",
|
||||
"ws": "^8.18.0",
|
||||
"@bull-board/express": "^5.21.0",
|
||||
"@bull-board/api": "^5.21.0",
|
||||
"mime-types": "^2.1.35",
|
||||
"nanoid": "^3.3.7",
|
||||
"dotenv": "^16.4.5"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user