mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Note for deployment: This PR needs to add some env vars
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> Adds S3-compatible storage for profile images with S3Mock for local
development, updating environment variables, Docker configurations, and
tests.
>
> - **Behavior**:
> - Adds S3-compatible storage for user, team, and team member profile
images using `uploadAndGetUrl()` in `s3.tsx`.
> - Integrates S3Mock for local development in `docker.compose.yaml` and
`emulator/docker.compose.yaml`.
> - Updates `crud.tsx` files for `users`, `teams`, and
`team-member-profiles` to use S3 for profile images.
> - **Environment**:
> - Adds S3-related environment variables to `.env.development`.
> - Updates `package.json` to include `@aws-sdk/client-s3`.
> - **Testing**:
> - Modifies test cases in `teams.test.ts` and `users.test.ts` to
validate S3 URL behavior.
> - Updates `auto-migration.tests.ts` for concurrent migration handling.
> - **Documentation**:
> - Updates `self-host.mdx` to include S3 storage requirements.
>
> <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 901f0b56cd. 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**
* Added support for uploading and storing user, team, and team member
profile images using S3-compatible storage.
* Integrated S3Mock for local development and testing of storage
features.
* Added new services to Docker Compose configurations for S3Mock and
related dependencies.
* Introduced image validation and processing for base64-encoded images
before upload.
* **Bug Fixes**
* Profile image upload now returns a storage URL instead of echoing back
the base64 data.
* **Documentation**
* Updated self-hosting documentation to include S3 storage requirements
and usage.
* **Chores**
* Added and updated environment variables for S3 storage configuration.
* Updated backend dependencies to include the AWS S3 SDK.
* Enhanced test cases to validate new image upload and URL behaviors.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
198 lines
4.9 KiB
YAML
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:
|
|
- "8119: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"
|
|
}
|
|
}
|
|
}
|