Compare commits
5 Commits
feat/conne
...
0899ba1bc9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0899ba1bc9 | ||
|
|
5268e7618b | ||
|
|
3714200dc1 | ||
|
|
8f5d572632 | ||
| dffb1a6681 |
12
.env.example
Normal file
12
.env.example
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Host-side port for the API container (container port remains 3000)
|
||||||
|
API_HOST_PORT=3001
|
||||||
|
|
||||||
|
DATABASE_URL="postgresql://user:password@localhost:5432/nest_db"
|
||||||
|
JWT_SECRET="change_me_to_a_long_random_string"
|
||||||
|
PORT=3000
|
||||||
|
|
||||||
|
ADMIN_USERNAME="admin"
|
||||||
|
ADMIN_EMAIL="admin@example.com"
|
||||||
|
ADMIN_PASSWORD="change_me"
|
||||||
|
FRONT_ORIGIN="http://localhost:5173"
|
||||||
|
INTRA_ORIGIN="http://localhost:5174"
|
||||||
@@ -49,7 +49,7 @@ npm install
|
|||||||
|
|
||||||
### 3. Set Up Environment
|
### 3. Set Up Environment
|
||||||
|
|
||||||
Create `.env` files based on the examples in each project. See the main [README.md](./README.md) for required environment variables.
|
Create a root `.env` file from `.env.example` (`cp .env.example .env`) and adjust values as needed. See the main [README.md](./README.md) for required environment variables.
|
||||||
|
|
||||||
### 4. Create a Branch
|
### 4. Create a Branch
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,11 @@ nest-intra/ # Staff-only internal portal (React + Vite)
|
|||||||
### 1. Backend Setup
|
### 1. Backend Setup
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd nest-backend
|
# from repository root
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
# Edit .env with your database credentials
|
# Edit .env with your credentials
|
||||||
|
|
||||||
|
cd nest-backend
|
||||||
npm install
|
npm install
|
||||||
npm run db:push # Initialize database schema
|
npm run db:push # Initialize database schema
|
||||||
npm run db:seed # Populate with sample data
|
npm run db:seed # Populate with sample data
|
||||||
@@ -35,6 +37,7 @@ npm run dev # Start dev server (http://localhost:3000)
|
|||||||
#### Backend Environment Variables
|
#### Backend Environment Variables
|
||||||
|
|
||||||
```env
|
```env
|
||||||
|
API_HOST_PORT=3001
|
||||||
DATABASE_URL="postgresql://user:password@localhost:5432/nest_db"
|
DATABASE_URL="postgresql://user:password@localhost:5432/nest_db"
|
||||||
JWT_SECRET="your-secret-key"
|
JWT_SECRET="your-secret-key"
|
||||||
PORT=3000
|
PORT=3000
|
||||||
|
|||||||
47
docker-compose.prod.yml
Normal file
47
docker-compose.prod.yml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: nest_db
|
||||||
|
POSTGRES_USER: nest_user
|
||||||
|
POSTGRES_PASSWORD: nest_password
|
||||||
|
volumes:
|
||||||
|
- db_data:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U nest_user -d nest_db"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
api:
|
||||||
|
image: git.crowmate.fr/crowmate/nest-api:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "${API_HOST_PORT:-3001}:3000"
|
||||||
|
environment:
|
||||||
|
DATABASE_URL: postgresql://nest_user:nest_password@db:5432/nest_db
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
front:
|
||||||
|
image: git.crowmate.fr/crowmate/nest-front:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "5143:80"
|
||||||
|
environment:
|
||||||
|
API_URL: http://api:3000
|
||||||
|
depends_on:
|
||||||
|
- api
|
||||||
|
|
||||||
|
intra:
|
||||||
|
image: git.crowmate.fr/crowmate/nest-intra:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "5174:5174"
|
||||||
|
depends_on:
|
||||||
|
- api
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
db_data:
|
||||||
@@ -18,9 +18,9 @@ services:
|
|||||||
build: ./nest-backend
|
build: ./nest-backend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "${API_HOST_PORT:-3001}:3000"
|
||||||
env_file:
|
env_file:
|
||||||
- ./nest-backend/.env
|
- ./.env
|
||||||
environment:
|
environment:
|
||||||
DATABASE_URL: postgresql://nest_user:nest_password@db:5432/nest_db
|
DATABASE_URL: postgresql://nest_user:nest_password@db:5432/nest_db
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
@@ -28,4 +28,4 @@ COPY prisma ./prisma
|
|||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
CMD ["node", "dist/index.js"]
|
CMD ["sh", "-c", "npx prisma migrate deploy && node dist/index.js"]
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "${API_HOST_PORT:-3001}:3000"
|
||||||
|
env_file:
|
||||||
|
- ../.env
|
||||||
environment:
|
environment:
|
||||||
DATABASE_URL: postgresql://nest_user:nest_password@db:5432/nest_db
|
DATABASE_URL: postgresql://nest_user:nest_password@db:5432/nest_db
|
||||||
JWT_SECRET: ${JWT_SECRET:-change_me_in_production}
|
JWT_SECRET: ${JWT_SECRET:-change_me_in_production}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/client": "^5.22.0",
|
"@prisma/client": "^5.22.0",
|
||||||
|
"prisma": "^5.22.0",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
@@ -29,7 +30,6 @@
|
|||||||
"@types/express": "^4.17.25",
|
"@types/express": "^4.17.25",
|
||||||
"@types/jsonwebtoken": "^9.0.7",
|
"@types/jsonwebtoken": "^9.0.7",
|
||||||
"@types/node": "^22.7.5",
|
"@types/node": "^22.7.5",
|
||||||
"prisma": "^5.22.0",
|
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"ts-node-dev": "^2.0.0",
|
"ts-node-dev": "^2.0.0",
|
||||||
"typescript": "^5.6.3"
|
"typescript": "^5.6.3"
|
||||||
|
|||||||
Reference in New Issue
Block a user