Compare commits

...

26 Commits

Author SHA1 Message Date
85f26a4be4 cic-cache migrated 2021-02-16 17:49:16 -08:00
bc0450f39d point build at dockerfile 2021-02-12 08:21:58 -08:00
0345e2782f cic-cache 2021-02-12 08:19:14 -08:00
492faa87e5 add cache back in 2021-02-12 07:49:00 -08:00
39433d67da remove cic-cache submodule 2021-02-12 07:48:25 -08:00
d042ce0dcd Merge branch 'lash/correct-db-names' into 'master'
Correct db names and ports

See merge request grassrootseconomics/cic-internal-integration!25
2021-02-12 02:27:29 +00:00
Louis Holbrook
22586a04bf Correct db names and ports 2021-02-12 02:27:29 +00:00
449cd5830e keys in the wrong place 2021-02-11 07:33:13 -08:00
df3954fda5 Merge branch 'bvandernotify-build' into 'master'
cic-notify build

See merge request grassrootseconomics/cic-internal-integration!23
2021-02-11 15:24:34 +00:00
Louis Holbrook
6038d63501 Merge branch 'bvander/fix-mono-repo' into 'master'
Bvander/fix mono repo

See merge request grassrootseconomics/cic-internal-integration!21
2021-02-11 10:14:30 +00:00
d409306e5e Bvander/fix mono repo 2021-02-11 10:14:30 +00:00
Louis Holbrook
b1c3629549 Merge branch 'lash/rename-chainlib' into 'master'
Rename cic-tools to chainlib

See merge request grassrootseconomics/cic-internal-integration!24
2021-02-11 08:30:21 +00:00
nolash
7b13725c26 Rename cic-tools to chainlib 2021-02-11 09:20:01 +01:00
ed063f0522 builds up 2021-02-10 20:44:15 -08:00
98cdab4353 Merge branch 'philip/ussd-notify' into 'master'
Philip/ussd notify

See merge request grassrootseconomics/cic-internal-integration!11
2021-02-10 17:48:24 +00:00
6051b55b9a Philip/ussd notify 2021-02-10 17:48:24 +00:00
Louis Holbrook
9c9f41ed4c Merge branch 'lash/cic-eth-tasker-check-registry' into 'master'
Add cic-eth and auxiliary contract seeding script

See merge request grassrootseconomics/cic-internal-integration!16
2021-02-10 07:03:11 +00:00
Louis Holbrook
74e57b89ec Add cic-eth and auxiliary contract seeding script 2021-02-10 07:03:11 +00:00
1360f4d5f4 Merge branch 'lash/activate-websocket-services' into 'master'
bloxbergValidatorSetup: Expose all apis on websockets

See merge request grassrootseconomics/cic-internal-integration!20
2021-02-10 03:04:09 +00:00
6c2975b93f Merge branch 'bvanderlugt-master-patch-79072' into 'master'
Update apps/cic-meta/.gitlab-ci.yml, apps/cic-eth/.gitlab-ci.yml,...

See merge request grassrootseconomics/cic-internal-integration!19
2021-02-10 03:03:35 +00:00
81e9128446 Update apps/cic-meta/.gitlab-ci.yml, apps/cic-eth/.gitlab-ci.yml, apps/cic-notify/.gitlab-ci.yml, apps/cic-ussd/.gitlab-ci.yml, apps/contract-migration/.gitlab-ci.yml files 2021-02-10 03:03:35 +00:00
nolash
38781f1a4c Expose all apis on websockets 2021-02-09 22:37:20 +01:00
d636181479 Merge branch 'bvander/cic-meta-docker-compose' into 'master'
meta docker compose

See merge request grassrootseconomics/cic-internal-integration!18
2021-02-09 17:32:36 +00:00
8edb8c6dba meta docker compose 2021-02-09 17:32:36 +00: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
42 changed files with 472 additions and 189 deletions

View File

@@ -1,4 +0,0 @@
.git
.cache
.dot
**/doc

6
.gitmodules vendored
View File

@@ -1,6 +0,0 @@
[submodule "apps/cic-cache"]
path = apps/cic-cache
url = git@gitlab.com:grassrootseconomics/cic-cache.git
[submodule "apps/cic-meta"]
path = apps/cic-meta
url = git@gitlab.com:grassrootseconomics/cic-meta.git

View File

@@ -2,6 +2,22 @@
## Getting started
## Make some keys
```
docker build -t bloxie . && docker run -v "$(pwd)/keys:/root/keys" --rm -it -t bloxie account new --chain /root/bloxberg.json --keys-path /root/keys
```
### 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 +36,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

