From 502caa1518172332e22a1bfac342aaf20431c153 Mon Sep 17 00:00:00 2001 From: Blair Vanderlugt Date: Sat, 6 Feb 2021 03:27:59 +0000 Subject: [PATCH] ussd configs --- apps/cic-ussd | 2 +- docker-compose.yml | 152 ++++++++++++++++++----------------- scripts/initdb/create_db.sql | 3 +- 3 files changed, 82 insertions(+), 75 deletions(-) diff --git a/apps/cic-ussd b/apps/cic-ussd index d4e5e713..c5ffcc19 160000 --- a/apps/cic-ussd +++ b/apps/cic-ussd @@ -1 +1 @@ -Subproject commit d4e5e71308997281e5cd118b9a88299fc5c2c2fd +Subproject commit c5ffcc19c5a48b101de689385c1ae971de0a5439 diff --git a/docker-compose.yml b/docker-compose.yml index 2f3592d8..8c0033e3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,12 +35,12 @@ services: context: apps/bloxbergValidatorSetup restart: unless-stopped ports: - - ${HTTP_PORT_ETH:-8545}:8545 + - ${HTTP_PORT_ETH:-8545} - 8546 - 30303 volumes: - ./apps/bloxbergValidatorSetup/keys:/root/keys # stores the signing key locally - - bloxberg-data:/root/.local/share/io.parity.ethereum/chains/Bloxberg/db/ + - bloxberg-data:/root/.local/share/io.parity.ethereum/ # See contents of /initdb/create_db.sql for app user, password and databases postgres: @@ -49,7 +49,7 @@ services: POSTGRES_HOST_AUTH_METHOD: trust # for postgres user access w/o password. Obvioulsy not safe but allows easy elevated debugging. PGDATA: /tmp/cic/postgres ports: - - ${HTTP_PORT_POSTGRES:-5432} + - 5432 volumes: - ./scripts/initdb/create_db.sql:/docker-entrypoint-initdb.d/1-create_all_db.sql # init db scripts will run in order at container start - postgres-db:/tmp/cic/postgres @@ -75,8 +75,8 @@ services: contract-migration: build: - context: apps - dockerfile: apps/contract-migration/docker/ + context: apps/ + dockerfile: contract-migration/docker/Dockerfile environment: # ETH_PROVIDER should be broken out into host/port but cic-eth expects this ETH_PROVIDER: http://eth:8545 @@ -90,35 +90,35 @@ services: volumes: - contract-config:/tmp/cic/config - cic-cache-tracker: - # image: registry.gitlab.com/grassrootseconomics/cic-cache:master-latest - build: apps/cic-cache - environment: - CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS # supplied at contract-config after contract provisioning - ETH_PROVIDER: ${ETH_PROVIDER:-http://eth:8545} - BANCOR_DIR: ${BANCOR_DIR:-/usr/local/share/cic/bancor} - DATABASE_USER: ${DATABASE_USER:-grassroots} - DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala} # this is is set at initdb see: postgres/initdb/create_db.sql - DATABASE_HOST: ${DATABASE_HOST:-postgres} - DATABASE_PORT: ${DATABASE_PORT:-5432} - DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache} - DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres} - DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2} - ETH_ABI_DIR: ${ETH_ABI_DIR:-/usr/local/share/cic/solidity/abi} - deploy: - restart_policy: - condition: on-failure - depends_on: - - postgres - - eth - command: - - /bin/sh - - -c - - | - if [[ -f /tmp/cic/config/.env ]]; then source /tmp/cic/config/.env; fi - /usr/local/bin/cic-cache-tracker -vv - volumes: - - contract-config:/tmp/cic/config/:ro + # cic-cache-tracker: + # # image: registry.gitlab.com/grassrootseconomics/cic-cache:master-latest + # build: apps/cic-cache + # environment: + # CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS # supplied at contract-config after contract provisioning + # ETH_PROVIDER: ${ETH_PROVIDER:-http://eth:8545} + # BANCOR_DIR: ${BANCOR_DIR:-/usr/local/share/cic/bancor} + # DATABASE_USER: ${DATABASE_USER:-grassroots} + # DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala} # this is is set at initdb see: postgres/initdb/create_db.sql + # DATABASE_HOST: ${DATABASE_HOST:-postgres} + # DATABASE_PORT: ${DATABASE_PORT:-5432} + # DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache} + # DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres} + # DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2} + # ETH_ABI_DIR: ${ETH_ABI_DIR:-/usr/local/share/cic/solidity/abi} + # deploy: + # restart_policy: + # condition: on-failure + # depends_on: + # - postgres + # - eth + # command: + # - /bin/sh + # - -c + # - | + # if [[ -f /tmp/cic/config/.env ]]; then source /tmp/cic/config/.env; fi + # /usr/local/bin/cic-cache-tracker -vv + # volumes: + # - contract-config:/tmp/cic/config/:ro # entrypoint: ["/usr/local/bin/cic-cache-tracker", "-vv"] # command: "/usr/local/bin/cic-cache-tracker -vv" @@ -453,43 +453,49 @@ services: # - ${LOCAL_VOLUME_DIR:-/tmp/cic}/pgp:/tmp/cic/pgp # command: "/root/start_server.sh -vv" -# cic-ussd-server: -# image: grassrootseconomics:cic-ussd -# environment: -# DATABASE_USER: $DATABASE_USER -# DATABASE_HOST: $DATABASE_HOST -# DATABASE_PORT: $DATABASE_PORT -# DATABASE_PASSWORD: $DATABASE_PASSWORD -# DATABASE_NAME: $DATABASE_NAME_CIC_USSD -# DATABASE_ENGINE: $DATABASE_ENGINE -# DATABASE_DRIVER: $DATABASE_DRIVER -# SERVER_PORT: 80 -# ports: -# - ${HTTP_PORT_CIC_USSD}:80 -# depends_on: -# - postgres -# - redis -# deploy: -# restart_policy: -# condition: on-failure -# command: "/root/start_uwsgi.sh" + cic-ussd-server: + # image: grassrootseconomics:cic-ussd + build: + context: apps/ + dockerfile: cic-ussd/docker/Dockerfile + environment: + DATABASE_USER: grassroots + DATABASE_HOST: postgres + DATABASE_PORT: 5432 + DATABASE_PASSWORD: tralala + DATABASE_NAME: cic_ussd + DATABASE_ENGINE: postgresql + DATABASE_DRIVER: psycopg2 + SERVER_PORT: 80 + ports: + - 80:8082 + depends_on: + - postgres + - redis + deploy: + restart_policy: + condition: on-failure + command: "/root/start_uwsgi.sh" -# cic-ussd-tasker: -# image: grassrootseconomics:cic-ussd -# environment: -# DATABASE_USER: $DATABASE_USER -# DATABASE_HOST: $DATABASE_HOST -# DATABASE_PORT: $DATABASE_PORT -# DATABASE_PASSWORD: $DATABASE_PASSWORD -# DATABASE_NAME: $DATABASE_NAME_CIC_USSD -# DATABASE_ENGINE: $DATABASE_ENGINE -# DATABASE_DRIVER: $DATABASE_DRIVER -# CELERY_BROKER_URL: $CELERY_BROKER_URL -# CELERY_RESULT_URL: $CELERY_RESULT_URL -# depends_on: -# - postgres -# - redis -# deploy: -# restart_policy: -# condition: on-failure -# command: "/root/start_tasker.sh -q cic-ussd" + cic-ussd-tasker: + # image: grassrootseconomics:cic-ussd + build: + context: apps + dockerfile: cic-ussd/docker/Dockerfile + environment: + DATABASE_USER: grassroots + DATABASE_HOST: postgres + DATABASE_PORT: 5432 + DATABASE_PASSWORD: tralala + DATABASE_NAME: cic_ussd + DATABASE_ENGINE: postgresql + DATABASE_DRIVER: psycopg2 + CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis} + CELERY_RESULT_URL: ${CELERY_BROKER_URL:-redis://redis} + depends_on: + - postgres + - redis + deploy: + restart_policy: + condition: on-failure + command: "/root/start_tasker.sh -q cic-ussd" diff --git a/scripts/initdb/create_db.sql b/scripts/initdb/create_db.sql index 6eca4c79..c1476495 100644 --- a/scripts/initdb/create_db.sql +++ b/scripts/initdb/create_db.sql @@ -4,6 +4,7 @@ CREATE DATABASE "cic_eth"; CREATE DATABASE "cic_notify"; CREATE DATABASE "cic_meta"; CREATE DATABASE "cic_signer"; +CREATE DATABASE "cic_ussd"; GRANT ALL PRIVILEGES -ON DATABASE "cic_cache", "cic_eth", "cic_notify", "cic_meta", "cic_signer" +ON DATABASE "cic_cache", "cic_eth", "cic_notify", "cic_meta", "cic_signer", "cic_ussd" TO grassroots;