chore: 🔧 add Cosmo Compose files

feat/implement-pets-and-users-subgraphs
RaviAnand Mohabir 1 year ago
parent 919f2cb6d1
commit 97c0152a7d

1
.gitignore vendored

@ -0,0 +1 @@
.env

38
.vscode/tasks.json vendored

@ -0,0 +1,38 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Publish schema",
"type": "shell",
"command": "npx wgc subgraph publish ${input:subgraph} --schema=${input:subgraph}/graph/schema.graphqls",
"problemMatcher": [],
"options": {
"env": {
"COSMO_API_URL": "http://localhost:3001",
"COSMO_API_KEY": "cosmo_6a71cff4085e8353d85e876114e6010b"
}
}
},
{
"label": "Check schema",
"type": "shell",
"command": "npx wgc subgraph check ${input:subgraph} --schema=${input:subgraph}/graph/schema.graphqls",
"problemMatcher": [],
"options": {
"env": {
"COSMO_API_URL": "http://localhost:3001",
"COSMO_API_KEY": "cosmo_6a71cff4085e8353d85e876114e6010b"
}
}
}
],
"inputs": [
{
"id": "subgraph",
"description": "The name of the subgraph",
"type": "promptString"
}
]
}

@ -0,0 +1,175 @@
version: "3"
services:
# Infrastructure services
clickhouse:
image: clickhouse/clickhouse-server:${DC_CLICKHOUSE_VERSION:-23}
environment:
CLICKHOUSE_DB: ${CLICKHOUSE_DATABASE:-cosmo}
CLICKHOUSE_USER: ${CLICKHOUSE_USER:-default}
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-changeme}
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: ${CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT:-1}
ports:
- "8123:8123"
- "9000:9000"
- "9440:9440"
volumes:
- clickhouse:/var/lib/clickhouse
- ./docker/clickhouse/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh
postgres:
image: postgres:${DC_POSTGRESQL_VERSION:-15.3}
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
POSTGRES_DB: ${POSTGRES_DB:-controlplane}
PGDATA: /data/postgres
volumes:
- ./docker/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
- postgres:/data/postgres
# ports:
# - "5432:5432"
restart: unless-stopped
keycloak:
image: ghcr.io/wundergraph/cosmo/keycloak:${DC_KEYCLOAK_VERSION:-latest}
platform: linux/amd64
environment:
KEYCLOAK_ADMIN: ${KEYCLOAK_ADMIN:-admin}
KEYCLOAK_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD:-changeme}
KC_DB: postgres
KC_DB_URL_HOST: postgres
KC_DB_URL_DATABASE: ${POSTGRES_DB:-keycloak}
KC_DB_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
KC_DB_USERNAME: ${POSTGRES_USER:-postgres}
KC_DB_SCHEMA: public
command:
- "start-dev"
- "--import-realm"
ports:
- "8080:8080"
volumes:
- ./docker/keycloak/realm.json:/opt/keycloak/data/import/realm.json:ro
restart: unless-stopped
depends_on:
- postgres
# Cosmo Platform
otelcollector:
# On the public repo
image: ghcr.io/wundergraph/cosmo/otelcollector:${DC_OTELCOLLECTOR_VERSION:-latest}
platform: linux/amd64
environment:
CLICKHOUSE_ENDPOINT: "clickhouse://${CLICKHOUSE_USER:-default}:${CLICKHOUSE_PASSWORD:-changeme}@clickhouse:9000/${CLICKHOUSE_DATABASE:-cosmo}?dial_timeout=15s&compress=lz4"
OTEL_INGEST_JWT_SECRET: ${OTEL_INGEST_JWT_SECRET:-fkczyomvdprgvtmvkuhvprxuggkbgwld}
PROMETHEUS_REMOTE_ENDPOINT: "http://prometheus:9090/api/v1/write"
PROMETHEUS_USERNAME: ${PROMETHEUS_USERNAME:-admin}
PROMETHEUS_PASSWORD: ${PROMETHEUS_PASSWORD:-test}
ports:
- "4318:4318"
restart: unless-stopped
depends_on:
- clickhouse
controlplane:
image: ghcr.io/wundergraph/cosmo/controlplane:${DC_CONTROLPLANE_VERSION:-latest}
platform: linux/amd64
environment:
DB_URL: "postgresql://postgres:changeme@postgres:5432/controlplane"
PORT: 3001
HOST: "0.0.0.0"
ALLOWED_ORIGINS: "http://localhost:3000"
LOG_LEVEL: "info"
DEBUG_SQL: "true"
CLICKHOUSE_DSN: "http://default:changeme@clickhouse:8123?database=cosmo"
AUTH_REDIRECT_URI: "http://localhost:3001/v1/auth/callback"
WEB_BASE_URL: "http://localhost:3000"
AUTH_JWT_SECRET: "fkczyomvdprgvtmvkuhvprxuggkbgwld"
KC_CLIENT_ID: "studio"
KC_REALM: "cosmo"
KC_ADMIN_USER: ${KEYCLOAK_ADMIN:-admin}
KC_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD:-changeme}
KC_API_URL: "http://keycloak:8080"
KC_FRONTEND_URL: "http://localhost:8080"
PROMETHEUS_API_URL: "http://admin:test@prometheus:9090/api/v1"
ports:
- "3001:3001"
restart: on-failure
depends_on:
- postgres
- clickhouse
router:
image: ghcr.io/wundergraph/cosmo/router:${DC_ROUTER_VERSION:-latest}
platform: linux/amd64
environment:
LOG_LEVEL: info
FEDERATED_GRAPH_NAME: production
CORS_ALLOW_CREDENTIALS: true
LISTEN_ADDR: "0.0.0.0:3002"
CONTROLPLANE_URL: http://controlplane:3001
DEFAULT_TELEMETRY_ENDPOINT: http://otelcollector:4318
GRAPH_API_TOKEN: ${ROUTER_TOKEN}
restart: on-failure
ports:
- "3002:3002"
studio:
image: ghcr.io/wundergraph/cosmo/studio:${DC_STUDIO_VERSION:-latest}
platform: linux/amd64
environment:
NEXT_PUBLIC_COSMO_CP_URL: http://localhost:3001
HOSTNAME: "0.0.0.0"
ports:
- "3000:3000"
# Migrations & Seed
seed:
image: ghcr.io/wundergraph/cosmo/controlplane:${DC_CONTROLPLANE_VERSION:-latest}
platform: linux/amd64
command:
- "/app/dist/bin/seed.js"
environment:
KC_REALM: "cosmo"
KC_API_URL: "http://keycloak:8080"
KC_ADMIN_USER: "admin"
KC_ADMIN_PASSWORD: "changeme"
KC_CLIENT_ID: "studio"
API_KEY: cosmo_669b576aaadc10ee1ae81d9193425705
DB_URL: "postgresql://postgres:changeme@postgres:5432/controlplane"
USER_EMAIL: foo@wundergraph.com
USER_PASSWORD: bar
USER_FIRSTNAME: foo
USER_LASTNAME: bar
ORGANIZATION_NAME: wundergraph
ORGANIZATION_SLUG: wundergraph
restart: on-failure
depends_on:
- postgres
- clickhouse
- keycloak
clickhouse-migration:
image: ghcr.io/wundergraph/cosmo/controlplane:${DC_CONTROLPLANE_VERSION:-latest}
platform: linux/amd64
command: node dist/bin/ch-migrate.js
depends_on:
- clickhouse
environment:
- CLICKHOUSE_DSN=clickhouse://default:changeme@clickhouse:9000/cosmo
restart: on-failure
database-migration:
image: ghcr.io/wundergraph/cosmo/controlplane:${DC_CONTROLPLANE_VERSION:-latest}
platform: linux/amd64
command: node dist/bin/db-migrate.js
depends_on:
- postgres
environment:
- DB_URL=postgresql://postgres:changeme@postgres:5432/controlplane
restart: on-failure
volumes:
postgres:
clickhouse:
prometheus:

@ -0,0 +1,3 @@
# Docker
This directory contains files for building and running the Docker images for cosmo stack.

@ -0,0 +1,6 @@
#!/bin/bash
set -e
clickhouse client -n <<-EOSQL
CREATE DATABASE IF NOT EXISTS cosmo;
EOSQL

File diff suppressed because it is too large Load Diff

@ -0,0 +1,2 @@
-- Create database for local keycloak instance
CREATE DATABASE keycloak;

@ -0,0 +1,3 @@
global:
scrape_interval: 10s
evaluation_interval: 10s

@ -0,0 +1,2 @@
basic_auth_users:
admin: $2b$12$hNf2lSsxfm0.i4a.1kVpSOVyBCfIB51VRjgBUyv6kdnyTlgWj81Ay #test

@ -0,0 +1,5 @@
go 1.20
use ./pets
use ./users

@ -0,0 +1,6 @@
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/nyaruka/phonenumbers v1.0.73 h1:bP2WN8/NUP8tQebR+WCIejFaibwYMHOaB7MQVayclUo=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/twilio/twilio-go v0.26.0 h1:wFW4oTe3/LKt6bvByP7eio8JsjtaLHjMQKOUEzQry7U=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
Loading…
Cancel
Save