Refactor Supabase services in docker-compose.yml for better organization and testing

- Commented out all Supabase services to facilitate testing with Supabase CLI.
- Updated README to include Supabase directory in project structure.
- Adjusted documentation for migration paths in Supabase Docker Compose guide.
- Enhanced docker-compose-reset.sh to explicitly remove Supabase volumes and wait for migrations to complete.
This commit is contained in:
salirezav
2025-12-18 18:27:04 -05:00
parent 93c68768d8
commit 8cb45cbe03
28 changed files with 7264 additions and 253 deletions

View File

@@ -0,0 +1,104 @@
# Docker Compose Service Organization
## Service Namespaces
Services in the docker-compose.yml are organized using labels to create logical namespaces. This allows for better organization and easier management of related services.
## Supabase Namespace
All Supabase services are grouped under the `com.usda-vision.service=supabase` label namespace:
### Services in Supabase Namespace
- **supabase-db** - PostgreSQL database (group: `database`)
- **supabase-rest** - PostgREST API (group: `api`)
- **supabase-auth** - GoTrue authentication (group: `auth`)
- **supabase-realtime** - Realtime subscriptions (group: `realtime`)
- **supabase-storage** - Storage API (group: `storage`)
- **supabase-studio** - Supabase Studio UI (group: `studio`)
- **supabase-meta** - Database metadata service (group: `meta`)
- **supabase-migrate** - Migration runner (group: `migration`)
- **supabase-inbucket** - Email testing server (group: `email`)
### Managing Supabase Services
#### List all Supabase services:
```bash
docker compose ps --filter "label=com.usda-vision.service=supabase"
```
#### View logs for all Supabase services:
```bash
docker compose logs supabase-*
```
#### Stop all Supabase services:
```bash
docker compose stop supabase-*
```
#### Start all Supabase services:
```bash
docker compose start supabase-*
```
#### Restart all Supabase services:
```bash
docker compose restart supabase-*
```
#### View logs for a specific Supabase service group:
```bash
# Database services
docker compose logs supabase-db supabase-migrate
# API services
docker compose logs supabase-rest supabase-auth
# UI services
docker compose logs supabase-studio supabase-meta
```
### Label Structure
Each Supabase service has two labels:
- `com.usda-vision.service=supabase` - Identifies it as part of the Supabase namespace
- `com.usda-vision.service.group=<group>` - Identifies the service's functional group
### Benefits
1. **Better Organization**: All Supabase services are visually grouped in the compose file
2. **Easy Filtering**: Use labels to filter and manage related services
3. **Clear Ownership**: Makes it obvious which services belong together
4. **No Behavior Change**: Services still start by default with `docker compose up`
5. **Flexible Management**: Can manage Supabase services separately when needed
## Future Namespaces
You can extend this pattern to other service groups:
```yaml
services:
api:
labels:
- "com.usda-vision.service=application"
- "com.usda-vision.service.group=api"
web:
labels:
- "com.usda-vision.service=application"
- "com.usda-vision.service.group=frontend"
```
## Visual Organization in docker-compose.yml
The Supabase services are also visually organized with a comment section:
```yaml
# ============================================================================
# Supabase Services (Database & Backend)
# ============================================================================
```
This makes it easy to find and understand the Supabase services section when viewing the file.