Skip to content

Devenv #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions .changeset/huge-coats-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@khulnasoft/blob': patch
---

copy, head and del can receive a blob url or pathname, until now it was not very clear.
7 changes: 7 additions & 0 deletions .docker/docker-compose-infra-oriole-override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
tenant_db:
image: orioledb/orioledb:latest-pg17
environment:
POSTGRES_INITDB_ARGS: '--locale=C'
volumes:
- ./.docker/init-oriole-db:/docker-entrypoint-initdb.d
176 changes: 176 additions & 0 deletions .docker/docker-compose-infra.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# docker-compose.yml

services:
tenant_db:
image: postgres:15
shm_size: '1gb'
ports:
- '5432:5432'
healthcheck:
test: ['CMD-SHELL', 'pg_isready', '-d', 'postgres']
interval: 5s
timeout: 60s
retries: 20
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_PORT: 5432

multitenant_db:
image: postgres:15
ports:
- '5433:5432'
configs:
- source: init.sql
target: /docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ['CMD-SHELL', 'pg_isready', '-d', 'postgres']
interval: 5s
timeout: 60s
retries: 20
environment:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres

pg_bouncer:
image: bitnami/pgbouncer:latest
ports:
- 6453:6432
environment:
POSTGRESQL_USERNAME: postgres
POSTGRESQL_HOST: tenant_db
POSTGRESQL_PASSWORD: postgres
PGBOUNCER_POOL_MODE: transaction
PGBOUNCER_IGNORE_STARTUP_PARAMETERS: 'extra_float_digits, options'
PGBOUNCER_STATS_USERS: postgres

supavisor:
image: khulnasoft/supavisor:1.1.23
depends_on:
multitenant_db:
condition: service_healthy
tenant_db:
condition: service_healthy
ports:
- 4000:4000
- 5452:5452
- 6543:6543
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:4000/api/health']
interval: 2s
timeout: 10s
retries: 5
environment:
PORT: 4000
PROXY_PORT_SESSION: 5452
PROXY_PORT_TRANSACTION: 6543
DATABASE_URL: 'ecto://postgres:postgres@multitenant_db:5432/postgres'
CLUSTER_POSTGRES: 'true'
SECRET_KEY_BASE: '12345678901234567890121234567890123456789012345678903212345678901234567890123456789032123456789012345678901234567890323456789032'
VAULT_ENC_KEY: '12345678901234567890123456789032'
API_JWT_SECRET: 'dev'
METRICS_JWT_SECRET: 'dev'
REGION: 'local'
ERL_AFLAGS: -proto_dist inet_tcp
command: sh -c "/app/bin/migrate && /app/bin/server"

supavisor_setup:
image: khulnasoft/supavisor:1.1.23
command: |
curl -X PUT \
"http://supavisor:4000/api/tenants/bjhaohmqunupljrqypxz" \
--header "Accept: application/json" \
--header "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJvbGUiOiJhbm9uIiwiaWF0IjoxNjQ1MTkyODI0LCJleHAiOjE5NjA3Njg4MjR9.M9jrxyvPLkUxWgOYSf5dNdJ8v_eRrq810ShFRT8N-6M" \
--header "Content-Type: application/json" \
--data-raw "{
\"tenant\": {
\"db_host\": \"tenant_db\",
\"db_port\": 5432,
\"db_database\": \"postgres\",
\"ip_version\": \"auto\",
\"require_user\": true,
\"upstream_ssl\": false,
\"enforce_ssl\": false,
\"default_max_clients\": 200,
\"default_pool_size\": 15,
\"users\": [
{
\"db_user\": \"postgres\",
\"db_password\": \"postgres\",
\"mode_type\": \"transaction\",
\"pool_size\": 15,
\"max_clients\": 200,
\"pool_checkout_timeout\": 5000
}
]
}
}"
depends_on:
supavisor:
condition: service_healthy

