stack/docker/dependencies/docker.compose.yaml
BilalG1 4899632ea4
Some checks failed
all-good: Did all the other checks pass? / all-good (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Emulator Test / docker (push) Has been cancelled
Docker Server Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Server Test / docker (push) Has been cancelled
Runs E2E API Tests / build (22.x) (push) Has been cancelled
Runs E2E API Tests with external source of truth / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (latest) (push) Has been cancelled
Dev Environment Test / restart-dev-and-test (push) Has been cancelled
Run setup tests / setup-tests (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
Email sending sdk function, freestyle mock, small fixes (#813)
<!--

Make sure you've read the CONTRIBUTING.md guidelines:
https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md

-->

<!-- ELLIPSIS_HIDDEN -->


----

> [!IMPORTANT]
> Enhances email sending API with template support, improved error
handling, and new interfaces, while adding comprehensive tests and
updating rendering logic.
> 
>   - **Behavior**:
> - Adds support for sending emails using templates with variables and
optional theming in `send-email/route.tsx`.
> - Introduces per-user notification category checks before sending
emails.
>     - Adds optional unsubscribe link in email themes.
>   - **Error Handling**:
> - Refines error handling in `send-email/route.tsx` for missing
content, non-existent user IDs, and shared email server configurations.
>     - Uses `KnownErrors` for specific error cases.
>   - **API Changes**:
> - Adds new interfaces and methods for email sending in
`server-interface.ts` and `admin-interface.ts`.
>     - Removes deprecated email sending methods from admin interfaces.
>   - **Testing**:
> - Adds e2e tests in `email.test.ts` for various email sending
scenarios, including HTML content, templates, and error cases.
>   - **Misc**:
> - Updates email rendering logic in `email-rendering.tsx` to handle new
template and theme options.
> - Simplifies import statements and cleans up code structure across
multiple files.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup>
for 1d5a056699. You can
[customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>

----


<!-- ELLIPSIS_HIDDEN -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Enhanced email sending to support both raw HTML and template-based
emails with variables and optional theming.
  * Added per-user notification category checks before sending emails.
  * Email themes now support an optional unsubscribe link in the footer.

* **Improvements**
* Updated email rendering to pass the unsubscribe link as a prop to
themes.
  * Refined error handling for email sending.
  * Improved flexibility of email sending options and result reporting.

* **API Changes**
* Introduced new interfaces and methods for sending emails on the server
side, including detailed result reporting.
  * Removed deprecated admin-side email sending methods and interfaces.
  * Added new types for email sending options and results.

* **Bug Fixes**
* Fixed navigation and property naming inconsistencies in dashboard
email template editing and sending flows.

* **Chores**
  * Simplified import statements and cleaned up internal code structure.
* Updated Docker environment for freestyle mock service to use Bun
runtime and adjusted port mappings.

* **Tests**
* Added comprehensive tests covering email sending scenarios, including
error handling and multi-user support.
* Updated existing tests to reflect refined email subjects, template
rendering, and unsubscribe link features.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
2025-08-01 18:40:28 -07:00

198 lines
4.9 KiB
YAML

services:
# ================= PostgreSQL =================
db:
build: ../postgres-with-extensions
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: PASSWORD-PLACEHOLDER--uqfEC1hmmv
POSTGRES_DB: stackframe
POSTGRES_DELAY_MS: ${POSTGRES_DELAY_MS:-0}
ports:
- 5432:5432
volumes:
- postgres-data:/var/lib/postgresql/data
cap_add:
- NET_ADMIN # required for the fake latency during dev
# ================= PgHero =================
pghero:
image: ankane/pghero:latest
environment:
DATABASE_URL: postgres://postgres:PASSWORD-PLACEHOLDER--uqfEC1hmmv@db:5432/stackframe
ports:
- 8116:8080
# ================= PgAdmin =================
pgadmin:
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: admin@example.com
PGADMIN_DEFAULT_PASSWORD: PASSWORD-PLACEHOLDER--vu9p2iy3f
PGADMIN_CONFIG_SERVER_MODE: "False"
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False"
configs:
- source: pgadmin_servers
target: /pgadmin4/servers.json
ports:
- 8117:80
# ================= Supabase Studio =================
supabase-studio:
image: supabase/studio:20241202-71e5240
restart: unless-stopped
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://studio:3000/api/profile').then((r) => {if (r.status !== 200) throw new Error(r.status)})"
]
timeout: 10s
interval: 5s
retries: 3
environment:
STUDIO_PG_META_URL: http://supabase-meta:8080
POSTGRES_PASSWORD: PASSWORD-PLACEHOLDER--uqfEC1hmmv
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
NEXT_PUBLIC_ENABLE_LOGS: true
NEXT_ANALYTICS_BACKEND_PROVIDER: postgres
ports:
- 8118:3000
supabase-meta:
image: supabase/postgres-meta:v0.84.2
restart: unless-stopped
environment:
PG_META_PORT: 8080
PG_META_DB_HOST: db
PG_META_DB_PORT: 5432
PG_META_DB_NAME: stackframe
PG_META_DB_USER: postgres
PG_META_DB_PASSWORD: PASSWORD-PLACEHOLDER--uqfEC1hmmv
# ================= Inbucket =================
inbucket:
image: inbucket/inbucket:3.1.0
ports:
- 2500:2500
- 8105:9000
- 1100:1100
volumes:
- inbucket-data:/data
# ================= OpenTelemetry & Jaeger =================
jaeger:
image: jaegertracing/all-in-one:latest
environment:
- COLLECTOR_OTLP_ENABLED=true
ports:
- 8107:16686 # Jaeger UI
- 4318:4318 # OTLP Endpoint
restart: always
# ================= svix =================
svix-db:
image: "docker.io/postgres:16.1"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: PASSWORD-PLACEHOLDER--KsoIMcchtp
POSTGRES_DB: svix
volumes:
- svix-postgres-data:/var/lib/postgresql/data
svix-redis:
image: docker.io/redis:7-alpine
command: --save 60 500 --appendonly yes --appendfsync everysec --requirepass PASSWORD-PLACEHOLDER--oVn8GSD6b9
volumes:
- svix-redis-data:/data
svix-server:
image: svix/svix-server
environment:
WAIT_FOR: 'true'
SVIX_REDIS_DSN: redis://:PASSWORD-PLACEHOLDER--oVn8GSD6b9@svix-redis:6379
SVIX_DB_DSN: postgres://postgres:PASSWORD-PLACEHOLDER--KsoIMcchtp@svix-db:5432/svix
SVIX_CACHE_TYPE: memory
SVIX_JWT_SECRET: secret
SVIX_LOG_LEVEL: trace
SVIX_QUEUE_TYPE: redis
ports:
- 8113:8071
depends_on:
- svix-redis
- svix-db
# ================= Adobe S3 Mock =================
s3mock:
image: adobe/s3mock:latest
ports:
- 8121:9090
environment:
- initialBuckets=stack-storage
- root=s3mockroot
- debug=false
volumes:
- s3mock-data:/tmp/s3mock
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:9090/"]
interval: 30s
timeout: 10s
retries: 3
# ================= Freestyle mock =================
freestyle-mock:
build:
context: ./freestyle-mock
dockerfile: Dockerfile
image: freestyle-mock
container_name: freestyle-mock
ports:
- "8122:8080" # POST http://localhost:8119/execute/v1/script
environment:
DENO_DIR: /deno-cache
volumes:
- deno-cache:/deno-cache
# ================= volumes =================
volumes:
postgres-data:
inbucket-data:
svix-redis-data:
svix-postgres-data:
s3mock-data:
deno-cache:
# ================= configs =================
configs:
pgadmin_servers:
content: |
{
"Servers": {
"1": {
"Name": "Local Postgres DB",
"Group": "Servers",
"Host": "db",
"Port": 5432,
"Username": "postgres",
"PasswordExecCommand": "echo 'PASSWORD-PLACEHOLDER--uqfEC1hmmv'",
"MaintenanceDB": "stackframe"
}
}
}