@@ -1,3 +1,6 @@
/validator/bloxbergData
/validator/bloxberg.log
keys/**/*
keys/*
!keys/Bloxberg
keys/Bloxberg/*
!keys/Bloxberg/UTC--2021-02-10T16-57-35Z--03512a62-5334-20cc-4e44-71156f33cff6

View File

@@ -17,7 +17,7 @@ COPY ./validator/bloxberg.json \
./validator/validator.toml \
/root/
COPY ./keys/ /root/keys/
COPY keys/ /root/keys/
# RUN chown -R parity:parity $HOME/ && \
# chmod -R 775 $HOME/ && \
@@ -25,4 +25,4 @@ COPY ./keys/ /root/keys/
# USER parity
ENTRYPOINT [ "parity" ]
CMD [ "--config", "/root/validator.toml", "--keys-path", "/root/keys/" ]
CMD [ "--config", "/root/validator.toml", "--keys-path", "/root/keys/", "--password", "/root/validator.pwd" ]

View File

@@ -4,7 +4,7 @@
The original bloxberg node config was kind of annoying so I am running it more like vanilla parity. This way you can pass command flags directly to parity.
## Make some keys
```
docker build -t bloxie . && docker run -v ${PWD}/keys:/root/keys --rm -it -t bloxie account new --chain /root/bloxberg.json --keys-path /root/keys
docker build -t bloxie . && docker run -v ${PWD}/keys:/root/keys --rm -it -t bloxie account new --chain /root/bloxberg.json --keys-path /root/keys --password /root/validator.pwd
```
## Enter the signer address and passwords in the config files

View File

@@ -0,0 +1 @@
{"id":"03512a62-5334-20cc-4e44-71156f33cff6","version":3,"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"dc388338c4d4e3203604aeb3d1c6bbfa"},"ciphertext":"8a945775b87089ce94537e011799f3abc1577c5dd1f3fbaebe1cd96dfdfc8b5a","kdf":"pbkdf2","kdfparams":{"c":10240,"dklen":32,"prf":"hmac-sha256","salt":"e8585836540caca01282381f5c1fe128e53b15b40f9d152fbc5a4f82a7967398"},"mac":"a7c7815e84a632ecf6d8f18c981bea73d50cd2e2a855a3e90477fc84ed14f906"},"address":"4f2a5902158c3969b245247f4154971d393301f2","name":"","meta":"{}"}

View File

@@ -7,7 +7,7 @@
"maximumUncleCount": 0,
"stepDuration": "5",
"validators" : {
"list": ["0x6bd4e51b3730576ddc4049654ef60ed7f7436cb5"]
"list": ["0x4f2a5902158c3969b245247f4154971d393301f2"]
}
}
}

View File

@@ -16,15 +16,17 @@ interface = "all"
[websockets]
disable = false
port = 8546
#apis = ["web3", "eth", "net", "personal", "parity", "parity_set", "traces", "rpc", "parity_accounts"]
apis = ["all"]
interface = "all"
origins = ["none"]
origins = ["*"]
[account]
password = ["/root/validator.pwd"]
[mining]
#CHANGE ENGINE SIGNER TO VALIDATOR ADDRESS
engine_signer = "0x6bd4e51b3730576ddc4049654ef60ed7f7436cb5"
engine_signer = "0x4f2a5902158c3969b245247f4154971d393301f2"
reseal_on_txs = "none"
force_sealing = true
min_gas_price = 1000000

View File

@@ -3,20 +3,19 @@
APP_NAME: cic-eth
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
.this_changes_target:
.cic_eth_changes_target:
rules:
- changes:
- $CONTEXT/$APP_NAME/*
build-mr-cic-eth:
extends:
- .this_changes_target
- .cic_eth_changes_target
- .py_build_merge_request
- .cic_eth_variables
build-push-cic-eth:
extends:
- .this_changes_target
- .py_build_push
- .cic_eth_variables

1
apps/cic-eth/README.md Normal file
View File

@@ -0,0 +1 @@
# CIC-ETH

View File

@@ -35,6 +35,10 @@ def unpack_signed_raw_tx(tx_raw_bytes, chain_id):
if chain_id != 0:
v = int.from_bytes(d[6], 'big')
vb = v - (chain_id * 2) - 35
while len(d[7]) < 32:
d[7] = b'\x00' + d[7]
while len(d[8]) < 32:
d[8] = b'\x00' + d[8]
s = b''.join([d[7], d[8], bytes([vb])])
so = KeyAPI.Signature(signature_bytes=s)

View File

@@ -557,27 +557,26 @@ def get_upcoming_tx(status=StatusEnum.READYSEND, recipient=None, before=None, ch
:rtype: dict, with transaction hash as key, signed raw transaction as value
"""
session = SessionBase.create_session()
q = session.query(
q_outer = session.query(
TxCache.sender,
func.min(Otx.nonce).label('nonce'),
)
q = q.join(TxCache)
q = q.join(Lock, isouter=True)
q = q.filter(or_(Lock.flags==None, Lock.flags.op('&')(LockEnum.SEND.value)==0))
q_outer = q_outer.join(TxCache)
q_outer = q_outer.join(Lock, isouter=True)
q_outer = q_outer.filter(or_(Lock.flags==None, Lock.flags.op('&')(LockEnum.SEND.value)==0))
if status >= StatusEnum.SENT:
raise ValueError('not a valid non-final tx value: {}'.format(s))
q = q.filter(Otx.status==status)
q_outer = q_outer.filter(Otx.status==status.value)
if recipient != None:
q = q.filter(TxCache.recipient==recipient)
q_outer = q_outer.filter(TxCache.recipient==recipient)
q = q.group_by(TxCache.sender)
q_outer = q_outer.group_by(TxCache.sender)
txs = {}
results = q.all()
for r in results:
for r in q_outer.all():
q = session.query(Otx)
q = q.join(TxCache)
q = q.filter(TxCache.sender==r.sender)
@@ -587,7 +586,6 @@ def get_upcoming_tx(status=StatusEnum.READYSEND, recipient=None, before=None, ch
q = q.filter(TxCache.date_checked<before)
q = q.order_by(TxCache.date_created.desc())
o = q.first()
# TODO: audit; should this be possible if a row is found in the initial query? If not, at a minimum log error.
@@ -602,7 +600,6 @@ def get_upcoming_tx(status=StatusEnum.READYSEND, recipient=None, before=None, ch
q = q.filter(TxCache.otx_id==o.id)
o = q.first()
logg.debug('oooo {}'.format(o))
o.date_checked = datetime.datetime.now()
session.add(o)
session.commit()

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')
@@ -51,27 +51,34 @@ args_override = {
config.dict_override(args_override, 'cli')
celery_app = celery.Celery(broker=config.get('CELERY_BROKER_URL'), backend=config.get('CELERY_RESULT_URL'))
redis_host = config.get('REDIS_HOST')
redis_port = config.get('REDIS_PORT')
redis_db = config.get('REDIS_DB')
redis_channel = str(uuid.uuid4())
r = redis.Redis(redis_host, redis_port, redis_db)
ps = r.pubsub()
ps.subscribe(redis_channel)
ps.get_message()
api = Api(
config.get('CIC_CHAIN_SPEC'),
queue=args.q,
callback_param='{}:{}:{}:{}'.format(args.redis_host_callback, args.redis_port_callback, redis_db, redis_channel),
callback_task='cic_eth.callbacks.redis.redis',
callback_queue=args.q,
)
def main():
redis_host = config.get('REDIS_HOST')
redis_port = config.get('REDIS_PORT')
redis_db = config.get('REDIS_DB')
redis_channel = str(uuid.uuid4())
r = redis.Redis(redis_host, redis_port, redis_db)
register = not args.no_register
logg.debug('register {}'.format(register))
t = api.create_account(register=register)
ps = r.pubsub()
ps.subscribe(redis_channel)
ps.get_message()
ps.get_message()
m = ps.get_message(timeout=args.timeout)
print(json.loads(m['data']))
api = Api(
config.get('CIC_CHAIN_SPEC'),
queue=args.q,
callback_param='{}:{}:{}:{}'.format(args.redis_host_callback, args.redis_port_callback, redis_db, redis_channel),
callback_task='cic_eth.callbacks.redis.redis',
callback_queue=args.q,
)
register = not args.no_register
logg.debug('register {}'.format(register))
t = api.create_account(register=register)
ps.get_message()
m = ps.get_message(timeout=args.timeout)
print(json.loads(m['data']))
if __name__ == '__main__':
main()

View File

@@ -68,7 +68,7 @@ app = celery.Celery(backend=config.get('CELERY_RESULT_URL'), broker=config.get(
queue = args.q
dsn = dsn_from_config(config)
SessionBase.connect(dsn)
SessionBase.connect(dsn, debug=config.true('DATABASE_DEBUG'))
re_websocket = re.compile('^wss?://')

View File

@@ -211,6 +211,11 @@ def main():
chain_registry = ChainRegistry(chain_spec)
CICRegistry.add_chain_registry(chain_registry, True)
try:
CICRegistry.get_contract(chain_spec, 'CICRegistry')
except Exception as e:
logg.exception('Eek, registry failure is baaad juju {}'.format(e))
sys.exit(1)
if config.get('ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER') != None:
CICRegistry.add_role(chain_spec, config.get('ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER'), 'AccountRegistry', True)

View File

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

View File

@@ -41,3 +41,8 @@ COPY cic-eth/tests/ tests/
COPY cic-eth/config/ /usr/local/etc/cic-eth/
COPY cic-eth/cic_eth/db/migrations/ /usr/local/share/cic-eth/alembic/
COPY cic-eth/crypto_dev_signer_config/ /usr/local/etc/crypto-dev-signer/
RUN apt-get install -y git && \
git clone https://gitlab.com/grassrootseconomics/cic-contracts.git && \
mkdir -p /usr/local/share/cic/solidity && \
cp -R cic-contracts/abis /usr/local/share/cic/solidity/abi

View File

@@ -1,4 +1,6 @@
#!/bin/bash
set -e
>&2 echo executing database migration
migrate.py -c /usr/local/etc/cic-eth --migrations-dir /usr/local/share/cic-eth/alembic -vv
set +e

View File

@@ -1,5 +1,6 @@
#!/bin/bash
set -e
. ./db.sh
# set CONFINI_ENV_PREFIX to override the env prefix to override env vars
@@ -27,3 +28,4 @@ while true; do
sleep 15;
done
set +e

View File

@@ -4,20 +4,19 @@
APP_NAME: cic-meta
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
.this_changes_target:
.cic_meta_changes_target:
rules:
- changes:
- $CONTEXT/$APP_NAME/*
build-mr-cic-meta:
extends:
- .this_changes_target
- .cic_meta_changes_target
- .py_build_merge_request
- .cic_meta_variables
build-push-cic-meta:
extends:
- .this_changes_target
- .py_build_push
- .cic_meta_variables

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

@@ -3,20 +3,19 @@
APP_NAME: cic-notify
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
.this_changes_target:
.cic_notify_changes_target:
rules:
- changes:
- $CONTEXT/$APP_NAME/*
build-mr-cic-notify:
extends:
- .this_changes_target
- .cic_notify_changes_target
- .py_build_merge_request
- .cic_notify_variables
build-push-cic-notify:
extends:
- .this_changes_target
- .py_build_push
- .cic_notify_variables

View File

@@ -14,7 +14,9 @@ RUN pip install -r $root_requirement_file $pip_extra_index_url_flag
COPY cic-notify/setup.cfg \
cic-notify/setup.py \
./
COPY cic-notify/cic_notify/ ./cic_notify/
COPY cic-notify/requirements.txt \
cic-notify/test_requirements.txt \
./

View File

@@ -1,13 +0,0 @@
FROM grassrootseconomics:cic-notify
#FROM python:3.8.6-alpine
#RUN apk update && \
# apk add gnupg libpq
#COPY --from=0 /usr/local/ /usr/local/
#COPY --from=0 /root/ /root/
#RUN apk add bash
WORKDIR /root

View File

@@ -3,21 +3,20 @@
APP_NAME: cic-ussd
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
.this_changes_target:
.cic_ussd_changes_target:
rules:
- changes:
- $CONTEXT/$APP_NAME/*
build-mr-cic-ussd:
extends:
- .this_changes_target
- .cic_ussd_changes_target
- .py_build_merge_request
- .cic_ussd_variables
build-push-cic-ussd:
extends:
- .this_changes_target
- .py_build_push
- .cic_ussd_variables

View File

@@ -39,6 +39,8 @@ COPY cic-ussd/docker/db.sh \
/root/
RUN chmod +x /root/*.sh
RUN cd cic-ussd && \
pip install $pip_extra_index_url_flag .
# copy config and migration files to definitive file so they can be referenced in path definitions for running scripts

View File

@@ -1,5 +1,5 @@
#!/bin/bash
. ./db.sh
. /root/db.sh
/usr/local/bin/cic-ussd-tasker -vv "$@"

View File

@@ -1,5 +1,5 @@
#!/bin/bash
. ./db.sh
. /root/db.sh
/usr/local/bin/uwsgi --wsgi-file /usr/local/lib/python3.8/site-packages/cic_ussd/runnable/server.py --http :80 --pyargv "-vv"
/usr/local/bin/uwsgi --wsgi-file /usr/local/lib/python3.8/site-packages/cic_ussd/runnable/server.py --http :9000 --pyargv "-vv"

View File

@@ -6,10 +6,10 @@ betterpath==0.2.2
billiard==3.6.3.0
celery==4.4.7
cffi==1.14.3
cic-eth~=0.10.0a9
cic-eth~=0.10.0a22
cic-notify==0.3.1
click==7.1.2
confini==0.3.5
confini~=0.3.6a1
cryptography==3.2.1
faker==4.17.1
iniconfig==1.1.1

View File

@@ -3,19 +3,18 @@
APP_NAME: contract-migration
DOCKERFILE_PATH: $APP_NAME/docker/Dockerfile
.this_changes_target:
.contract_migration_changes_target:
rules:
- changes:
- $CONTEXT/$APP_NAME/*
build-mr-contract-migration:
extends:
- .this_changes_target
- .contract_migration_changes_target
- .py_build_merge_request
- .contract_migration_variables
build-push-contract-migration:
extends:
- .this_changes_target
- .py_build_push
- .contract_migration_variables

View File

@@ -10,7 +10,7 @@ RUN apk update && \
WORKDIR /usr/src
ARG cic_config_commit=6c5bda473d3806844696d5716845d51416ed1b47
ARG cic_config_commit=35c69ba75f00c8147150acf325565d5391cf25bf
ARG cic_config_url=https://gitlab.com/grassrootseconomics/cic-config.git/
RUN echo Install confini schema files && \
git clone --depth 1 $cic_config_url cic-config && \
@@ -106,7 +106,7 @@ RUN cd cic-bancor/python && \
pip install --extra-index-url $pip_extra_index_url .
RUN echo installing common python tooling
ARG cic_python_commit=a684ed3450a31f349ce1d860dfe3b8607f15bbe2
ARG cic_python_commit=beecee783ceac2ea0fa711f888ce4c82f1a81490
ARG cic_python_url=https://gitlab.com/grassrootseconomics/cic-python.git/
RUN echo Install sum of python dependencies across all components && \
git clone --depth 1 $cic_python_url cic-python && \
@@ -132,11 +132,11 @@ RUN pip install --extra-index-url $pip_extra_index_url erc20-approval-escrow==$e
ARG erc20_single_shot_faucet_version=0.2.0a5
RUN pip install --extra-index-url $pip_extra_index_url erc20-single-shot-faucet==$erc20_single_shot_faucet_version
ARG eth_address_index_version==0.1.0a6
ARG eth_address_index_version==0.1.0a8
RUN pip install --extra-index-url $pip_extra_index_url eth-address-index==$eth_address_index_version
RUN echo Install cic specific python packages
ARG cic_registry_version=0.5.3a10
ARG cic_registry_version=0.5.3a11
RUN pip install --extra-index-url $pip_extra_index_url cic-registry==$cic_registry_version
RUN echo Install misc helpers
@@ -157,6 +157,9 @@ RUN chmod +x ./wait-for-it.sh
# COPY contract-migration/.env_dockercompose_template .env_dockercompose_template
COPY contract-migration/reset.sh reset.sh
COPY contract-migration/from_env.sh from_env.sh
COPY contract-migration/seed_cic_eth.sh seed_cic_eth.sh
COPY contract-migration/sarafu_declaration.json sarafu_declaration.json
COPY contract-migration/keystore keystore
LABEL version="4"

View File

@@ -0,0 +1,9 @@
#!/bin/bash
while read l; do
e=${!l}
if [ ! -z $e ]; then
>&2 echo "saving env var $l = $e"
echo "$l=$e"
fi
done

View File

@@ -1,5 +1,11 @@
#!/bin/bash
set -a
DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C
DEV_ETH_ACCOUNT_RESERVE_MINTER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER}
DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER=${DEV_ETH_ACCOUNT_RESERVE_MINTER:-$DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER}
DEV_ETH_RESERVE_AMOUNT=${DEV_ETH_RESERVE_AMOUNT:-""10000000000000000000000000000000000}
keystore_file=$(realpath ./keystore/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c)
echo "environment:"
@@ -12,7 +18,8 @@ echo \n
# define these parameters at runtime
# pushd /usr/src
#!/bin/sh
init_level_file=${CIC_DATA_DIR}/.init
echo -n 1 > $init_level_file
# Abort on any error (including if wait-for-it fails).
set -e
@@ -22,8 +29,7 @@ if [[ -n "${ETH_PROVIDER}" ]]; then
echo "waiting for ${ETH_PROVIDER}..."
./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}"
#DEV_ETH_RESERVE_ADDRESS=`giftable-token-deploy -p $ETH_PROVIDER -o $DEV_ETH_ACCOUNT_RESERVE_OWNER -m $DEV_ETH_ACCOUNT_RESERVE_MINTER $DEV_ETH_RESERVE_AMOUNT`
DEV_ETH_RESERVE_ADDRESS=`giftable-token-deploy -p $ETH_PROVIDER -y $keystore_file -i $CIC_CHAIN_SPEC --minter $DEV_ETH_ACCOUNT_RESERVE_MINTER -v -w --name "Sarafu" --symbol "SRF" $DEV_ETH_RESERVE_AMOUNT`
DEV_ETH_RESERVE_ADDRESS=`giftable-token-deploy -p $ETH_PROVIDER -y $keystore_file -i $CIC_CHAIN_SPEC --account $DEV_ETH_ACCOUNT_RESERVE_MINTER --minter $DEV_ETH_ACCOUNT_RESERVE_MINTER -v -w --name "Sarafu" --symbol "SRF" $DEV_ETH_RESERVE_AMOUNT`
#BANCOR_REGISTRY_ADDRESS=`cic-bancor-deploy --bancor-dir /usr/local/share/cic/bancor -z $DEV_ETH_RESERVE_ADDRESS -p $ETH_PROVIDER -o $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER`
@@ -33,6 +39,12 @@ if [[ -n "${ETH_PROVIDER}" ]]; then
cic-registry-set -y $keystore_file -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -k CICRegistry -p $ETH_PROVIDER $CIC_REGISTRY_ADDRESS -vv
#cic-registry-set -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -k BancorRegistry -p $ETH_PROVIDER $BANCOR_REGISTRY_ADDRESS -vv
cic-registry-set -y $keystore_file -r $CIC_REGISTRY_ADDRESS -i $CIC_CHAIN_SPEC -k AccountRegistry -p $ETH_PROVIDER $CIC_ACCOUNTS_INDEX_ADDRESS -vv
# Deploy address declarator registry
>&2 echo "deploy address declarator contract"
declarator_description=0x546869732069732074686520434943206e6574776f726b000000000000000000
CIC_DECLARATOR_ADDRESS=`eth-address-declarator-deploy -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w -v $declarator_description`
else
echo "\$ETH_PROVIDER not set!"
exit 1
@@ -44,12 +56,18 @@ mkdir -p $CIC_DATA_DIR
cat << EOF > $CIC_DATA_DIR/.env
export DEV_ETH_RESERVE_ADDRESS=$DEV_ETH_RESERVE_ADDRESS
export DEV_ETH_RESERVE_AMOUNT=$DEV_ETH_RESERVE_AMOUNT
export DEV_ETH_ACCOUNTS_INDEX_ADDRESS=$DEV_ETH_ACCOUNTS_INDEX_ADDRESS
export DEV_ETH_ACCOUNTS_INDEX_ADDRESS=$CIC_ACCOUNTS_INDEX_ADDRESS
export BANCOR_REGISTRY_ADDRESS=$BANCOR_REGISTRY_ADDRESS
export CIC_REGISTRY_ADDRESS=$CIC_REGISTRY_ADDRESS
EOF
cat $CIC_DATA_DIR/envlist | bash from_env.sh > $CIC_DATA_DIR/.env_all
# popd
set +a
set +e
echo -n 2 > $init_level_file
exec "$@"

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,148 @@
#!/bin/bash
# defaults
initlevel=`cat ${CIC_DATA_DIR}/.init`
echo $inilevel
if [ $initlevel -lt 2 ]; then
>&2 echo "initlevel too low $initlevel"
exit 1
fi
source ${CIC_DATA_DIR}/.env
source ${CIC_DATA_DIR}/.env_all
DEV_PIP_EXTRA_INDEX_URL=${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net:8433}
DEV_DATABASE_NAME_CIC_ETH=${DEV_DATABASE_NAME_CIC_ETH:-"cic-eth"}
CIC_DATA_DIR=${CIC_DATA_DIR:-/tmp/cic}
# Debug flag
#debug='-v'
DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER=0xEb3907eCad74a0013c259D5874AE7f22DcBcC95C
keystore_file=./keystore/UTC--2021-01-08T17-18-44.521011372Z--eb3907ecad74a0013c259d5874ae7f22dcbcc95c
debug='-vv'
abi_dir=${ETH_ABI_DIR:-/usr/local/share/cic/solidity/abi}
gas_amount=100000000000000000000000
token_amount=${gas_amount}
faucet_amount=1000000000
env_out_file=${CIC_DATA_DIR}/.env_seed
init_level_file=${CIC_DATA_DIR}/.init
truncate $env_out_file -s 0
set -e
set -a
pip install --extra-index-url $DEV_PIP_EXTRA_INDEX_URL cic-eth==0.10.0a25 chainlib==0.0.1a4
>&2 echo "create account for gas gifter"
old_gas_provider=$DEV_ETH_ACCOUNT_GAS_PROVIDER
DEV_ETH_ACCOUNT_GAS_GIFTER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register`
echo DEV_ETH_ACCOUNT_GAS_GIFTER=$DEV_ETH_ACCOUNT_GAS_GIFTER >> $env_out_file
cic-eth-tag GAS_GIFTER $DEV_ETH_ACCOUNT_GAS_GIFTER
>&2 echo "create account for sarafu gifter"
DEV_ETH_ACCOUNT_SARAFU_GIFTER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register`
echo DEV_ETH_ACCOUNT_SARAFU_GIFTER=$DEV_ETH_ACCOUNT_SARAFU_GIFTER >> $env_out_file
cic-eth-tag SARAFU_GIFTER $DEV_ETH_ACCOUNT_SARAFU_GIFTER
>&2 echo "create account for approval escrow owner"
DEV_ETH_ACCOUNT_TRANSFER_AUTHORIZATION_OWNER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register`
echo DEV_ETH_ACCOUNT_TRANSFER_AUTHORIZATION_OWNER=$DEV_ETH_ACCOUNT_TRANSFER_AUTHORIZATION_OWNER >> $env_out_file
cic-eth-tag TRANSFER_AUTHORIZATION_OWNER $DEV_ETH_ACCOUNT_TRANSFER_AUTHORIZATION_OWNER
>&2 echo "create account for faucet owner"
DEV_ETH_ACCOUNT_FAUCET_OWNER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register`
echo DEV_ETH_ACCOUNT_GAS_GIFTER=$DEV_ETH_ACCOUNT_FAUCET_OWNER >> $env_out_file
cic-eth-tag FAUCET_GIFTER $DEV_ETH_ACCOUNT_FAUCET_OWNER
>&2 echo "create account for accounts index owner"
DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER=`cic-eth-create $debug --redis-host-callback=$REDIS_HOST --redis-port-callback=$REDIS_PORT --no-register`
echo DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER=$DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER >> $env_out_file
cic-eth-tag ACCOUNTS_INDEX_WRITER $DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER
# Transfer gas to custodial gas provider adddress
>&2 echo gift gas to gas gifter
>&2 eth-gas -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $DEV_ETH_ACCOUNT_GAS_GIFTER $gas_amount
>&2 echo gift gas to sarafu token owner
>&2 eth-gas -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $DEV_ETH_ACCOUNT_SARAFU_GIFTER $gas_amount
>&2 echo gift gas to account index owner
>&2 eth-gas -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER $gas_amount
# Send token to token creator
>&2 echo "gift tokens to sarafu owner"
>&2 giftable-token-gift -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_ETH_RESERVE_ADDRESS --recipient $DEV_ETH_ACCOUNT_SARAFU_GIFTER -w $debug $token_amount
# Send token to token gifter
>&2 echo "gift tokens to keystore address"
>&2 giftable-token-gift -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -a $DEV_ETH_RESERVE_ADDRESS --recipient $DEV_ETH_ACCOUNT_CONTRACT_DEPLOYER -w $debug $token_amount
>&2 echo "set sarafu token to reserve token (temporarily while bancor contracts are not connected)"
echo DEV_ETH_SARAFU_TOKEN_ADDRESS=$DEV_ETH_RESERVE_ADDRESS >> $env_out_file
export DEV_ETH_SARAFU_TOKEN_ADDRESS=$DEV_ETH_RESERVE_ADDRESS
# Transfer tokens to gifter address
>&2 echo "transfer sarafu tokens to token gifter address"
>&2 eth-transfer -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER --token-address $DEV_ETH_SARAFU_TOKEN_ADDRESS --abi-dir $abi_dir -w $debug $DEV_ETH_ACCOUNT_SARAFU_GIFTER ${token_amount:0:-1}
>&2 echo "deploy transfer authorization contract"
CIC_TRANSFER_AUTHORIZATION_ADDRESS=`erc20-approval-escrow-deploy -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER --approver $DEV_ETH_ACCOUNT_TRANSFER_AUTHORIZATION_OWNER -w $debug`
echo CIC_APPROVAL_ESCROW_ADDRESS=$CIC_TRANSFER_AUTHORIZATION_ADDRESS >> $env_out_file
export CIC_TRANSFER_AUTHORIZATION_ADDRESS=$CIC_TRANSFER_AUTHORIZATION_ADDRESS
# Register transfer approval contract
>&2 echo "add transfer approval request contract to registry"
>&2 cic-registry-set -y $keystore_file -r $CIC_REGISTRY_ADDRESS -k TransferApproval -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $CIC_TRANSFER_AUTHORIZATION_ADDRESS
# Deploy one-time token faucet for newly created token
>&2 echo "deploy faucet"
DEV_ETH_SARAFU_FAUCET_ADDRESS=`erc20-single-shot-faucet-deploy -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER --token-address $DEV_ETH_SARAFU_TOKEN_ADDRESS --editor $DEV_ETH_ACCOUNT_FAUCET_OWNER --set-amount $faucet_amount -w $debug`
echo DEV_ETH_SARAFU_FAUCET_ADDRESS=$DEV_ETH_SARAFU_FAUCET_ADDRESS >> $env_out_file
export DEV_ETH_SARAFU_FAUCET_ADDRESS=$DEV_ETH_SARAFU_FAUCET_ADDRESS
# Transfer tokens to faucet contract
>&2 echo "transfer tokens to faucet contract"
>&2 eth-transfer -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER --token-address $DEV_ETH_SARAFU_TOKEN_ADDRESS --abi-dir $abi_dir -w $debug $DEV_ETH_SARAFU_FAUCET_ADDRESS ${token_amount:0:-1}
# Register faucet entry
>&2 echo "register faucet contract in registry"
>&2 cic-registry-set -y $keystore_file -r $CIC_REGISTRY_ADDRESS -k Faucet -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug $DEV_ETH_SARAFU_FAUCET_ADDRESS
>&2 echo "deploy token symbol index contract"
CIC_TOKEN_INDEX_ADDRESS=`eth-token-index-deploy -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -w $debug`
echo CIC_TOKEN_INDEX_ADDRESS=$CIC_TOKEN_INDEX_ADDRESS >> $env_out_file
export CIC_TOKEN_INDEX_ADDRESS=$CIC_TOKEN_INDEX_ADDRESS
>&2 eth-token-index-add -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_TOKEN_INDEX_ADDRESS -w $debug $DEV_ETH_SARAFU_TOKEN_ADDRESS
# Register token registry
>&2 echo "register token index in registry"
>&2 cic-registry-set -y $keystore_file -r $CIC_REGISTRY_ADDRESS -k TokenRegistry -i $CIC_CHAIN_SPEC -w -p $ETH_PROVIDER $CIC_TOKEN_INDEX_ADDRESS
>&2 echo "add declarations for sarafu token"
token_description_one=`sha256sum sarafu_declaration.json | awk '{ print $1; }'`
token_description_two=0x54686973206973207468652053617261667520746f6b656e0000000000000000
>&2 eth-address-declarator-add -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_DECLARATOR_ADDRESS -w $debug $DEV_ETH_SARAFU_TOKEN_ADDRESS $token_description_one
>&2 eth-address-declarator-add -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_DECLARATOR_ADDRESS -w $debug $DEV_ETH_SARAFU_TOKEN_ADDRESS $token_description_two
# Register address declarator
>&2 echo "registry address declarator to registry"
>&2 cic-registry-set -y $keystore_file -r $CIC_REGISTRY_ADDRESS -k AddressDeclarator -i $CIC_CHAIN_SPEC -w -p $ETH_PROVIDER $CIC_DECLARATOR_ADDRESS
# We're done with the registry at this point, seal it off
>&2 echo "seal registry contract"
>&2 cic-registry-seal -y $keystore_file -i $CIC_CHAIN_SPEC -r $CIC_REGISTRY_ADDRESS -w -p $ETH_PROVIDER
# Add accounts index writer with key from keystore
>&2 echo "add keystore account $keystore_file to accounts index writers"
>&2 eth-accounts-index-add -y $keystore_file -i $CIC_CHAIN_SPEC -p $ETH_PROVIDER -r $CIC_ACCOUNTS_INDEX_ADDRESS --writer $DEV_ETH_ACCOUNT_ACCOUNTS_INDEX_WRITER -w $debug
echo -n 0 > $init_level_file
set +a
set +e

View File

@@ -35,11 +35,11 @@ services:
context: apps/bloxbergValidatorSetup
restart: unless-stopped
ports:
- ${HTTP_PORT_ETH:-8545}
- 8546
- ${DEV_ETH_PORT_HTTP:-63545}:8545
- ${DEV_ETH_PORT_WS-63546}:8546
- 30303
volumes:
#- ./keys:/root/keys # stores the signing key locally
- ./apps/bloxbergValidatorSetup/keys:/root/keys # stores the signing key locally
- bloxberg-data:/root/.local/share/io.parity.ethereum/
# See contents of /initdb/create_db.sql for app user, password and databases
@@ -47,17 +47,18 @@ 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
- ${DEV_POSTGRES_PORT:-63432}: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
ports:
- ${HTTP_PORT_REDIS:-6379}
- ${DEV_REDIS_PORT:-63379}:6379
command: "--loglevel verbose"
bee:
@@ -67,8 +68,8 @@ services:
BEE_NETWORK_ID: ${BEE_NETWORK_ID:-313}
BEE_PASSWORD: ${BEE_PASSWORD:-password}
ports:
- 1633
- 1635
- ${DEV_BEE_PORT:-63633}:1633
- ${DEV_BEE_PORT_DEBUG:-63635}:1635
command: "start --swap-enable=false --standalone"
volumes:
- bee-data:/tmp/cic/bee
@@ -84,12 +85,50 @@ services:
ETH_PROVIDER_HOST: eth
ETH_PROVIDER_PORT: 8545
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996}
CIC_DATA_DIR: ${CIC_DATA_DIR:-/tmp/cic/config}
command: ["./reset.sh"]
depends_on:
- eth
volumes:
- contract-config:/tmp/cic/config
seed-cic-eth:
build:
context: apps/
dockerfile: contract-migration/docker/Dockerfile
environment:
# ETH_PROVIDER should be broken out into host/port but cic-eth expects this
ETH_PROVIDER: http://eth:8545
# And these two are for wait-for-it (could parse this)
ETH_PROVIDER_HOST: eth
ETH_PROVIDER_PORT: 8545
CIC_CHAIN_SPEC: ${CIC_CHAIN_SPEC:-Bloxberg:8996}
CIC_DATA_DIR: ${CIC_DATA_DIR:-/tmp/cic/config}
DATABASE_HOST: ${DATABASE_HOST:-postgres}
DATABASE_PORT: ${DATABASE_PORT:-5432}
DATABASE_NAME: ${DEV_DATABASE_NAME_CIC_ETH:-cic_eth}
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgresql}
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
DATABASE_USER: ${DATABASE_USER:-postgres}
REDIS_HOST: ${REDIS_HOST:-redis}
REDIS_PORT: ${REDIS_PORT:-6379}
REDIS_DB: ${REDIS_DB:-0}
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis:6379}
CELERY_RESULT_URL: ${CELERY_RESULT_URL:-redis://redis:6379}
DEV_PIP_EXTRA_INDEX_URL: ${DEV_PIP_EXTRA_INDEX_URL:-https://pip.grassrootseconomics.net:8433}
command: ["./seed_cic_eth.sh"]
deploy:
restart_policy:
condition: on-failure
depends_on:
- eth
- postgres
- redis
- cic-eth-tasker
volumes:
- contract-config:/tmp/cic/config
# cic-cache-tracker:
# # image: registry.gitlab.com/grassrootseconomics/cic-cache:master-latest
# build: apps/cic-cache
@@ -154,7 +193,7 @@ services:
DATABASE_USER: ${DATABASE_USER:-grassroots}
DATABASE_HOST: ${DATABASE_HOST:-postgres}
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache}
DATABASE_NAME: ${DATABASE_NAME_CIC_ETH:-cic_eth}
DATABASE_PORT: ${DATABASE_PORT:-5432}
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
@@ -194,7 +233,7 @@ services:
DATABASE_USER: ${DATABASE_USER:-grassroots}
DATABASE_HOST: ${DATABASE_HOST:-postgres}
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache}
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_eth}
DATABASE_PORT: ${DATABASE_PORT:-5432}
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
@@ -230,7 +269,7 @@ services:
DATABASE_USER: ${DATABASE_USER:-grassroots}
DATABASE_HOST: ${DATABASE_HOST:-postgres}
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache}
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_eth}
DATABASE_PORT: ${DATABASE_PORT:-5432}
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
@@ -266,7 +305,7 @@ services:
DATABASE_USER: ${DATABASE_USER:-grassroots}
DATABASE_HOST: ${DATABASE_HOST:-postgres}
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache}
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_eth}
DATABASE_PORT: ${DATABASE_PORT:-5432}
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
@@ -276,6 +315,7 @@ services:
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis}
CELERY_RESULT_URL: ${CELERY_RESULT_URL:-redis://redis}
TASKS_TRANSFER_CALLBACKS: $TASKS_TRANSFER_CALLBACKS
DATABASE_DEBUG: ${DATABASE_DEBUG:-true}
depends_on:
- eth
@@ -304,7 +344,7 @@ services:
DATABASE_USER: ${DATABASE_USER:-grassroots}
DATABASE_HOST: ${DATABASE_HOST:-postgres}
DATABASE_PASSWORD: ${DATABASE_PASSWORD:-tralala}
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_cache}
DATABASE_NAME: ${DATABASE_NAME_CIC_CACHE:-cic_eth}
DATABASE_PORT: ${DATABASE_PORT:-5432}
DATABASE_ENGINE: ${DATABASE_ENGINE:-postgres}
DATABASE_DRIVER: ${DATABASE_DRIVER:-psycopg2}
@@ -314,6 +354,7 @@ services:
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis}
CELERY_RESULT_URL: ${CELERY_RESULT_URL:-redis://redis}
TASKS_TRANSFER_CALLBACKS: $TASKS_TRANSFER_CALLBACKS
CIC_TX_RETRY_DELAY: 15
depends_on:
- eth
- postgres
@@ -340,11 +381,13 @@ services:
CIC_CHAIN_SPEC: $CIC_CHAIN_SPEC
CELERY_BROKER_URL: $CELERY_BROKER_URL
CELERY_RESULT_URL: $CELERY_RESULT_URL
SERVER_PORT: 80
SERVER_PORT: 8000
depends_on:
- eth
- postgres
- redis
ports:
- ${HTTP_PORT_CIC_ETH:-63314}:8000
deploy:
restart_policy:
condition: on-failure
@@ -370,7 +413,9 @@ services:
cic-notify-tasker:
image: grassrootseconomics:cic-notify-service
build:
context: apps/
dockerfile: cic-notify/docker/Dockerfile
environment:
DATABASE_USER: ${DATABASE_USER:-grassroots}
DATABASE_HOST: ${DATABASE_HOST:-postgres}
@@ -394,75 +439,80 @@ 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: localhost
SERVER_PORT: 8000
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}:8000
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
# build:
# context: apps/
# dockerfile: cic-ussd/docker/Dockerfile
# environment:
# DATABASE_USER: grassroots
# DATABASE_HOST: postgres
# DATABASE_PORT: 5432
# DATABASE_PASSWORD: tralala
# DATABASE_NAME: cic_ussd
# DATABASE_ENGINE: postgresql
# DATABASE_DRIVER: psycopg2
# SERVER_PORT: 80
# ports:
# - 80:8082
# depends_on:
# - postgres
# - redis
# deploy:
# restart_policy:
# condition: on-failure
# command: "/root/start_uwsgi.sh"
#
# cic-ussd-tasker:
# # image: grassrootseconomics:cic-ussd
# build:
# context: apps
# dockerfile: cic-ussd/docker/Dockerfile
# environment:
# DATABASE_USER: grassroots
# DATABASE_HOST: postgres
# DATABASE_PORT: 5432
# DATABASE_PASSWORD: tralala
# DATABASE_NAME: cic_ussd
# DATABASE_ENGINE: postgresql
# DATABASE_DRIVER: psycopg2
# CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis}
# CELERY_RESULT_URL: ${CELERY_BROKER_URL:-redis://redis}
# depends_on:
# - postgres
# - redis
# deploy:
# restart_policy:
# condition: on-failure
# command: "/root/start_tasker.sh -q cic-ussd"
cic-ussd-server:
# image: grassrootseconomics:cic-ussd
build:
context: apps/
dockerfile: cic-ussd/docker/Dockerfile
environment:
DATABASE_USER: grassroots
DATABASE_HOST: postgres
DATABASE_PORT: 5432
DATABASE_PASSWORD: tralala
DATABASE_NAME: cic_ussd
DATABASE_ENGINE: postgresql
DATABASE_DRIVER: psycopg2
SERVER_PORT: 8000
ports:
- ${HTTP_PORT_CIC_USSD:-63315}:8000
depends_on:
- postgres
- redis
deploy:
restart_policy:
condition: on-failure
command: "/root/start_uwsgi.sh"
cic-ussd-tasker:
# image: grassrootseconomics:cic-ussd
build:
context: apps
dockerfile: cic-ussd/docker/Dockerfile
environment:
DATABASE_USER: grassroots
DATABASE_HOST: postgres
DATABASE_PORT: 5432
DATABASE_PASSWORD: tralala
DATABASE_NAME: cic_ussd
DATABASE_ENGINE: postgresql
DATABASE_DRIVER: psycopg2
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis}
CELERY_RESULT_URL: ${CELERY_BROKER_URL:-redis://redis}
depends_on:
- postgres
- redis
deploy:
restart_policy:
condition: on-failure
command: "/root/start_tasker.sh -q cic-ussd"

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