Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Database Configuration
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/nginx_waf?schema=public"

DB_NAME=nginx_waf
DB_USER=postgres
DB_PASSWORD=postgres
# Server Configuration
PORT=3001
NODE_ENV=production

# JWT Configuration
JWT_ACCESS_SECRET="change-this-to-random-secret"
JWT_REFRESH_SECRET="change-this-to-random-secret"
JWT_ACCESS_EXPIRES_IN=15m
JWT_REFRESH_EXPIRES_IN=7d

# CORS Configuration (comma-separated origins)
CORS_ORIGIN="http://localhost:8080,http://localhost:5173,http://YOUR_PUBLIC_IP:8080"

# Security
BCRYPT_ROUNDS=10

# Session
SESSION_SECRET="change-this-to-random-secret"

# 2FA
TWO_FACTOR_APP_NAME=Nginx WAF Admin

# SSL Configuration
SSL_DIR="/etc/nginx/ssl"
ACME_DIR="/var/www/html/.well-known/acme-challenge"

# SMTP Configuration
SMTP_HOST="smtp.example.com"
SMTP_PORT=587
SMTP_USER="user@example.com"
SMTP_PASS="change-this-to-random-password"

# Frontend Configuration
VITE_API_URL=http://localhost:3001/api
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,55 @@ git pull
bash scripts/update.sh
```

### 🖥️ Production Deployment (Docker container)

## Environment Setup

Before running the application, you need to set up your environment variables:

1. Copy the example environment file to create your local environment configuration:
```bash
cp .env.example .env
```

Update the following required environment variables in your `.env` file:

| Variable | Description | Example Value | Required |
|----------|-------------|---------------|----------|
| `JWT_ACCESS_SECRET` | Secret key for JWT access tokens | `your-random-secret-key-32-chars` | ✅ Yes |
| `JWT_REFRESH_SECRET` | Secret key for JWT refresh tokens | `your-random-secret-key-32-chars` | ✅ Yes |
| `SESSION_SECRET` | Secret key for session management | `your-random-secret-key-32-chars` | ✅ Yes |
| `VITE_API_URL` | Backend API URL for frontend | `http://YOUR_SERVER_IP:3001/api` | ✅ Yes |
| `DB_NAME` | PostgreSQL database name | `nginx_waf` | ✅ Yes |
| `DB_USER` | PostgreSQL database user | `postgres` | ✅ Yes |
| `DB_PASSWORD` | PostgreSQL database password | `postgres` | ✅ Yes |
| `POSTGRES_INITDB_ARGS` | PostgreSQL initialization arguments | `--encoding=UTF-8 --lc-collate=C --lc-ctype=C` | ⚠️ Optional |
| `CORS_ORIGIN` | Allowed CORS origins (comma-separated) | `http://YOUR_SERVER_IP:8080,http://localhost:8080` | ✅ Yes |

**Security Note**: Generate strong random secrets using:
```bash
openssl rand -base64 32
```

2. Edit the `.env` file and configure the necessary environment variables according to your local setup.




**Note**: The `.env.example` file serves as a template with all required environment variables. Make sure to update the values in your `.env` file with your actual configuration before starting the application.


```bash
# Clone repository
git clone https://github.com/TinyActive/nginx-love.git
cd nginx-love

# Run script install docker latest version
bash docker/scripts/docker.sh
docker-compose build && docker-compose up -d

```



**Minimum Requirements:**
Expand Down
1 change: 0 additions & 1 deletion apps/api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ CORS_ORIGIN="http://localhost:8080,http://localhost:5173,http://YOUR_PUBLIC_IP:8

# Security
BCRYPT_ROUNDS=10

# Session
SESSION_SECRET="change-this-to-random-secret"

Expand Down
30 changes: 0 additions & 30 deletions apps/api/.env.test

This file was deleted.

Loading
Loading