delpoyment with fully dockerized project on wixur.ir, dyolink docker hub created beside backend and frontend image is uploaded.

This commit is contained in:
2026-07-07 15:32:25 +03:30
parent e00af9f5be
commit 329d3f122c
28 changed files with 877 additions and 44 deletions

View File

@@ -41,6 +41,6 @@ SMTP_USER=your_email@gmail.com
SMTP_PASSWORD=your_app_password
# SMS (sms.ir — use Sandbox API key for development)
# SMS_IR_API_KEY=lwbK7hxmjimNjFS4g5DWahh75EKCgJUfcUIinUQzfQXwXkSp
SMS_IR_API_KEY=4QKMiSU4Kh7tWPLCdRMV0QpDh8WgF33YkWRS18BcG3vf4QHi
# SMS_IR_API_KEY=4QKMiSU4Kh7tWPLCdRMV0QpDh8WgF33YkWRS18BcG3vf4QHi
SMS_IR_API_KEY=lwbK7hxmjimNjFS4g5DWahh75EKCgJUfcUIinUQzfQXwXkSp
SMS_IR_TEMPLATE_ID=123456

5
backend/.gitignore vendored
View File

@@ -3,6 +3,11 @@
/node_modules
/build
# Accidental tsc output next to Prisma sources (keep only .ts / schema / migrations)
/prisma/*.js
/prisma/*.d.ts
/prisma/*.js.map
# Logs
logs
*.log

View File

@@ -52,4 +52,4 @@ HEALTHCHECK --interval=30s --timeout=5s --start-period=40s --retries=3 \
ENTRYPOINT ["dumb-init", "--", "docker-entrypoint.sh"]
CMD ["node", "dist/main"]
CMD ["node", "dist/src/main.js"]

View File

@@ -9,6 +9,13 @@ if [ "$NODE_ENV" = "production" ]; then
echo "Running in PRODUCTION mode"
echo "Running database migrations..."
./node_modules/.bin/prisma migrate deploy
if [ -f "dist/prisma/seed.js" ]; then
echo "Seeding reference data (plans, org types, permissions)..."
node dist/prisma/seed.js
elif [ -f "prisma/seed.ts" ] || [ -f "prisma/seed.js" ]; then
echo "Running database seed..."
./node_modules/.bin/prisma db seed
fi
else
echo "Running in DEVELOPMENT mode"
echo "Syncing database schema..."

View File

@@ -11,7 +11,7 @@
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"start:prod": "node dist/src/main.js",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",

View File

@@ -3,16 +3,15 @@ import { PrismaClient } from '@prisma/client';
import { config } from 'dotenv';
import path from 'path';
// Load environment variables from the correct path
const envPath = path.join(__dirname, '..', '.env');
console.log('Loading .env from:', envPath);
config({ path: envPath });
// Load .env when running locally; Docker injects DATABASE_URL via env_file.
if (!process.env.DATABASE_URL) {
const envPath = path.join(__dirname, '..', '.env');
console.log('Loading .env from:', envPath);
config({ path: envPath });
}
// Verify DATABASE_URL is loaded
if (!process.env.DATABASE_URL) {
console.error('❌ DATABASE_URL is not set in environment');
console.log('Current directory:', process.cwd());
console.log('.env path:', envPath);
process.exit(1);
}

File diff suppressed because one or more lines are too long

View File

@@ -12,6 +12,7 @@
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "ES2023",
"jsx": "react",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",