Skip to content

Commit aa7b617

Browse files
committed
refactor: delete old composer
1 parent a95adc6 commit aa7b617

File tree

4 files changed

+51
-90
lines changed

4 files changed

+51
-90
lines changed

indexer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ sudo docker run --env-file ./indexer/.env -p 3000:3000 kadena-indexer:latest
8686

8787
### 4.4. Running with Docker Compose
8888

89-
Docker Compose provides a way to run the entire indexer stack with a single command. While you could run each service separately (database, migrations, GraphQL server, and streaming service), Docker Compose orchestrates all these components together, handling their dependencies and startup order automatically. The services are defined in `docker-compose.development.yml`, which includes:
89+
Docker Compose provides a way to run the entire indexer stack with a single command. While you could run each service separately (database, migrations, GraphQL server, and streaming service), Docker Compose orchestrates all these components together, handling their dependencies and startup order automatically. The services are defined in `docker-compose.yml`, which includes:
9090
- PostgreSQL database
9191
- Database migrations
9292
- GraphQL API server

indexer/docker-compose.development.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

indexer/docker-compose.yml

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,58 @@
1-
version: "3.8"
1+
version: '3.8'
22

33
services:
4-
indexer:
5-
build: ../.
6-
env_file:
7-
- ./.env
4+
indexer-db:
5+
image: postgres
6+
container_name: kad-indexer-postgres
7+
environment:
8+
POSTGRES_USER: ${DB_USERNAME}
9+
POSTGRES_PASSWORD: ${DB_PASSWORD}
10+
POSTGRES_DB: ${DB_NAME}
811
ports:
9-
- "3000:3000"
10-
command: yarn dev:run
11-
networks:
12-
- monitoring
13-
14-
prometheus:
15-
image: prom/prometheus
12+
- "5432:5432"
1613
volumes:
17-
- ./src/server/prometheus.yml:/etc/prometheus/prometheus.yml
18-
ports:
19-
- "9090:9090"
20-
command:
21-
- "--config.file=/etc/prometheus/prometheus.yml"
14+
- ${PWD}/indexer/postgres:/var/lib/postgresql/data
15+
healthcheck:
16+
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME}"]
17+
interval: 10s
18+
timeout: 5s
19+
retries: 5
20+
21+
db-migration:
22+
build:
23+
context: ../
24+
dockerfile: Dockerfile.development
25+
container_name: db-migration
26+
environment:
27+
DB_HOST: indexer-db
28+
command: ["yarn", "create:database"]
2229
depends_on:
23-
- indexer
24-
networks:
25-
- monitoring
30+
indexer-db:
31+
condition: service_healthy
2632

27-
grafana:
28-
image: grafana/grafana
29-
ports:
30-
- "3001:3000"
33+
graphql-app:
34+
build:
35+
context: ../
36+
dockerfile: Dockerfile.development
37+
container_name: kad-indexer-graphql
3138
environment:
32-
- GF_SERVER_HTTP_PORT=3000
39+
DB_HOST: indexer-db
40+
command: ["yarn", "dev:graphql"]
41+
ports:
42+
- "3001:3001"
3343
depends_on:
34-
- prometheus
35-
networks:
36-
- monitoring
44+
db-migration:
45+
condition: service_completed_successfully
3746

38-
networks:
39-
monitoring:
47+
streaming-app:
48+
build:
49+
context: ../
50+
dockerfile: Dockerfile.development
51+
container_name: kad-indexer-streaming
52+
environment:
53+
DB_HOST: indexer-db
54+
KADENA_GRAPHQL_API_URL: http://graphql-app
55+
command: ["yarn", "dev:streaming"]
56+
depends_on:
57+
graphql-app:
58+
condition: service_started

indexer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
},
6565
"scripts": {
6666
"create:database": "ts-node src/index.ts --database && yarn migrate:up",
67-
"dev": "docker-compose -f docker-compose.development.yml up && docker-compose logs -f indexer",
67+
"dev": "docker-compose -f docker-compose.yml up && docker-compose logs -f indexer",
6868
"dev:database": "ts-node src/index.ts --database",
6969
"dev:streaming": "ts-node src/index.ts --streaming",
7070
"dev:graphql": "ts-node src/index.ts --graphql",

0 commit comments

Comments
 (0)