Skip to content

Commit

Permalink
feat:add docker deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouop0 committed Jun 17, 2024
1 parent 0e9542b commit ad06fd2
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
39 changes: 39 additions & 0 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: "3"

services:

postgres:
container_name: postgres-game
image: postgres:15.7
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_USER=postgres
- POSTGRES_DB=postgres
- PGDATA=/var/lib/postgresql/data/pgdata
ports:
- "5435:5432"
volumes:
- ./postgres1/datadir:/var/lib/postgresql/data
- ./postgres.sql:/docker-entrypoint-initdb.d/init.sql

node1:
container_name: dispute-explorer-backend
image: ghcr.io/optimism-java/dispute-explorer:sha-0e9542b
depends_on:
- postgres
environment:
LOG_LEVEL: "info"
LOG_FORMAT: "console"
POSTGRESQL_DATA_SOURCE: "host=localhost port=5435 user=postgres password=postgres dbname=dispute_explorer sslmode=disable"
MYSQL_MAX_IDLE_CONNS: "10"
MYSQL_MAX_OPEN_CONNS: "20"
MYSQL_CONN_MAX_LIFETIME: "3600"
BLOCKCHAIN: "sepolia"
L1_RPC_URL: "https://quaint-white-season.ethereum-sepolia.quiknode.pro/b5c30cbb548d8743f08dd175fe50e3e923259d30"
FROM_BLOCK_NUMBER: "6034337"
FROM_BLOCK_HASH: "0xafc3e42c5899591501d29649ffef0bfdec68f8d77e6d44ee00ef88cfb1a2f163"
DISPUTE_GAME_PROXY_CONTRACT: "0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1"
network_mode: host



71 changes: 71 additions & 0 deletions deploy/postgres.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
CREATE DATABASE dispute_explorer WITH ENCODING ='UTF8';
-- Switch to the newly created database
\c dispute_explorer;

-- Create sync_blocks table
DROP TABLE IF EXISTS sync_blocks;
CREATE TABLE IF NOT EXISTS sync_blocks
(
id SERIAL PRIMARY KEY,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
blockchain VARCHAR(32) NOT NULL,
miner VARCHAR(42) NOT NULL,
block_time BIGINT NOT NULL,
block_number BIGINT NOT NULL,
block_hash VARCHAR(66) NOT NULL,
tx_count BIGINT NOT NULL,
event_count BIGINT NOT NULL,
parent_hash VARCHAR(66) NOT NULL,
status VARCHAR(32) NOT NULL,
check_count BIGINT NOT NULL
);
CREATE INDEX if not exists status_index ON sync_blocks (status);
CREATE INDEX if not exists tx_count_index ON sync_blocks (tx_count);
CREATE INDEX if not exists check_count_index ON sync_blocks (check_count);

-- ----------------------------
-- Table structure for dispute_game
-- ----------------------------
DROP TABLE IF EXISTS dispute_game;
CREATE TABLE IF NOT EXISTS dispute_game
(
id SERIAL PRIMARY KEY,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
sync_block_id BIGINT NOT NULL,
blockchain VARCHAR(32) NOT NULL,
block_time BIGINT NOT NULL,
block_number BIGINT NOT NULL,
block_hash VARCHAR(66) NOT NULL,
block_log_indexed BIGINT NOT NULL,
tx_index BIGINT NOT NULL,
tx_hash VARCHAR(66) NOT NULL,
event_name VARCHAR(32) NOT NULL,
event_hash VARCHAR(66) NOT NULL,
contract_address VARCHAR(42) NOT NULL,
game_contract varchar(42) NOT NULL,
game_type int NOT NULL,
l2_block_number bigint NOT NULL,
status int NOT NULL
);

-- ----------------------------
-- Table structure for game_claim_data
-- ----------------------------
DROP TABLE IF EXISTS game_claim_data;
CREATE TABLE IF NOT EXISTS game_claim_data
(
id SERIAL PRIMARY KEY,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
game_contract varchar(42) NOT NULL,
data_index int NOT NULL,
parent_index bigint NOT NULL,
countered_by varchar(42) NOT NULL,
claimant varchar(64) NOT NULL,
bond bigint NOT NULL,
claim varchar(64) NOT NULL,
position bigint NOT NULL,
clock bigint NOT NULL
)

0 comments on commit ad06fd2

Please sign in to comment.