cic-cache
This commit is contained in:
@@ -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_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
|
||||
build-push-cic-cache:
|
||||
extends:
|
||||
- .py_build_push
|
||||
- .cic_cache_variables
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user