@@ -73,41 +73,42 @@ membership/
|
||||
- SMTP2GO API key (for email notifications)
|
||||
- Database password (if desired)
|
||||
|
||||
3. **Start the services in your preferred mode**:
|
||||
3. **Start the services**:
|
||||
```bash
|
||||
# For development (with hot reloading)
|
||||
docker-compose --profile dev up -d
|
||||
|
||||
# For production (optimized static files)
|
||||
docker-compose --profile prod up -d
|
||||
# Development mode (gateway + Vite hot reload)
|
||||
docker compose up -d
|
||||
|
||||
# Production static frontend mode
|
||||
docker compose --profile prod up -d frontend-prod backend
|
||||
```
|
||||
|
||||
4. **Wait for services to be ready** (about 30 seconds for MySQL initialization):
|
||||
```bash
|
||||
docker-compose logs -f
|
||||
docker compose logs -f
|
||||
```
|
||||
Press Ctrl+C when you see "Application startup complete"
|
||||
|
||||
5. **Access the application**:
|
||||
- Frontend: http://localhost:3500 (development) or http://localhost:8080 (production)
|
||||
- API: http://localhost:8000
|
||||
- API Documentation: http://localhost:8000/docs
|
||||
- Frontend (HTTP): http://localhost:8050
|
||||
- Frontend (HTTPS for Square): https://localhost:8443
|
||||
- API: http://localhost:8050/api/v1
|
||||
- API Documentation: http://localhost:8050/docs
|
||||
- TLS certs are generated automatically by the gateway container on first start
|
||||
|
||||
## Frontend Development vs Production
|
||||
|
||||
Choose your deployment mode by using the appropriate docker-compose file:
|
||||
|
||||
### Development Mode (Vite)
|
||||
```bash
|
||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d
|
||||
docker compose up -d
|
||||
```
|
||||
- Frontend served by Vite dev server on port 3500
|
||||
- Single entry point on port 8050
|
||||
- Nginx gateway routes `/api/*` to backend and all other traffic to Vite
|
||||
- Hot reloading and development features
|
||||
- Access at: http://localhost:3500
|
||||
- Access at: http://localhost:8050
|
||||
|
||||
### Production Mode (Nginx)
|
||||
```bash
|
||||
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
|
||||
docker compose --profile prod up -d frontend-prod backend
|
||||
```
|
||||
- Frontend served by Nginx on port 8050
|
||||
- Optimized static files, production-ready
|
||||
@@ -120,15 +121,30 @@ Set your preferred defaults in `.env`:
|
||||
# Deployment mode (for reference only)
|
||||
MODE=dev
|
||||
|
||||
# Single host entrypoint port
|
||||
APP_PORT=8050
|
||||
|
||||
# HTTPS entrypoint port for self-signed TLS in dev
|
||||
APP_TLS_PORT=8443
|
||||
DEV_CERT_CN=localhost
|
||||
DEV_CERT_SANS=DNS:localhost,IP:127.0.0.1,IP:::1
|
||||
|
||||
# Frontend allowed hosts (comma-separated)
|
||||
VITE_ALLOWED_HOSTS=sasaprod,localhost,members.sasalliance.org
|
||||
```
|
||||
|
||||
If you access via a LAN hostname or IP, add it to `VITE_ALLOWED_HOSTS`.
|
||||
If you change `APP_PORT`, use that port instead of `8050` in URLs.
|
||||
If you change `APP_TLS_PORT`, use that port for HTTPS URLs.
|
||||
If you change hostnames, update `DEV_CERT_CN` and `DEV_CERT_SANS` accordingly.
|
||||
|
||||
### Stopping Services
|
||||
```bash
|
||||
# Stop all services
|
||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml down
|
||||
docker compose -f docker-compose.yml -f docker-compose.prod.yml down
|
||||
docker compose down
|
||||
|
||||
# Stop production profile services
|
||||
docker compose --profile prod down
|
||||
```
|
||||
|
||||
## Default Credentials
|
||||
@@ -182,29 +198,29 @@ docker compose -f docker-compose.yml -f docker-compose.prod.yml down
|
||||
|
||||
```bash
|
||||
# Start all services
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
|
||||
# View logs (all services)
|
||||
docker-compose logs -f
|
||||
docker compose logs -f
|
||||
|
||||
# View logs (specific service)
|
||||
docker-compose logs -f backend
|
||||
docker-compose logs -f mysql
|
||||
docker compose logs -f backend
|
||||
docker compose logs -f gateway
|
||||
|
||||
# Stop services
|
||||
docker-compose down
|
||||
docker compose down
|
||||
|
||||
# Stop and remove volumes (clean slate)
|
||||
docker-compose down -v
|
||||
docker compose down -v
|
||||
|
||||
# Restart services
|
||||
docker-compose restart
|
||||
docker compose restart
|
||||
|
||||
# Rebuild after code changes
|
||||
docker-compose up -d --build
|
||||
docker compose up -d --build
|
||||
|
||||
# Check service status
|
||||
docker-compose ps
|
||||
docker compose ps
|
||||
```
|
||||
|
||||
### Database Operations
|
||||
@@ -242,7 +258,7 @@ sudo docker compose exec backend alembic history
|
||||
|
||||
## API Testing
|
||||
|
||||
You can use the interactive API documentation at http://localhost:8000/docs to test endpoints:
|
||||
You can use the interactive API documentation at http://localhost:8050/docs to test endpoints:
|
||||
|
||||
1. Register a new user
|
||||
2. Login to get access token
|
||||
@@ -253,7 +269,7 @@ Or use curl:
|
||||
|
||||
```bash
|
||||
# Register
|
||||
curl -X POST "http://localhost:8000/api/v1/auth/register" \
|
||||
curl -X POST "http://localhost:8050/api/v1/auth/register" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"email": "user@example.com",
|
||||
@@ -263,7 +279,7 @@ curl -X POST "http://localhost:8000/api/v1/auth/register" \
|
||||
}'
|
||||
|
||||
# Login
|
||||
curl -X POST "http://localhost:8000/api/v1/auth/login-json" \
|
||||
curl -X POST "http://localhost:8050/api/v1/auth/login-json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"email": "user@example.com",
|
||||
@@ -271,7 +287,7 @@ curl -X POST "http://localhost:8000/api/v1/auth/login-json" \
|
||||
}'
|
||||
|
||||
# Get profile (replace TOKEN with actual token)
|
||||
curl -X GET "http://localhost:8000/api/v1/users/me" \
|
||||
curl -X GET "http://localhost:8050/api/v1/users/me" \
|
||||
-H "Authorization: Bearer TOKEN"
|
||||
```
|
||||
|
||||
@@ -308,45 +324,42 @@ The system comes with three pre-configured tiers:
|
||||
### Services not starting
|
||||
```bash
|
||||
# Check status of all services
|
||||
docker-compose ps
|
||||
docker compose ps
|
||||
|
||||
# View all logs
|
||||
docker-compose logs
|
||||
docker compose logs
|
||||
|
||||
# View specific service logs
|
||||
docker-compose logs mysql
|
||||
docker-compose logs backend
|
||||
docker compose logs gateway
|
||||
docker compose logs backend
|
||||
|
||||
# Restart all services
|
||||
docker-compose restart
|
||||
docker compose restart
|
||||
|
||||
# Full restart with rebuild
|
||||
docker-compose down
|
||||
docker-compose up -d --build
|
||||
docker compose down
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
### Database connection issues
|
||||
```bash
|
||||
# Check if MySQL is healthy
|
||||
docker-compose ps
|
||||
# Check backend connectivity and status
|
||||
docker compose ps
|
||||
|
||||
# View MySQL logs for errors
|
||||
docker-compose logs mysql
|
||||
|
||||
# Wait for MySQL to be fully ready (may take 30 seconds on first start)
|
||||
docker-compose logs -f mysql
|
||||
# View backend logs for DB errors
|
||||
docker compose logs backend
|
||||
```
|
||||
|
||||
### Clean slate restart
|
||||
```bash
|
||||
# Stop everything and remove volumes
|
||||
docker-compose down -v
|
||||
docker compose down -v
|
||||
|
||||
# Start fresh
|
||||
docker-compose up -d
|
||||
docker compose up -d
|
||||
|
||||
# Wait for initialization
|
||||
docker-compose logs -f
|
||||
docker compose logs -f
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
Reference in New Issue
Block a user