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
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ coverage: ## Run tests with coverage report

demo-migrate: ## Run migrations for the demo project
$(DC) up -d $(DB_SERVICE) $(API_SERVICE)
$(DC) exec -T $(DB_SERVICE) sh -lc 'until pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" >/dev/null 2>&1; do echo "Waiting for Postgres..."; sleep 1; done'
$(DC) exec $(API_SERVICE) python demo/manage.py migrate

demo-run: ## Run demo stack in detached docker mode
$(DC) up -d --build $(DB_SERVICE) $(API_SERVICE)
$(DC) exec -T $(DB_SERVICE) sh -lc 'until pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" >/dev/null 2>&1; do echo "Waiting for Postgres..."; sleep 1; done'
$(DC) exec $(API_SERVICE) python demo/manage.py migrate
$(DC) exec $(API_SERVICE) python demo/manage.py seed_demo_data --reset

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ make demo-run

Then:

- API root: `http://127.0.0.1:8010/api/`
- Catalog products API: `http://127.0.0.1:8010/api/catalog/products/`
- Checkout carts API: `http://127.0.0.1:8010/api/checkout/carts/`
- Promotions API: `http://127.0.0.1:8010/api/promotions/promotions/`
- Create admin: `make superuser`
- Admin dashboard: `http://127.0.0.1:8010/admin/`

Expand Down
9 changes: 8 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ services:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-productory}
ports:
- "${POSTGRES_PORT:-5432}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB} -h 127.0.0.1 -p 5432"]
interval: 5s
timeout: 3s
retries: 20
start_period: 5s
volumes:
- ${POSTGRES_DATA_PATH:-./.data/postgres}:/var/lib/postgresql/data

Expand All @@ -17,7 +23,8 @@ services:
container_name: productory-demo
restart: unless-stopped
depends_on:
- productory-db
productory-db:
condition: service_healthy
environment:
DEMO_DB_ENGINE: ${DEMO_DB_ENGINE:-django.db.backends.postgresql}
DEMO_DB_NAME: ${DEMO_DB_NAME:-productory}
Expand Down
Loading