Compare commits

...

5 Commits

Author SHA1 Message Date
nolash
5c56e24490 Correct server host port defaults for cic-meta in dockerfile 2021-02-09 18:10:10 +01:00
7ff9b9d648 datatbase schema provisioning 2021-02-09 08:24:47 -08:00
d991dfdb0c docker compose and init scripts 2021-02-09 07:26:02 -08:00
Louis Holbrook
040fdf6e56 Merge branch 'lash/cic-eth-create-cli-fixes' into 'master'
Improve create account cli command

See merge request grassrootseconomics/cic-internal-integration!17
2021-02-08 22:38:18 +00:00
Louis Holbrook
9eb436d2f8 Improve create account cli command 2021-02-08 22:38:18 +00:00
10 changed files with 67 additions and 36 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

@@ -23,9 +23,9 @@ argparser = argparse.ArgumentParser()
argparser.add_argument('--no-register', dest='no_register', action='store_true', help='Do not register new account in on-chain accounts index')
argparser.add_argument('-c', type=str, default=default_config_dir, help='config file')
argparser.add_argument('-i', '--chain-spec', dest='i', type=str, help='chain spec')
argparser.add_argument('--redis-host', dest='redis_host', default='localhost', type=str, help='redis host to use for task submission')
argparser.add_argument('--redis-port', dest='redis_port', default=6379, type=int, help='redis host to use for task submission')
argparser.add_argument('--redis-db', dest='redis_db', default=0, type=int, help='redis db to use for task submission and callback')
argparser.add_argument('--redis-host', dest='redis_host', type=str, help='redis host to use for task submission')
argparser.add_argument('--redis-port', dest='redis_port', type=int, help='redis host to use for task submission')
argparser.add_argument('--redis-db', dest='redis_db', type=int, help='redis db to use for task submission and callback')
argparser.add_argument('--redis-host-callback', dest='redis_host_callback', default='localhost', type=str, help='redis host to use for callback')
argparser.add_argument('--redis-port-callback', dest='redis_port_callback', default=6379, type=int, help='redis port to use for callback')
argparser.add_argument('--timeout', default=20.0, type=float, help='Callback timeout')

View File

@@ -10,7 +10,7 @@ version = (
0,
10,
0,
'alpha.23',
'alpha.24',
)
version_object = semver.VersionInfo(

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