Skip to content

Commit

Permalink
Merge pull request #33 from cybercongress/setup-update
Browse files Browse the repository at this point in the history
  • Loading branch information
cyborgshead authored Oct 1, 2024
2 parents 5b21ec6 + 3793cc5 commit 1d3d49f
Show file tree
Hide file tree
Showing 21 changed files with 24 additions and 81 deletions.
17 changes: 15 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
#chain params
CHAIN_PREFIX=bostrom
RPC_URL=http://localhost:26657
GRPC_URL=http://localhost:9090
GPRC_INSECURE=true

#database params
POSTGRES_FOLDER=$HOME/.cyberindex/postgres
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=cyberindex
POSTGRES_USER=cyber
POSTGRES_PASSWORD=1cyberindex1
POSTGRES_SSL=false

#hasura params
HASURA_PORT=8090
HASURA_ADMIN_SECRET=1hasura1

#indexing settings
INDEX_WORKERS=1
RPC_URL=http://localhost:26657
GRPC_URL=http://localhost:9090
START_HEIGHT=1
LISTEN_NEW_BLOCKS=true
PARSE_OLD_BLOCKS=true
PARSE_GENESIS=true
LOG_LEVEL=debug
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ ENV PATH="/usr/local/go/bin:$PATH"

COPY . .

ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.5.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.a

RUN go mod download

RUN LINK_STATICALLY=true BUILD_TAGS="muslc" make build
RUN make build

FROM ubuntu:22.04

Expand All @@ -33,7 +31,7 @@ WORKDIR /app

COPY --from=builder /app/build/cyberindex /usr/bin/cyberindex

#COPY --from=builder /root/go/pkg/mod/github.com/!cosm!wasm/[email protected].0/internal/api/libwasmvm.x86_64.so /root/go/pkg/mod/github.com/!cosm!wasm/[email protected].0/internal/api/libwasmvm.x86_64.so
COPY --from=builder /root/go/pkg/mod/github.com/!cosm!wasm/[email protected].2/internal/api/libwasmvm.x86_64.so /root/go/pkg/mod/github.com/!cosm!wasm/[email protected].2/internal/api/libwasmvm.x86_64.so

COPY ./entrypoint.sh /entrypoint.sh

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 0 additions & 11 deletions database/schema/setup.sh

This file was deleted.

11 changes: 5 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ services:
container_name: cyberindex_postgres
volumes:
- $HOME/.cyberindex/postgres:/var/lib/postgresql/data
- ./database/schema/:/root/schema
- ./database/schema/:/docker-entrypoint-initdb.d/
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
networks:
- cyberindex-net
ports:
- 127.0.0.1:${POSTGRES_DB_PORT}:5432
- 127.0.0.1:${POSTGRES_PORT}:5432
hasura:
image: hasura/graphql-engine:latest
restart: always
container_name: cyberindex_hasura
depends_on:
- "postgres"
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@172.28.1.2:${POSTGRES_PORT}/${POSTGRES_USER}
HASURA_GRAPHQL_DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@172.28.1.2:${POSTGRES_PORT}/${POSTGRES_DB}
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
HASURA_GRAPHQL_ADMIN_SECRET: $HASURA_ADMIN_SECRET
Expand All @@ -34,16 +34,15 @@ services:
ports:
- 127.0.0.1:${HASURA_PORT}:8080
cyberindex:
image: cyberd/cyberindex:v2.0.0-rc1
image: cyberd/cyberindex:v2.0.0
restart: always
shm_size: 1g
container_name: cyberindex
volumes:
- $HOME/.cyberindex/:/root/.cyberindex
- .env:/.env
networks:
- cyberindex-net
ports:
- 127.0.0.1:${POSTGRES_DB_PORT}:5432
depends_on:
- "postgres"
networks:
Expand Down
11 changes: 2 additions & 9 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,13 @@ if [ ! -d "/root/.cyberindex/" ]
then
export $(cat /.env)
mkdir /root/.cyberindex
echo -e "chain:\n bech32_prefix: $CHAIN_PREFIX\n modules:\n - modules\n - messages\n - auth\n - consensus\n - daily refetch\n - message_type\n - bank\n - graph\n - grid\n - resources\n - wasm\nnode:\n type: remote\n config:\n rpc:\n client_name: \"cyberindex\"\n max_connections: 10\n address: \"$RPC_URL\"\n grpc:\n address: \"$GRPC_URL\"\n insecure: true\nparsing:\n workers: $INDEX_WORKERS\n start_height: $START_HEIGHT\n average_block_time: 5s\n listen_new_blocks: true\n parse_old_blocks: true\n parse_genesis: true\ndatabase:\n url: postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_USER?sslmode=disable&search_path=public\n max_open_connections: 1\n max_idle_connections: 1\n partition_size: 100000\n partition_batch: 1000\n ssl_mode_enable: \"$POSTGRES_SSL\"\n ssl_root_cert: \"\"\n ssl_cert: \"\"\n ssl_key: \"\"\nlogging:\n level: debug\n format: text\nactions:\n host: 127.0.0.1\n port: 3000" >> /root/.cyberindex/config.yaml
fi

