Add deployment docs and fix dotenv loading
- Add deploy/server-info.md with full server access, DB, SSL, nginx info - Add dotenv dependency for .env file loading on server - Server running at https://marketplace.173.212.212.157.sslip.io Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
89
deploy/server-info.md
Normal file
89
deploy/server-info.md
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
# Marketplace — Server Deployment Info
|
||||||
|
|
||||||
|
## Server Access
|
||||||
|
- **IP**: 173.212.212.157
|
||||||
|
- **OS**: Ubuntu 24.04.2 LTS
|
||||||
|
- **SSH User**: root
|
||||||
|
- **SSH Password**: V8Padp8oIwl8m3RP0Mi28o5TVrkh
|
||||||
|
- **Connect**: `sshpass -p 'V8Padp8oIwl8m3RP0Mi28o5TVrkh' ssh root@173.212.212.157`
|
||||||
|
|
||||||
|
## Domain & SSL
|
||||||
|
- **Domain**: marketplace.173.212.212.157.sslip.io
|
||||||
|
- **URL**: https://marketplace.173.212.212.157.sslip.io
|
||||||
|
- **DNS Provider**: sslip.io (automatic IP-based DNS, no account needed)
|
||||||
|
- **SSL**: Let's Encrypt via Certbot
|
||||||
|
- **Certificate Path**: /etc/letsencrypt/live/marketplace.173.212.212.157.sslip.io/
|
||||||
|
- **Certificate Expiry**: 2026-05-23
|
||||||
|
- **Auto-renewal**: certbot.timer (systemd), runs twice daily
|
||||||
|
|
||||||
|
## Server Software
|
||||||
|
- **Node.js**: v20.20.0
|
||||||
|
- **Nginx**: 1.24.0
|
||||||
|
- **PostgreSQL**: 16
|
||||||
|
- **PM2**: process manager
|
||||||
|
- **Certbot**: 2.9.0
|
||||||
|
|
||||||
|
## File Paths
|
||||||
|
- **Frontend (static)**: /var/www/marketplace/
|
||||||
|
- **Backend (app)**: /var/www/marketplace-app/
|
||||||
|
- **Server code**: /var/www/marketplace-app/server/
|
||||||
|
- **Uploads**: /var/www/marketplace-app/server/uploads/
|
||||||
|
- **Nginx config**: /etc/nginx/sites-available/marketplace
|
||||||
|
- **Server .env**: /var/www/marketplace-app/server/.env
|
||||||
|
|
||||||
|
## Database
|
||||||
|
- **Type**: PostgreSQL 16
|
||||||
|
- **Host**: localhost:5432
|
||||||
|
- **Database**: marketplace
|
||||||
|
- **User**: marketplace
|
||||||
|
- **Password**: marketplace_dev
|
||||||
|
- **Connection**: `postgresql://marketplace:marketplace_dev@localhost:5432/marketplace`
|
||||||
|
|
||||||
|
## Backend
|
||||||
|
- **Port**: 3001
|
||||||
|
- **PM2 name**: marketplace-api
|
||||||
|
- **Start command**: `pm2 start "npx tsx src/index.ts" --name marketplace-api`
|
||||||
|
- **Health check**: https://marketplace.173.212.212.157.sslip.io/api/health
|
||||||
|
|
||||||
|
## JWT Secrets
|
||||||
|
- **Access Token**: mkt-jwt-secret-prod-2026-xK9mP2
|
||||||
|
- **Refresh Token**: mkt-refresh-secret-prod-2026-qW7nL4
|
||||||
|
|
||||||
|
## Nginx Configuration
|
||||||
|
- HTTP (port 80) -> HTTPS redirect
|
||||||
|
- `/` -> SPA with try_files fallback to index.html
|
||||||
|
- `/api/*` -> proxy to http://127.0.0.1:3001/api/
|
||||||
|
- `/socket.io/*` -> WebSocket proxy to http://127.0.0.1:3001/socket.io/
|
||||||
|
- `/uploads/*` -> alias to /var/www/marketplace-app/server/uploads/
|
||||||
|
- `/assets/*` -> cached 1 year, immutable
|
||||||
|
|
||||||
|
## Git Repository
|
||||||
|
- **Gitea**: https://git.sensey24.ru/aibot777/marketplace
|
||||||
|
- **Credentials**: aibot777:aibot777
|
||||||
|
- **Clone**: `git clone https://aibot777:aibot777@git.sensey24.ru/aibot777/marketplace.git`
|
||||||
|
|
||||||
|
## Deployment Steps
|
||||||
|
|
||||||
|
### Frontend (client)
|
||||||
|
```bash
|
||||||
|
cd /Users/tony/Downloads/marketplace
|
||||||
|
npm run build --workspace=client
|
||||||
|
sshpass -p 'V8Padp8oIwl8m3RP0Mi28o5TVrkh' scp -r client/dist/* root@173.212.212.157:/var/www/marketplace/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Backend (server)
|
||||||
|
```bash
|
||||||
|
sshpass -p 'V8Padp8oIwl8m3RP0Mi28o5TVrkh' ssh root@173.212.212.157 'cd /var/www/marketplace-app && git pull && cd server && npm install && npx prisma db push && pm2 restart marketplace-api'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Full redeploy
|
||||||
|
```bash
|
||||||
|
npm run build --workspace=client
|
||||||
|
sshpass -p 'V8Padp8oIwl8m3RP0Mi28o5TVrkh' scp -r client/dist/* root@173.212.212.157:/var/www/marketplace/
|
||||||
|
sshpass -p 'V8Padp8oIwl8m3RP0Mi28o5TVrkh' ssh root@173.212.212.157 'cd /var/www/marketplace-app && git pull && cd server && npm install && npx prisma db push && pm2 restart marketplace-api'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Stripe (Not configured yet)
|
||||||
|
- STRIPE_SECRET_KEY: (empty)
|
||||||
|
- STRIPE_WEBHOOK_SECRET: (empty)
|
||||||
|
- Test card: 4242 4242 4242 4242
|
||||||
@@ -25,7 +25,8 @@
|
|||||||
"stripe": "^17.5.0",
|
"stripe": "^17.5.0",
|
||||||
"helmet": "^8.0.0",
|
"helmet": "^8.0.0",
|
||||||
"express-rate-limit": "^7.5.0",
|
"express-rate-limit": "^7.5.0",
|
||||||
"cookie-parser": "^1.4.7"
|
"cookie-parser": "^1.4.7",
|
||||||
|
"dotenv": "^16.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dotenv/config';
|
||||||
|
|
||||||
export const env = {
|
export const env = {
|
||||||
PORT: parseInt(process.env['PORT'] || '3000', 10),
|
PORT: parseInt(process.env['PORT'] || '3000', 10),
|
||||||
DATABASE_URL: process.env['DATABASE_URL'] || 'postgresql://marketplace:marketplace_dev@localhost:5432/marketplace',
|
DATABASE_URL: process.env['DATABASE_URL'] || 'postgresql://marketplace:marketplace_dev@localhost:5432/marketplace',
|
||||||
|
|||||||
Reference in New Issue
Block a user