Container refactoring

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
James Pattinson
2026-04-26 09:43:02 +00:00
parent 0c0b5fbefe
commit 74a4e3ede8
9 changed files with 259 additions and 109 deletions
+28 -32
View File
@@ -4,23 +4,28 @@
```bash
# Start all services
docker-compose up -d
docker compose up -d
# Watch the logs until services are ready
docker-compose logs -f
docker compose logs -f
```
Wait until you see "Application startup complete", then press Ctrl+C.
**Access the API**:
- API: http://localhost:8000
- Docs: http://localhost:8000/docs
- API: http://localhost:8050/api/v1
- Docs: http://localhost:8050/docs
Set `APP_PORT` in `.env` / `.env.example` to change `8050`.
For Square payment form testing, use HTTPS at `https://localhost:8443`.
Set `APP_TLS_PORT` in `.env` / `.env.example` to change `8443`.
TLS certs are auto-generated by the gateway container on first start.
## Testing the API
### 1. Register a new user
```bash
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": "test@example.com",
@@ -32,7 +37,7 @@ curl -X POST "http://localhost:8000/api/v1/auth/register" \
### 2. Login
```bash
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": "test@example.com",
@@ -44,45 +49,41 @@ Save the `access_token` from the response.
### 3. Get your profile
```bash
curl -X GET "http://localhost:8000/api/v1/users/me" \
curl -X GET "http://localhost:8050/api/v1/users/me" \
-H "Authorization: Bearer YOUR_TOKEN_HERE"
```
### 4. List membership tiers
```bash
curl -X GET "http://localhost:8000/api/v1/tiers/"
curl -X GET "http://localhost:8050/api/v1/tiers/"
```
## Docker Compose Commands
```bash
# Start services
docker-compose up -d
docker compose up -d
# Stop services
docker-compose down
docker compose down
# 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
# Restart services
docker-compose restart
docker compose restart
# Rebuild after code changes
docker-compose up -d --build
docker compose up -d --build
# Check status
docker-compose ps
docker compose ps
# Access MySQL CLI (using environment variables)
docker exec -it membership_mysql mysql -u "${DATABASE_USER}" -p"${DATABASE_PASSWORD}" "${DATABASE_NAME}"
# Create database backup
docker exec membership_mysql mysqldump -u "${DATABASE_USER}" -p"${DATABASE_PASSWORD}" "${DATABASE_NAME}" > backup_$(date +%Y%m%d_%H%M%S).sql
# Tail gateway logs
docker compose logs -f gateway
```
## Default Admin Access
@@ -111,33 +112,28 @@ docker exec membership_mysql mysqldump -u "${DATABASE_USER}" -p"${DATABASE_PASSW
### Check service status
```bash
docker-compose ps
docker compose ps
```
### View all logs
```bash
docker-compose logs -f
docker compose logs -f
```
### View backend logs only
```bash
docker-compose logs -f backend
```
### View MySQL logs only
```bash
docker-compose logs -f mysql
docker compose logs -f backend
```
### Restart everything
```bash
docker-compose restart
docker compose restart
```
### Clean start (removes all data)
```bash
docker-compose down -v
docker-compose up -d
docker compose down -v
docker compose up -d
```
## Next Steps