minio:
image: minio/minio
ports:
- '9000:9000'
- '9001:9001'
healthcheck:
test: timeout 5s bash -c ':> /dev/tcp/127.0.0.1/9000' || exit 1
interval: 5s
timeout: 20s
retries: 10
environment:
MINIO_ROOT_USER: supa-storage
MINIO_ROOT_PASSWORD: secret1234
command: server --console-address ":9001" /data

minio_setup:
image: minio/mc
depends_on:
minio:
condition: service_healthy
entrypoint: >
/bin/sh -c "
/usr/bin/mc alias set supa-minio http://minio:9000 supa-storage secret1234;
/usr/bin/mc mb supa-minio/supa-storage-bucket;
exit 0;
"

imgproxy:
image: darthsim/imgproxy
ports:
- '50020:8080'
volumes:
- ./data:/images/data
environment:
- IMGPROXY_WRITE_TIMEOUT=20
- IMGPROXY_READ_TIMEOUT=20
- IMGPROXY_REQUESTS_QUEUE_SIZE=24
- IMGPROXY_LOCAL_FILESYSTEM_ROOT=/images
- IMGPROXY_USE_ETAG=true
- IMGPROXY_ENABLE_WEBP_DETECTION=true

# Optional for rate-limiting
# redis:
# image: redis:6.2-alpine
# restart: always
# ports:
# - '6379:6379'

# Optional for tracing
# otel:
# extends:
# service: otel-collector
# file: ./.docker/docker-compose-monitoring.yml
#
# jaeger:
# extends:
# service: jaeger
# file: ./.docker/docker-compose-monitoring.yml

configs:
init.sql:
content: |
CREATE SCHEMA IF NOT EXISTS _supavisor;
68 changes: 68 additions & 0 deletions .docker/docker-compose-monitoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
services:
pg_bouncer_exporter:
image: spreaker/prometheus-pgbouncer-exporter
environment:
PGBOUNCER_EXPORTER_HOST: 0.0.0.0
PGBOUNCER_EXPORTER_PORT: 9127
PGBOUNCER_HOST: pg_bouncer
PGBOUNCER_PORT: 6432
PGBOUNCER_USER: postgres
PGBOUNCER_PASS: postgres
depends_on:
- pg_bouncer
ports:
- 9127:9127

postgres_exporter:
image: quay.io/prometheuscommunity/postgres-exporter
ports:
- '9187:9187'
environment:
DATA_SOURCE_NAME: postgres://postgres:postgres@tenant_db:5432/postgres?sslmode=disable

prometheus:
image: prom/prometheus
container_name: prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
ports:
- 9090:9090
restart: unless-stopped
volumes:
- ../monitoring/prometheus:/etc/prometheus

grafana:
image: grafana/grafana
container_name: grafana
ports:
- 3000:3000
restart: unless-stopped
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=grafana
volumes:
- ../monitoring/grafana/config:/etc/grafana/provisioning
- ../monitoring/grafana/dashboards:/var/lib/grafana/dashboards

jaeger:
image: jaegertracing/all-in-one:1.57.0
ports:
- '16686:16686' # Jaeger UI
- '14250:14250' # GRPC
- '14268:14268' # HTTP
- '14269:14269' # HTTP
- '6831:6831/udp' # UDP
- '6832:6832/udp' # UDP
- '5778:5778' # HTTP

otel-collector:
image: otel/opentelemetry-collector-contrib:0.100.0
ports:
- '4317:4317' # OTLP gRPC receiver
- '4318:4318' # OTLP Http receiver
- '55680:55680' # OTLP HTTP receiver
command: ['--config=/etc/otel/otel-collector-config.yml']
depends_on:
- jaeger
volumes:
- ../monitoring/otel/config:/etc/otel
4 changes: 4 additions & 0 deletions .docker/init-oriole-db/init-oriole.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- Enable oriole extension and set it as the default for table creation
-- Without running this script oriole db defaults to creating heap tables
CREATE EXTENSION IF NOT EXISTS orioledb;
ALTER DATABASE postgres SET default_table_access_method = 'orioledb';
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
.env
.env.example
Loading
Loading