cic-cache
This commit is contained in:
parent
492faa87e5
commit
0345e2782f
@ -5,6 +5,7 @@ include:
|
||||
- local: 'apps/cic-ussd/.gitlab-ci.yml'
|
||||
- local: 'apps/cic-notify/.gitlab-ci.yml'
|
||||
- local: 'apps/cic-meta/.gitlab-ci.yml'
|
||||
- local: 'apps/cic-cache/.gitlab-ci.yml'
|
||||
|
||||
stages:
|
||||
- build
|
||||
|
@ -1,42 +1,22 @@
|
||||
image: docker:19.03.13
|
||||
.cic_cache_variables:
|
||||
variables:
|
||||
APP_NAME: cic-cache
|
||||
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
|
||||
|
||||
variables:
|
||||
# docker host
|
||||
DOCKER_HOST: tcp://docker:2376
|
||||
# container, thanks to volume mount from config.toml
|
||||
DOCKER_TLS_CERTDIR: "/certs"
|
||||
# These are usually specified by the entrypoint, however the
|
||||
# Kubernetes executor doesn't run entrypoints
|
||||
# https://gitlab.com/gitlab-org/gitlab-runner/-/issues/4125
|
||||
DOCKER_TLS_VERIFY: 1
|
||||
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
|
||||
.cic_cache_changes_target:
|
||||
rules:
|
||||
- changes:
|
||||
- $CONTEXT/$APP_NAME/*
|
||||
|
||||
services:
|
||||
- docker:19.03.13-dind
|
||||
build-mr-cic-cache:
|
||||
extends:
|
||||
- .cic_cache_changes_target
|
||||
- .py_build_merge_request
|
||||
- .cic_cache_variables
|
||||
|
||||
before_script:
|
||||
- docker info
|
||||
build-push-cic-cache:
|
||||
extends:
|
||||
- .py_build_push
|
||||
- .cic_cache_variables
|
||||
|
||||
build_merge_request:
|
||||
stage: build
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
when: always
|
||||
script:
|
||||
- docker build -t $CI_PROJECT_PATH_SLUG:$CI_COMMIT_SHORT_SHA .
|
||||
|
||||
build_image:
|
||||
stage: build
|
||||
variables:
|
||||
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
|
||||
before_script:
|
||||
- docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD $CI_REGISTRY
|
||||
script:
|
||||
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" $CI_REGISTRY --password-stdin
|
||||
- docker build -t $IMAGE_TAG .
|
||||
- docker push $IMAGE_TAG
|
||||
- docker tag $IMAGE_TAG $LATEST_TAG
|
||||
- docker push $LATEST_TAG
|
||||
only:
|
||||
- master
|
||||
|
||||
|
@ -1,84 +0,0 @@
|
||||
version: "3"
|
||||
volumes:
|
||||
data-volume: {} # an empty dir that can be earased by dropping the volume: docker-compose down -v
|
||||
|
||||
services:
|
||||
|
||||
postgres:
|
||||
image: postgres:12.5-alpine
|
||||
container_name: cic_postgres
|
||||
environment:
|
||||
POSTGRES_USER: ${DATABASE_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${DATABASE_PASSWORD:-password}
|
||||
POSTGRES_DB: postgres
|
||||
ports:
|
||||
- 63432:5432
|
||||
restart: always
|
||||
volumes:
|
||||
- ./db/initdb_files/create_all_db.sql:/docker-entrypoint-initdb.d/1-create_all_db.sql #note these run in order
|
||||
- data-volume:/var/lib/postgresql/data
|
||||
|
||||
db-migration:
|
||||
build:
|
||||
context: .
|
||||
environment:
|
||||
ETH_PROVIDER: ${ETH_PROVIDER:-wss://bloxberg-ws.dev.grassrootseconomics.net/}
|
||||
# CIC_REGISTRY_ADDRESS: ${CIC_REGISTRY_ADDRESS:?err} # TODO are there any public addresses we can use for a default?
|
||||
CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS
|
||||
BANCOR_DIR: $BANCOR_DIR # is this required?
|
||||
DATABASE_HOST: postgres # because it's set in the postgres service block as well as port
|
||||
DATABASE_PORT: 5432
|
||||
DATABASE_USER: ${DATABASE_USER:-postgres}
|
||||
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-password}
|
||||
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic-cache}
|
||||
DATABASE_ENGINE: postgres
|
||||
DATABASE_DRIVER: psycopg2
|
||||
command: [ "/usr/local/bin/wait-for-it/wait-for-it.sh", "postgres:5432", "--",
|
||||
"migrate.py", "-c", "/usr/local/etc/cic-cache", "--migrations-dir",
|
||||
"/usr/local/share/cic-cache/alembic", "-vv" ]
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
cic-cache-tracker:
|
||||
build:
|
||||
context: .
|
||||
# https://docs.docker.com/compose/compose-file/#variable-substitution
|
||||
environment:
|
||||
ETH_PROVIDER: ${ETH_PROVIDER:-wss://bloxberg-ws.dev.grassrootseconomics.net/}
|
||||
# CIC_REGISTRY_ADDRESS: ${CIC_REGISTRY_ADDRESS:?err} # TODO are there any public addresses we can use for a default?
|
||||
CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS
|
||||
BANCOR_DIR: $BANCOR_DIR # is this required?
|
||||
DATABASE_HOST: postgres # because it's set in the postgres service block as well as port
|
||||
DATABASE_PORT: 5432
|
||||
DATABASE_USER: ${DATABASE_USER:-postgres}
|
||||
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-password}
|
||||
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-"cic-cache"}
|
||||
DATABASE_ENGINE: postgres
|
||||
DATABASE_DRIVER: psycopg2
|
||||
# deploy:
|
||||
# restart_policy:
|
||||
# condition: on-failure
|
||||
entrypoint: ["/usr/local/bin/cic-cache-tracker", "-vv"]
|
||||
depends_on:
|
||||
- postgres
|
||||
- db-migration
|
||||
|
||||
cic-cache-server:
|
||||
build:
|
||||
context: .
|
||||
environment:
|
||||
DATABASE_HOST: ${DATABASE_HOST:-postgres}
|
||||
DATABASE_PORT: 5432
|
||||
DATABASE_USER: ${DATABASE_USER:-postgres}
|
||||
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-password}
|
||||
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-"cic-cache"}
|
||||
SERVER_PORT: 80
|
||||
ports:
|
||||
- 63313:80
|
||||
# deploy:
|
||||
# restart_policy:
|
||||
# condition: on-failure
|
||||
entrypoint: [ "/usr/local/bin/uwsgi", "--wsgi-file", "/usr/local/lib/python3.8/site-packages/cic_cache/runnable/server.py", "--http", ":80", "--pyargv", "-vv" ]
|
||||
depends_on:
|
||||
- postgres
|
||||
- db-migration
|
@ -128,57 +128,56 @@ 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
|
||||
entrypoint: ["/usr/local/bin/cic-cache-tracker", "-vv"]
|
||||
# command: "/usr/local/bin/cic-cache-tracker -vv"
|
||||
|
||||
# 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"
|
||||
|
||||
# cic-cache-server:
|
||||
# image: grassrootseconomics:cic-cache-uwsgi
|
||||
# environment:
|
||||
# DATABASE_USER: $DATABASE_USER
|
||||
# DATABASE_HOST: $DATABASE_HOST
|
||||
# DATABASE_PORT: $DATABASE_PORT
|
||||
# DATABASE_PASSWORD: $DATABASE_PASSWORD
|
||||
# DATABASE_NAME: $DATABASE_NAME_CIC_CACHE
|
||||
# PGPASSWORD: $DATABASE_PASSWORD
|
||||
# SERVER_PORT: 80
|
||||
# ports:
|
||||
# - ${HTTP_PORT_CIC_CACHE}:80
|
||||
# depends_on:
|
||||
# - postgres
|
||||
# deploy:
|
||||
# restart_policy:
|
||||
# condition: on-failure
|
||||
# command: "/root/start_uwsgi.sh"
|
||||
cic-cache-server:
|
||||
image: grassrootseconomics:cic-cache-uwsgi
|
||||
environment:
|
||||
DATABASE_USER: $DATABASE_USER
|
||||
DATABASE_HOST: $DATABASE_HOST
|
||||
DATABASE_PORT: $DATABASE_PORT
|
||||
DATABASE_PASSWORD: $DATABASE_PASSWORD
|
||||
DATABASE_NAME: $DATABASE_NAME_CIC_CACHE
|
||||
PGPASSWORD: $DATABASE_PASSWORD
|
||||
SERVER_PORT: 80
|
||||
ports:
|
||||
- ${HTTP_PORT_CIC_CACHE}:80
|
||||
depends_on:
|
||||
- postgres
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
command: "/root/start_uwsgi.sh"
|
||||
|
||||
cic-eth-tasker:
|
||||
# image: grassrootseconomics:cic-eth-service
|
||||
|
Loading…
Reference in New Issue
Block a user