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-ussd/.gitlab-ci.yml'
|
||||||
- local: 'apps/cic-notify/.gitlab-ci.yml'
|
- local: 'apps/cic-notify/.gitlab-ci.yml'
|
||||||
- local: 'apps/cic-meta/.gitlab-ci.yml'
|
- local: 'apps/cic-meta/.gitlab-ci.yml'
|
||||||
|
- local: 'apps/cic-cache/.gitlab-ci.yml'
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- 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:
|
.cic_cache_changes_target:
|
||||||
# docker host
|
rules:
|
||||||
DOCKER_HOST: tcp://docker:2376
|
- changes:
|
||||||
# container, thanks to volume mount from config.toml
|
- $CONTEXT/$APP_NAME/*
|
||||||
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"
|
|
||||||
|
|
||||||
services:
|
build-mr-cic-cache:
|
||||||
- docker:19.03.13-dind
|
extends:
|
||||||
|
- .cic_cache_changes_target
|
||||||
|
- .py_build_merge_request
|
||||||
|
- .cic_cache_variables
|
||||||
|
|
||||||
before_script:
|
build-push-cic-cache:
|
||||||
- docker info
|
extends:
|
||||||
|
- .py_build_push
|
||||||
build_merge_request:
|
- .cic_cache_variables
|
||||||
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:
|
volumes:
|
||||||
- contract-config:/tmp/cic/config
|
- 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:
|
cic-cache-server:
|
||||||
# # image: registry.gitlab.com/grassrootseconomics/cic-cache:master-latest
|
image: grassrootseconomics:cic-cache-uwsgi
|
||||||
# build: apps/cic-cache
|
environment:
|
||||||
# environment:
|
DATABASE_USER: $DATABASE_USER
|
||||||
# CIC_REGISTRY_ADDRESS: $CIC_REGISTRY_ADDRESS # supplied at contract-config after contract provisioning
|
DATABASE_HOST: $DATABASE_HOST
|
||||||
# ETH_PROVIDER: ${ETH_PROVIDER:-http://eth:8545}
|
DATABASE_PORT: $DATABASE_PORT
|
||||||
# BANCOR_DIR: ${BANCOR_DIR:-/usr/local/share/cic/bancor}
|
DATABASE_PASSWORD: $DATABASE_PASSWORD
|
||||||
# DATABASE_USER: ${DATABASE_USER:-grassroots}
|
DATABASE_NAME: $DATABASE_NAME_CIC_CACHE
|
||||||
# DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala} # this is is set at initdb see: postgres/initdb/create_db.sql
|
PGPASSWORD: $DATABASE_PASSWORD
|
||||||
# DATABASE_HOST: ${DATABASE_HOST:-postgres}
|
SERVER_PORT: 80
|
||||||
# DATABASE_PORT: ${DATABASE_PORT:-5432}
|
ports:
|
||||||
# DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache}
|
- ${HTTP_PORT_CIC_CACHE}:80
|
||||||
# DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
|
depends_on:
|
||||||
# DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
|
- postgres
|
||||||
# ETH_ABI_DIR: ${ETH_ABI_DIR:-/usr/local/share/cic/solidity/abi}
|
deploy:
|
||||||
# deploy:
|
restart_policy:
|
||||||
# restart_policy:
|
condition: on-failure
|
||||||
# condition: on-failure
|
command: "/root/start_uwsgi.sh"
|
||||||
# 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-eth-tasker:
|
cic-eth-tasker:
|
||||||
# image: grassrootseconomics:cic-eth-service
|
# image: grassrootseconomics:cic-eth-service
|
||||||
@ -224,7 +223,7 @@ services:
|
|||||||
./start_tasker.sh -q cic-eth -vv
|
./start_tasker.sh -q cic-eth -vv
|
||||||
# command: [/bin/sh, "./start_tasker.sh", -q, cic-eth, -vv ]
|
# command: [/bin/sh, "./start_tasker.sh", -q, cic-eth, -vv ]
|
||||||
|
|
||||||
cic-eth-manager-head:
|
cic-eth-manager-head:
|
||||||
build:
|
build:
|
||||||
context: apps/
|
context: apps/
|
||||||
dockerfile: cic-eth/docker/Dockerfile
|
dockerfile: cic-eth/docker/Dockerfile
|
||||||
|
Loading…
Reference in New Issue
Block a user