meta docker compose

This commit is contained in:
Blair Vanderlugt 2021-02-09 17:32:36 +00:00
parent 040fdf6e56
commit 8edb8c6dba
8 changed files with 63 additions and 32 deletions

View File

@ -2,6 +2,15 @@
## 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
```
docker-compose up
@ -20,6 +29,7 @@ docker-compose down -v
rebuild an images
```
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
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
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,
owner_fingerprint text not null,
hash char(64) not null unique,

View File

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

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