Merge branch 'bvander/cic-meta-docker-compose' into 'master'

meta docker compose

See merge request grassrootseconomics/cic-internal-integration!18
This commit is contained in:
Blair Vanderlugt 2021-02-09 17:32:36 +00:00
commit d636181479
8 changed files with 63 additions and 32 deletions

View File

@ -2,6 +2,15 @@
## Getting started ## Getting started
### Prepare the repo
This is stuff we need to put in makefile but for now...
File mounts and permisssions need to be set
```
chmod -R 755 scripts/initdb apps/cic-meta/scripts/initdb
````
start cluster start cluster
``` ```
docker-compose up docker-compose up
@ -20,6 +29,7 @@ docker-compose down -v
rebuild an images rebuild an images
``` ```
docker-compose up --build <service_name> docker-compose up --build <service_name>
`` ```
Deployment variables are writtend to service-configs/.env after everthing is up.
Deployment variables are writtend to service-configs/.env after everthing is up.`

View File

@ -16,7 +16,7 @@ COPY cic-meta/scripts/ scripts/
RUN alias tsc=node_modules/typescript/bin/tsc RUN alias tsc=node_modules/typescript/bin/tsc
COPY cic-meta/.config/ /usr/local/etc/cic-meta/ COPY cic-meta/.config/ /usr/local/etc/cic-meta/
COPY cic-meta/scripts/server/server.postgres.sql /usr/local/share/cic-meta/sql/server.sql # COPY cic-meta/scripts/server/initdb/server.postgres.sql /usr/local/share/cic-meta/sql/server.sql
COPY cic-meta/docker/db.sh ./db.sh COPY cic-meta/docker/db.sh ./db.sh
RUN chmod 755 ./db.sh RUN chmod 755 ./db.sh

View File

@ -0,0 +1,15 @@
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username grassroots --dbname cic_meta <<-EOSQL
create table if not exists store (
id serial primary key not null,
owner_fingerprint text not null,
hash char(64) not null unique,
content text not null
);
create index if not exists idx_fp on store ((lower(owner_fingerprint)));
EOSQL

View File

@ -1,4 +1,4 @@
create table if not exists store ( create table if not exists cic_meta.store (
id serial primary key not null, id serial primary key not null,
owner_fingerprint text not null, owner_fingerprint text not null,
hash char(64) not null unique, hash char(64) not null unique,

View File

@ -47,12 +47,13 @@ services:
image: postgres:12.5-alpine image: postgres:12.5-alpine
environment: environment:
POSTGRES_HOST_AUTH_METHOD: trust # for postgres user access w/o password. Obvioulsy not safe but allows easy elevated debugging. POSTGRES_HOST_AUTH_METHOD: trust # for postgres user access w/o password. Obvioulsy not safe but allows easy elevated debugging.
PGDATA: /tmp/cic/postgres # PGDATA: /tmp/cic/postgres
ports: ports:
- 5432 - 5432
volumes: 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 - ./scripts/initdb/create_db.sql:/docker-entrypoint-initdb.d/1-create_all_db.sql
- postgres-db:/tmp/cic/postgres - ./apps/cic-meta/scripts/initdb/postgresql.sh:/docker-entrypoint-initdb.d/2-init-cic-meta.sh
- postgres-db:/var/lib/postgresql/data
redis: redis:
image: redis:6.0.9-alpine image: redis:6.0.9-alpine
@ -394,31 +395,36 @@ services:
command: "/root/start_tasker.sh -q cic-notify" command: "/root/start_tasker.sh -q cic-notify"
# cic-meta-server: cic-meta-server:
# image: grassrootseconomics:cic-meta-server build:
# environment: context: apps/
# DATABASE_USER: $DATABASE_USER dockerfile: cic-meta/docker/Dockerfile
# DATABASE_HOST: $DATABASE_HOST environment:
# DATABASE_PORT: $DATABASE_PORT DATABASE_NAME: ${DATABASE_NAME:-cic_meta}
# DATABASE_PASSWORD: $DATABASE_PASSWORD DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
# DATABASE_NAME: $DATABASE_NAME_CIC_META DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
# DATABASE_ENGINE: $DATABASE_ENGINE DATABASE_USER: ${DATABASE_USER:-grassroots}
# DATABASE_DRIVER: $DATABASE_DRIVER DATABASE_HOST: ${DATABASE_HOST:-postgres}
# DATABASE_SCHEMA_SQL_PATH: $DATABASE_SCHEMA_SQL_PATH_CIC_META DATABASE_PORT: ${DATABASE_PORT:-5432}
# SERVER_PORT: 80 SERVER_HOST: ${SERVER_HOST:-localhost}
# PGP_PASSPHRASE: $PGP_PASSPHRASE SERVER_PORT: ${SERVER_HOST:-80}
# PGP_EXPORTS_DIR: $PGP_EXPORTS_DIR DATABASE_SCHEMA_SQL_PATH: ""
# PGP_PRIVATEKEY_FILE: $PGP_PRIVATEKEY_FILE PGP_EXPORTS_DIR: /tmp/src/cic-meta/tests/
# ports: PGP_PRIVATEKEY_FILE: privatekeys.asc
# - ${HTTP_PORT_CIC_META}:80 PGP_PASSPHRASE: merman
# depends_on: PGP_PUBLICKEY_TRUSTED_FILE: publickeys.asc
# - postgres PGP_PUBLICKEY_ACTIVE_FILE: publickeys.asc
# deploy: PGP_PUBLICKEY_ENCRYPT_FILE: publickeys.asc
# restart_policy: ports:
# condition: on-failure - ${HTTP_PORT_CIC_META:-63380}:${SERVER_PORT:-80}
# volumes: depends_on:
# - ${LOCAL_VOLUME_DIR:-/tmp/cic}/pgp:/tmp/cic/pgp - postgres
# command: "/root/start_server.sh -vv" deploy:
restart_policy:
condition: on-failure
volumes:
- ${LOCAL_VOLUME_DIR:-/tmp/cic}/pgp:/tmp/cic/pgp
command: "/root/start_server.sh -vv"
# cic-ussd-server: # cic-ussd-server:
# # image: grassrootseconomics:cic-ussd # # image: grassrootseconomics:cic-ussd

0
scripts/initdb/create_db.sql Normal file → Executable file
View File