Skip to content

Commit

Permalink
Dockerize Service to begin testing in prod (#23)
Browse files Browse the repository at this point in the history
Dockerize service and have hasura front-end
  • Loading branch information
0xjame5 authored Apr 11, 2022
1 parent 246be83 commit 3104717
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM cosmwasm/wasmd:v0.18.0 as wasmd
FROM cosmwasm/rust-optimizer:0.11.5 as rust-optimizer
FROM ubuntu:20.04
FROM postgres:14

COPY --from=wasmd /usr/bin/wasmd /usr/local/bin/wasmd
COPY --from=wasmd /opt/* /opt/

RUN apt-get update && \
apt-get install --no-install-recommends -y \
ca-certificates curl file \
build-essential \
git \
gcc \
jq \
musl-tools \
autoconf automake autotools-dev libtool xutils-dev

RUN DEBIAN_FRONTEND=noninteractive apt install -y tzdata
RUN apt-get install -y postgresql-server-dev-14 postgresql-contrib

ENV SSL_VERSION=1.0.2u

RUN curl https://www.openssl.org/source/openssl-$SSL_VERSION.tar.gz -O && \
tar -xzf openssl-$SSL_VERSION.tar.gz && \
cd openssl-$SSL_VERSION && ./config && make depend && make install && \
cd .. && rm -rf openssl-$SSL_VERSION*

ENV OPENSSL_LIB_DIR=/usr/local/ssl/lib \
OPENSSL_INCLUDE_DIR=/usr/local/ssl/include \
OPENSSL_STATIC=1


RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y
ENV PATH=/root/.cargo/bin:$PATH
RUN rustup update stable \
&& rustup target add wasm32-unknown-unknown

RUN cargo install diesel_cli --no-default-features --features "postgres"

RUN git clone https://github.com/DA0-DA0/dao-contracts.git
RUN mkdir /app
ADD . /app
WORKDIR /app
RUN cargo build
CMD cargo run

51 changes: 51 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: "3.9"

services:
db:
container_name: indexer_db
image: postgres:14
volumes:
- ./data/db:/var/lib/postgresql/data
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- '5432:5432'
indexer:
build: .
command: bash -c "cargo install diesel_cli --no-default-features --features "postgres" && diesel setup && diesel migration run && cargo run"
volumes:
- .:/code
network_mode: host
environment:
- POSTGRES_NAME=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- ENABLE_INDEXER=true
- TENDERMINT_WEBSOCKET_URL=wss://rpc.uni.juno.deuslabs.fi/websocket
- TENDERMINT_RPC_URL=https://rpc.uni.juno.deuslabs.fi
- TENDERMINT_SAVE_ALL_BLOCKS=true
- TENDERMINT_INITAL_BLOCK_HEIGHT=100000
- RUST_BACKTRACE=1
- DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres
depends_on:
- db
graphql-engine:
image: hasura/graphql-engine:v2.4.0
ports:
- "8080:8080"
depends_on:
- db
environment:
## postgres database to store Hasura metadata
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgres@indexer_db:5432/postgres
## this env var can be used to add the above postgres database to Hasura as a data source. this can be removed/updated based on your needs
PG_DATABASE_URL: postgres://postgres:postgres@indexer_db:5432/postgres
## enable the console served by server
HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console
## enable debugging mode. It is recommended to disable this in production
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
## uncomment next line to set an admin secret
# HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
1 change: 1 addition & 0 deletions src/util/gov_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub fn insert_gov_token(
// stake_contract_code_id,
label,
// unstaking_duration,
..
} => {
warn!("TODO: Use existing cw20 addr: {}, label: {},", addr, label);
result = Ok(0);
Expand Down

0 comments on commit 3104717

Please sign in to comment.