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
222 changes: 0 additions & 222 deletions QUICKSTART-TESTING.md

This file was deleted.

52 changes: 39 additions & 13 deletions QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ docker compose -f docker/docker-compose.yml up -d --build backend

## Access Points

- **Frontend**: http://localhost:3000
- **Backend API**: http://localhost:5000
- **Nginx**: http://localhost:80
- **Main Application (via Nginx)**: http://localhost (or http://YOUR_SERVER_IP)
- **Backend API**: http://localhost/api (or http://YOUR_SERVER_IP/api)
- **Admin Dashboard**: http://localhost/admin (or http://YOUR_SERVER_IP/admin)
- **Database**: localhost:5432

**Note**: All services are accessible through Nginx on port 80. The frontend is built during Docker build and served as static files through Nginx.

## Default Credentials

**Application Users** (seeded automatically):
Expand All @@ -97,20 +99,38 @@ docker compose -f docker/docker-compose.yml up -d --build backend

## First Time Setup

1. Build and start:
1. Clone the repository (if not already cloned):
```bash
docker compose -f docker/docker-compose.yml up -d --build
git clone <repository-url>
cd ProjectHub
```

2. Wait for database seeding (automatic on first startup)
- Creates admin user and test users
- Seeds projects, tasks, comments, messages (100 messages with 50 templates, spanning 6 months)
- Creates document records

3. Access the application at http://localhost:3000
2. Build and start all services:
```bash
docker compose -f docker/docker-compose.yml up -d --build
```

**That's it!** This single command will:
- Build the frontend (production build happens automatically)
- Build the backend container
- Start all services (database, backend, frontend, nginx)
- Automatically seed the database with test data on first startup

3. Wait a few seconds for services to initialize, then access the application:
- **Local**: http://localhost
- **Remote Server**: http://YOUR_SERVER_IP (replace with your server's IP address)

The application is served through Nginx on port 80, which proxies:
- Frontend static files (automatically built)
- Backend API requests to `/api/*`

4. Login with any of the default credentials (see above)

**Optional**: Check logs to verify services are ready:
```bash
docker compose -f docker/docker-compose.yml logs -f
```

## Re-seeding Database

To reset and re-seed the database (⚠️ deletes all data):
Expand Down Expand Up @@ -143,9 +163,15 @@ docker compose -f docker/docker-compose.yml up -d
- Check backend logs: `docker compose -f docker/docker-compose.yml logs backend`
- Verify database is accessible

**Frontend not loading?**
**Frontend not loading (403 Forbidden)?**
- Wait a few seconds for the frontend build to complete (check logs: `docker compose -f docker/docker-compose.yml logs frontend`)
- Verify nginx can access the build files: `docker compose -f docker/docker-compose.yml exec nginx ls -la /usr/share/nginx/html`
- Rebuild if needed: `docker compose -f docker/docker-compose.yml up -d --build`

**Nginx 403 errors?**
- Frontend build may still be in progress. Wait 30-60 seconds and refresh
- Check frontend logs: `docker compose -f docker/docker-compose.yml logs frontend`
- Ensure frontend compiled successfully (look for "Compiled successfully!")
- Check nginx logs: `docker compose -f docker/docker-compose.yml logs nginx`

**Database connection errors?**
- Ensure database container is running
Expand Down
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ docker compose -f docker/docker-compose.yml build --no-cache
docker compose -f docker/docker-compose.yml up -d
```

**Build and start in one command:**
**Build and start in one command (recommended):**
```bash
docker compose -f docker/docker-compose.yml up -d --build
```

**Note**: The frontend is automatically built during the Docker build process. The production build is created in `frontend/build/` and served by Nginx on port 80.

#### Shutdown

**Stop all services (keeps containers):**
Expand Down Expand Up @@ -148,15 +150,20 @@ cd ProjectHub
docker compose -f docker/docker-compose.yml up -d --build
```

3. Wait for services to initialize (database seeding happens automatically on first startup)
**That's it!** The command will:
- Build the frontend (production build)
- Build the backend container
- Start all services (database, backend, frontend, nginx)
- Automatically seed the database with test data

3. Wait a few seconds for services to initialize, then access the application:
- **Main Application (via Nginx)**: http://localhost (or http://YOUR_SERVER_IP)
- **Backend API**: http://localhost/api (or http://YOUR_SERVER_IP/api)
- **Admin Dashboard**: http://localhost/admin (or http://YOUR_SERVER_IP/admin)
- **API Health Check**: http://localhost/api/health (or http://YOUR_SERVER_IP/api/health)
- **Database**: localhost:5432

4. Access the application:
- **Frontend**: http://localhost:3000
- **Backend API**: http://localhost:5000
- **Admin Dashboard**: http://localhost:5000/admin
- **API Health Check**: http://localhost:5000/api/health
- **Nginx (Production)**: http://localhost:80
- **Database**: localhost:5432
**Note**: The frontend is automatically built and served through Nginx on port 80. No additional build steps required.

### Database Seeding

Expand Down
10 changes: 7 additions & 3 deletions backend/routes/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_stats():
timestamp = get_utc_timestamp()

ctx = get_request_context()
req_id = request_id if request_id else 'N/A'
req_id = ctx.request_id if ctx and hasattr(ctx, 'request_id') else 'N/A'

stats = {
'user_count': query_helper.count_users(),
Expand Down Expand Up @@ -54,13 +54,15 @@ def search():

query_helper = QueryHelper()
search_time = get_utc_now()
ctx = get_request_context()
req_id = ctx.request_id if ctx and hasattr(ctx, 'request_id') else 'N/A'

results = {
'query': search_term,
'users': [u.to_dict() for u in query_helper.search_users(search_term)],
'projects': [p.to_dict() for p in query_helper.search_projects(search_term)],
'search_time': search_time.isoformat(),
'request_id': request_id if request_id else 'N/A'
'request_id': req_id
}

log_user_action(user.id, 'analytics_search', {'term': search_term})
Expand All @@ -78,10 +80,12 @@ def get_user(user_id):
return jsonify({'error': 'User not found'}), 404

fetched_at = get_utc_now()
ctx = get_request_context()
req_id = ctx.request_id if ctx and hasattr(ctx, 'request_id') else 'N/A'

return jsonify({
'user': user.to_dict(),
'fetched_at': fetched_at.isoformat(),
'request_id': request_id if request_id else 'N/A'
'request_id': req_id
})

2 changes: 1 addition & 1 deletion backend/routes/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get_users():
"""Get all users"""
# Access request context
ctx = get_request_context()
req_id = request_id if request_id else 'N/A'
req_id = ctx.request_id if ctx and hasattr(ctx, 'request_id') else 'N/A'
ip_address = get_request_metadata('ip_address', 'unknown')

search = request.args.get('search', '')
Expand Down
Loading