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
18 changes: 8 additions & 10 deletions DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Development environment configuration with:
- PostgreSQL 18 database
- Redis 8 for caching and sessions (with separate test database)
- Rails web application with automatic database preparation
- JavaScript and CSS build watchers (using profiles)
- JavaScript and CSS build watchers
- Test service for isolated test runs
- Health checks for all services
- Volume mounts for development
Expand Down Expand Up @@ -102,11 +102,10 @@ defaults (`.env.production` and `streamsource:latest`).
- **Dependencies**: Waits for DB and Redis health
- **Automatic database setup**: Runs migrations on startup

### JavaScript/CSS Watchers (Optional)
### JavaScript/CSS Watchers
- **js service**: Watches and rebuilds JavaScript
- **css service**: Watches and rebuilds CSS
- **Profile**: `assets` (manual start)
- **Usage**: `docker compose --profile assets up js css`
- **Default**: Included in `docker compose up -d`

## Test Environment

Expand Down Expand Up @@ -175,9 +174,9 @@ docker compose exec web yarn build
# Build CSS
docker compose exec web yarn build:css

# Watch mode (using separate services)
docker compose --profile assets up js
docker compose --profile assets up css
# Watch mode (separate services)
docker compose up -d js
docker compose up -d css

# Install new JavaScript packages
docker compose exec web yarn add <package-name>
Expand Down Expand Up @@ -382,9 +381,8 @@ The Dockerfile uses a multi-stage build:

### Service Profiles

Docker Compose uses profiles to manage optional services:
- Default profile: web, db, redis
- `donotstart` profile: js, css (build watchers)
Docker Compose uses profiles for the test runner only:
- Default services: web, db, redis, js, css
- Test profile: Separate test runner

### Database Initialization
Expand Down
8 changes: 4 additions & 4 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ make assets-dev # Compile assets for development
# Diagnose common problems
make doctor

# Clean up and rebuild
make clean
# Rebuild (keeps build cache)
make rebuild

# Deep clean (removes everything)
make clean-all
# Deep clean (removes containers, volumes, local images, build cache)
make clean
make rebuild
```

### Database Problems
Expand Down
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# StreamSource
# Usage: make [command]

.PHONY: help up down stop restart shell test migrate seed setup reset logs lint lint-fix lint-ruby lint-js security quality pre-commit pre-commit-install rebuild browse rake yarn
.PHONY: help up down stop restart shell test migrate seed setup reset logs lint lint-fix lint-ruby lint-js security quality pre-commit pre-commit-install rebuild clean browse rake yarn

STREAMSOURCE_ENV ?= dev
APP_URL ?= http://localhost:3001/admin

ifeq ($(STREAMSOURCE_ENV),prod)
COMPOSE_FILES := -f docker-compose.yml -f docker-compose.prod.yml
UP_TARGETS := web
UP_PROFILE :=
else
COMPOSE_FILES :=
UP_TARGETS := web js css
UP_PROFILE := --profile assets
endif

COMPOSE := docker compose $(COMPOSE_FILES)
COMPOSE_UP := $(COMPOSE) $(UP_PROFILE)
COMPOSE_UP := $(COMPOSE)
COMPOSE_EXEC_FLAGS ?=
COMPOSE_EXEC := $(COMPOSE) exec $(COMPOSE_EXEC_FLAGS)

Expand Down Expand Up @@ -47,6 +45,7 @@ help:
@echo " pre-commit-install - Install pre-commit hooks (commit + pre-push)"
@echo " yarn - Build JS/CSS assets"
@echo " rebuild - Clean and rebuild containers"
@echo " clean - Remove containers, volumes, images, and build cache"
@echo " migrate - Run migrations"
@echo " seed - Seed the database"
@echo " setup - Create, migrate, and seed the database"
Expand Down Expand Up @@ -137,9 +136,13 @@ yarn:

rebuild:
$(COMPOSE) down --remove-orphans
$(COMPOSE) build --no-cache
$(COMPOSE) build
$(COMPOSE_UP) up -d $(UP_TARGETS)

clean:
$(COMPOSE) down --remove-orphans --volumes --rmi local
docker builder prune -f

migrate:
$(COMPOSE_EXEC) web bin/rails db:migrate

Expand Down
6 changes: 3 additions & 3 deletions QUICK_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ docker compose exec web yarn build
docker compose exec web yarn build:css

# Watch assets (separate services)
docker compose --profile donotstart up js
docker compose --profile donotstart up css
docker compose up -d js
docker compose up -d css

# Stop all services
docker compose down
Expand Down Expand Up @@ -400,4 +400,4 @@ docker compose exec web bin/rails initializers

# View stats
docker compose exec web bin/rails stats
```
```
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ services:

js:
build: .
command: yarn build --watch
command: yarn build --watch=forever
volumes:
- .:/rails:cached
working_dir: /rails
profiles:
- assets
stdin_open: true
tty: true

css:
build: .
command: yarn build:css --watch
volumes:
- .:/rails:cached
working_dir: /rails
profiles:
- assets
stdin_open: true
tty: true

test:
build:
Expand Down