if [ -f "/root/.cyberindex/config.yaml" ]
then
export $(cat /.env)
rm /root/.cyberindex/config.yaml
echo -e "chain:\n bech32_prefix: $CHAIN_PREFIX\n modules:\n - modules\n - messages\n - auth\n - consensus\n - daily refetch\n - message_type\n - bank\n - graph\n - grid\n - resources\n - wasm\nnode:\n type: remote\n config:\n rpc:\n client_name: \"cyberindex\"\n max_connections: 10\n address: \"$RPC_URL\"\n grpc:\n address: \"$GRPC_URL\"\n insecure: true\nparsing:\n workers: $INDEX_WORKERS\n start_height: $START_HEIGHT\n average_block_time: 5s\n listen_new_blocks: true\n parse_old_blocks: true\n parse_genesis: true\ndatabase:\n url: postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_USER?sslmode=disable&search_path=public\n max_open_connections: 1\n max_idle_connections: 1\n partition_size: 100000\n partition_batch: 1000\n ssl_mode_enable: \"$POSTGRES_SSL\"\n ssl_root_cert: \"\"\n ssl_cert: \"\"\n ssl_key: \"\"\nlogging:\n level: debug\n format: text\nactions:\n host: 127.0.0.1\n port: 3000" > /root/.cyberindex/config.yaml
echo -e "chain:\n bech32_prefix: $CHAIN_PREFIX\n modules:\n - modules\n - messages\n - auth\n - consensus\n - daily refetch\n - message_type\n - bank\n - graph\n - grid\n - resources\n - wasm\nnode:\n type: remote\n config:\n rpc:\n client_name: \"cyberindex\"\n max_connections: 10\n address: \"$RPC_URL\"\n grpc:\n address: \"$GRPC_URL\"\n insecure: $GPRC_INSECURE\n workers: $INDEX_WORKERS\n start_height: $START_HEIGHT\n average_block_time: 5s\n listen_new_blocks: $LISTEN_NEW_BLOCKS\n parse_old_blocks: $PARSE_OLD_BLOCKS\n parse_genesis: $PARSE_GENESIS\ndatabase:\n url: postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB?sslmode=disable&search_path=public\n max_open_connections: 1\n max_idle_connections: 1\n partition_size: 100000\n partition_batch: 1000\n ssl_mode_enable: \"$POSTGRES_SSL\"\n ssl_root_cert: \"\"\n ssl_cert: \"\"\n ssl_key: \"\"\nlogging:\n level: $LOG_LEVEL\n format: text\nactions:\n host: 127.0.0.1\n port: 3000" >> /root/.cyberindex/config.yaml
fi

if [ ! -f "/root/.cyberindex/config.yaml" ]
then
export $(cat /.env)
echo -e "chain:\n bech32_prefix: $CHAIN_PREFIX\n modules:\n - modules\n - messages\n - auth\n - consensus\n - daily refetch\n - message_type\n - bank\n - graph\n - grid\n - resources\n - wasm\nnode:\n type: remote\n config:\n rpc:\n client_name: \"cyberindex\"\n max_connections: 10\n address: \"$RPC_URL\"\n grpc:\n address: \"$GRPC_URL\"\n insecure: true\nparsing:\n workers: $INDEX_WORKERS\n start_height: $START_HEIGHT\n average_block_time: 5s\n listen_new_blocks: true\n parse_old_blocks: true\n parse_genesis: true\ndatabase:\n url: postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_USER?sslmode=disable&search_path=public\n max_open_connections: 1\n max_idle_connections: 1\n partition_size: 100000\n partition_batch: 1000\n ssl_mode_enable: \"$POSTGRES_SSL\"\n ssl_root_cert: \"\"\n ssl_cert: \"\"\n ssl_key: \"\"\nlogging:\n level: debug\n format: text\nactions:\n host: 127.0.0.1\n port: 3000" >> /root/.cyberindex/config.yaml
echo -e "chain:\n bech32_prefix: $CHAIN_PREFIX\n modules:\n - modules\n - messages\n - auth\n - consensus\n - daily refetch\n - message_type\n - bank\n - graph\n - grid\n - resources\n - wasm\nnode:\n type: remote\n config:\n rpc:\n client_name: \"cyberindex\"\n max_connections: 10\n address: \"$RPC_URL\"\n grpc:\n address: \"$GRPC_URL\"\n insecure: $GPRC_INSECURE\n workers: $INDEX_WORKERS\n start_height: $START_HEIGHT\n average_block_time: 5s\n listen_new_blocks: $LISTEN_NEW_BLOCKS\n parse_old_blocks: $PARSE_OLD_BLOCKS\n parse_genesis: $PARSE_GENESIS\ndatabase:\n url: postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB?sslmode=disable&search_path=public\n max_open_connections: 1\n max_idle_connections: 1\n partition_size: 100000\n partition_batch: 1000\n ssl_mode_enable: \"$POSTGRES_SSL\"\n ssl_root_cert: \"\"\n ssl_cert: \"\"\n ssl_key: \"\"\nlogging:\n level: $LOG_LEVEL\n format: text\nactions:\n host: 127.0.0.1\n port: 3000" >> /root/.cyberindex/config.yaml
fi

exec "$@"
36 changes: 0 additions & 36 deletions scripts/start-docker.sh

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/stop-rm.sh

This file was deleted.

0 comments on commit 1d3d49f

Please sign in to comment.