Skip to content

Commit

Permalink
build: add db migration to docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
0xawaz committed Nov 22, 2024
1 parent ca3c48e commit 14ae5df
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 14 deletions.
4 changes: 4 additions & 0 deletions fhevm-engine/coprocessor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ init_db:
$(DB_URL) sqlx migrate run
$(DB_URL) cargo test setup_test_user -- --nocapture --ignored

.PHONY: run
run:
docker compose up -d

.PHONY: recreate_db
recreate_db:
$(MAKE) cleanup
Expand Down
57 changes: 43 additions & 14 deletions fhevm-engine/coprocessor/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,66 @@
version: '3.8'
name: fhevm

services:
db:
container_name: db
image: postgres:15.7
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- '5432:5432'
volumes:
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 3
volumes:
- db:/var/lib/postgresql/data
coproc:
image: ghcr.io/zama-ai/fhevm-coprocessor:v7

migration:
container_name: migration
image: ghcr.io/zama-ai/fhevm-db-migration:v1
environment:
DATABASE_URL: postgresql://postgres:postgres@db:5432/coprocessor
depends_on:
db:
condition: service_healthy

coprocessor:
container_name: coprocessor
image: ghcr.io/zama-ai/fhevm-coprocessor:v0.1.0-3
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/coprocessor
DATABASE_URL: postgresql://postgres:postgres@db:5432/coprocessor
ports:
- '50051:50051'
volumes:
- ${PWD}/coprocessor.key:/usr/share/coprocessor.key
- ./coprocessor.key:/usr/share/coprocessor.key
command:
- --run-bg-worker
- --run-server
- --server-addr=0.0.0.0:50051
- --coprocessor-private-key=/usr/share/coprocessor.key
depends_on:
migration:
condition: service_completed_successfully

geth:
image: ghcr.io/zama-ai/geth-coprocessor-devnode:v6
container_name: geth
image: ghcr.io/zama-ai/geth-coprocessor-devnode:v8
environment:
- FHEVM_COPROCESSOR_API_KEY=a1503fb6-d79b-4e9e-826d-44cf262f3e05
- FHEVM_COPROCESSOR_URL=coproc:50051
- COPROCESSOR_CONTRACT_ADDRESS=0x6819e3aDc437fAf9D533490eD3a7552493fCE3B1
- ACL_CONTRACT_ADDRESS=0x339EcE85B9E11a3A3AA557582784a15d7F82AAf2
FHEVM_COPROCESSOR_API_KEY: a1503fb6-d79b-4e9e-826d-44cf262f3e05
FHEVM_COPROCESSOR_URL: coprocessor:50051
COPROCESSOR_CONTRACT_ADDRESS: 0x6819e3aDc437fAf9D533490eD3a7552493fCE3B1
ACL_CONTRACT_ADDRESS: 0x339EcE85B9E11a3A3AA557582784a15d7F82AAf2
volumes:
- ./geth:/geth
ports:
- '8745:8545'
depends_on:
coprocessor:
condition: service_started

volumes:
db:
driver: local
driver: local

0 comments on commit 14ae5df

Please sign in to comment.