Skip to content

Commit 124db0e

Browse files
authored
Merge pull request #361 from Worklenz/imp/docker-production-setup-and-fixes
Imp/docker production setup and fixes
2 parents 015aec7 + ac817d0 commit 124db0e

30 files changed

Lines changed: 3807 additions & 1156 deletions

.env.example

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
# ============================================================================
2+
# Worklenz Self-Hosted Configuration
3+
# ============================================================================
4+
# Copy this file to .env and configure according to your needs
5+
# Required fields are marked with (REQUIRED)
6+
# ============================================================================
7+
8+
# ============================================================================
9+
# DEPLOYMENT MODE
10+
# ============================================================================
11+
# Choose deployment mode:
12+
# - express: All services bundled (PostgreSQL, Redis, MinIO included) - Recommended for most users
13+
# - advanced: Use external services (AWS S3, Azure Blob, external PostgreSQL)
14+
DEPLOYMENT_MODE=express
15+
16+
# ============================================================================
17+
# DOMAIN AND URL CONFIGURATION
18+
# ============================================================================
19+
# Your domain name (e.g., worklenz.example.com)
20+
# For localhost testing: localhost
21+
# For production: your-domain.com
22+
DOMAIN=localhost
23+
24+
# Base URL for the API (used by frontend to connect to backend)
25+
# For production with HTTPS: https://your-domain.com
26+
# For localhost HTTP: http://localhost
27+
VITE_API_URL=http://localhost
28+
29+
# WebSocket URL for real-time features
30+
# For production with HTTPS: wss://your-domain.com
31+
# For localhost: ws://localhost
32+
VITE_SOCKET_URL=ws://localhost
33+
34+
# Frontend URL (used by backend for CORS and redirects)
35+
# Should match your domain URL
36+
FRONTEND_URL=http://localhost
37+
38+
# CORS Configuration
39+
# For development: * (allows all origins)
40+
# For production: your-domain.com or https://your-domain.com
41+
SERVER_CORS=*
42+
SOCKET_IO_CORS=http://localhost
43+
44+
# ============================================================================
45+
# PORT CONFIGURATION
46+
# ============================================================================
47+
# Ports exposed to the host machine
48+
HTTP_PORT=80
49+
HTTPS_PORT=443
50+
51+
# ============================================================================
52+
# DATABASE CONFIGURATION (PostgreSQL)
53+
# ============================================================================
54+
DB_NAME=worklenz_db
55+
DB_USER=postgres
56+
# Database password (REQUIRED) - Change this!
57+
DB_PASSWORD=CHANGE_THIS_SECURE_PASSWORD_123
58+
DB_MAX_CLIENTS=50
59+
USE_PG_NATIVE=false
60+
61+
# Advanced: External PostgreSQL (only if not using bundled PostgreSQL)
62+
# DB_HOST=your-postgres-host.com
63+
# DB_PORT=5432
64+
65+
# ============================================================================
66+
# SECURITY SECRETS
67+
# ============================================================================
68+
# Generate secure random strings with: openssl rand -hex 32
69+
70+
# Session Secret (REQUIRED)
71+
SESSION_SECRET=CHANGE_THIS_TO_RANDOM_HEX_STRING_32_CHARS
72+
73+
# Cookie Secret (REQUIRED)
74+
COOKIE_SECRET=CHANGE_THIS_TO_RANDOM_HEX_STRING_32_CHARS
75+
76+
# JWT Secret (REQUIRED)
77+
JWT_SECRET=CHANGE_THIS_TO_RANDOM_HEX_STRING_32_CHARS
78+
79+
# Session cookie name
80+
SESSION_NAME=worklenz.sid
81+
82+
# ============================================================================
83+
# REDIS CONFIGURATION
84+
# ============================================================================
85+
# Redis password (REQUIRED for Express mode)
86+
REDIS_PASSWORD=CHANGE_THIS_REDIS_PASSWORD
87+
REDIS_DB=0
88+
89+
# ============================================================================
90+
# STORAGE CONFIGURATION
91+
# ============================================================================
92+
# Storage provider: s3 (for MinIO/AWS S3), azure (for Azure Blob)
93+
STORAGE_PROVIDER=s3
94+
95+
# ----------------------------------------------------------------------------
96+
# MinIO Configuration (Express Mode - Default, S3-compatible)
97+
# ----------------------------------------------------------------------------
98+
AWS_REGION=us-east-1
99+
AWS_BUCKET=worklenz-bucket
100+
AWS_ACCESS_KEY_ID=minioadmin
101+
# MinIO secret access key (REQUIRED) - Change this!
102+
AWS_SECRET_ACCESS_KEY=CHANGE_THIS_MINIO_PASSWORD
103+
S3_URL=http://minio:9000
104+
MINIO_BROWSER=on
105+
106+
# ----------------------------------------------------------------------------
107+
# AWS S3 Configuration (Advanced Mode - External S3)
108+
# ----------------------------------------------------------------------------
109+
# Uncomment and configure if using real AWS S3 (set STORAGE_PROVIDER=s3)
110+
# AWS_REGION=us-east-1
111+
# AWS_BUCKET=your-worklenz-bucket
112+
# AWS_ACCESS_KEY_ID=your_aws_access_key_id
113+
# AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
114+
# S3_URL= # Leave empty for AWS S3 (not MinIO)
115+
116+
# ----------------------------------------------------------------------------
117+
# Azure Blob Storage Configuration (Advanced Mode)
118+
# ----------------------------------------------------------------------------
119+
# Uncomment and configure if using Azure Blob (set STORAGE_PROVIDER=azure)
120+
# AZURE_STORAGE_ACCOUNT_NAME=your_storage_account
121+
# AZURE_STORAGE_CONTAINER=worklenz-uploads
122+
# AZURE_STORAGE_ACCOUNT_KEY=your_storage_account_key
123+
# AZURE_STORAGE_URL=https://your_account.blob.core.windows.net
124+
125+
# ============================================================================
126+
# GOOGLE OAUTH (Optional)
127+
# ============================================================================
128+
# Configure if you want to enable Google login
129+
# Get credentials from: https://console.cloud.google.com/apis/credentials
130+
# GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
131+
# GOOGLE_CLIENT_SECRET=your-client-secret
132+
# GOOGLE_CALLBACK_URL=http://localhost/api/auth/google/callback
133+
# VITE_ENABLE_GOOGLE_LOGIN=true
134+
135+
# ============================================================================
136+
# EMAIL CONFIGURATION (Optional)
137+
# ============================================================================
138+
# Configure if you want to enable email notifications
139+
# Note: Worklenz uses AWS SES for email, configure your SES credentials
140+
141+
ENABLE_EMAIL_CRONJOBS=false
142+
# CONTACT_US_EMAIL=contact@your-domain.com
143+
144+
# For AWS SES, use the AWS credentials above or configure separate SES credentials
145+
# AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are also used for SES
146+
# AWS_REGION should be your SES region
147+
148+
# ============================================================================
149+
# GOOGLE RECAPTCHA (Optional)
150+
# ============================================================================
151+
# Configure if you want to enable reCAPTCHA protection
152+
# Get credentials from: https://www.google.com/recaptcha/admin
153+
# GOOGLE_CAPTCHA_SECRET_KEY=your-secret-key
154+
# GOOGLE_CAPTCHA_PASS_SCORE=0.8
155+
# VITE_ENABLE_RECAPTCHA=true
156+
# VITE_RECAPTCHA_SITE_KEY=your-site-key
157+
158+
# ============================================================================
159+
# APPLICATION CONFIGURATION
160+
# ============================================================================
161+
# Application title (shown in browser tab)
162+
VITE_APP_TITLE=Worklenz
163+
164+
# Enable survey modal (user feedback)
165+
VITE_ENABLE_SURVEY_MODAL=false
166+
167+
# Timezone
168+
TZ=UTC
169+
170+
# ============================================================================
171+
# BACKUP CONFIGURATION
172+
# ============================================================================
173+
# Backup retention in days (backups older than this are auto-deleted)
174+
BACKUP_RETENTION_DAYS=30
175+
176+
# ============================================================================
177+
# SSL/TLS CONFIGURATION
178+
# ============================================================================
179+
# Enable SSL with Let's Encrypt (true/false)
180+
ENABLE_SSL=false
181+
182+
# Email for Let's Encrypt notifications (required if ENABLE_SSL=true)
183+
# LETSENCRYPT_EMAIL=admin@your-domain.com
184+
185+
# ============================================================================
186+
# DOCKER CONFIGURATION
187+
# ============================================================================
188+
# Docker Hub username (for building and pushing custom images)
189+
# Pre-built images are available at: chamikajaycey/worklenz-backend and chamikajaycey/worklenz-frontend
190+
DOCKER_USERNAME=chamikajaycey
191+
192+
# ============================================================================
193+
# ADVANCED CONFIGURATION (Usually no need to change)
194+
# ============================================================================
195+
# Backend port inside container
196+
PORT=3000
197+
198+
# Node environment
199+
NODE_ENV=production
200+
201+
# ============================================================================
202+
# CONFIGURATION GUIDE
203+
# ============================================================================
204+
#
205+
# QUICK START (Express Mode - Recommended):
206+
# ==========================================
207+
# 1. Copy this file: cp .env.example .env
208+
# 2. Change these required passwords:
209+
# - DB_PASSWORD
210+
# - SESSION_SECRET (generate with: openssl rand -hex 32)
211+
# - COOKIE_SECRET (generate with: openssl rand -hex 32)
212+
# - JWT_SECRET (generate with: openssl rand -hex 32)
213+
# - AWS_SECRET_ACCESS_KEY (MinIO password)
214+
# - REDIS_PASSWORD
215+
# 3. For localhost: Keep DOMAIN=localhost and URLs as http://localhost
216+
# 4. For production domain: Set DOMAIN, update all URLs to https://your-domain.com
217+
# 5. Run: docker compose --profile express up -d
218+
#
219+
# PRODUCTION DEPLOYMENT WITH CUSTOM DOMAIN:
220+
# ==========================================
221+
# 1. Set DOMAIN=your-domain.com
222+
# 2. Update URLs:
223+
# VITE_API_URL=https://your-domain.com
224+
# VITE_SOCKET_URL=wss://your-domain.com
225+
# FRONTEND_URL=https://your-domain.com
226+
# SERVER_CORS=https://your-domain.com
227+
# SOCKET_IO_CORS=https://your-domain.com
228+
# 3. Enable SSL:
229+
# ENABLE_SSL=true
230+
# LETSENCRYPT_EMAIL=your-email@domain.com
231+
# 4. Point your domain's DNS A record to your server IP
232+
# 5. Run: docker compose --profile express --profile ssl up -d
233+
#
234+
# ADVANCED MODE (External Services):
235+
# ===================================
236+
# 1. Set DEPLOYMENT_MODE=advanced
237+
# 2. For AWS S3:
238+
# - Set STORAGE_PROVIDER=s3
239+
# - Configure AWS_* variables with real AWS credentials
240+
# - Set S3_URL="" (empty for real S3, not MinIO)
241+
# 3. For Azure Blob:
242+
# - Set STORAGE_PROVIDER=azure
243+
# - Configure AZURE_* variables
244+
# 4. For external PostgreSQL:
245+
# - Uncomment and set DB_HOST, DB_PORT
246+
# 5. Services with "express" profile (Redis, MinIO) won't start
247+
#
248+
# GOOGLE LOGIN SETUP:
249+
# ===================
250+
# 1. Go to: https://console.cloud.google.com/apis/credentials
251+
# 2. Create OAuth 2.0 credentials
252+
# 3. Add authorized redirect URI: https://your-domain.com/api/auth/google/callback
253+
# 4. Set GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_CALLBACK_URL
254+
# 5. Set VITE_ENABLE_GOOGLE_LOGIN=true
255+
#
256+
# ============================================================================

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,9 @@ $RECYCLE.BIN/
7878
# TypeScript
7979
*.tsbuildinfo
8080

81-
81+
# Docker & SSL
82+
nginx/ssl/
83+
backups/
84+
*.bak
85+
*.tmp
86+
nginx/conf.d/*.bak

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@
33
Thanks for your interest in contributing to Worklenz!
44

55
We truly appreciate your willingness to invest your time and effort in helping us improve Worklenz.
6+
7+
## Getting Started
8+
9+
To get started with development:
10+
11+
1. **Quick Setup with Docker (Recommended):**
12+
```bash
13+
git clone https://github.com/Worklenz/worklenz.git
14+
cd worklenz
15+
./quick-setup.sh
16+
```
17+
18+
2. **Manual Development Setup:**
19+
See [SETUP_THE_PROJECT.md](SETUP_THE_PROJECT.md) for detailed instructions on setting up the development environment.
20+
21+
3. **Docker Management:**
22+
Use `./manage.sh` for common operations like viewing logs, creating backups, and managing services.
23+
624
## Code of Conduct
725

826
We have adopted a Code of Conduct to ensure a welcoming and inclusive environment for everyone. Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md) when participating in this project.

0 commit comments

Comments
 (0)