diff --git a/.gitignore b/.gitignore index 8b0ce310..25d223dc 100644 --- a/.gitignore +++ b/.gitignore @@ -104,4 +104,5 @@ venv.bak/ .mypy_cache/ .idea docker/docs +config_local.ini diff --git a/Dockerfile b/Dockerfile index 11a727c8..9a371838 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,8 +33,7 @@ ENV DB_APP_KEY='' ENV DB_NAMESPACE='namespace' ENV DB_NAME='test' ENV DB_COLLECTION='protokeeper' -ENV KEEPER_HOST='http://127.0.0.1' -ENV KEEPER_PORT='8545' +ENV KEEPER_URL='http://127.0.0.1:8548' ENV KEEPER_NETWORK='development' #ENV MARKET_ADDRESS='' #ENV AUTH_ADDRESS='' @@ -43,9 +42,7 @@ ENV PROVIDER_ADDRESS='' ENV AZURE_ACCOUNT_NAME='testocnfiles' ENV AZURE_ACCOUNT_KEY='k2Vk4yfb88WNlWW+W54a8ytJm8MYO1GW9IgiV7TNGKSdmKyVNXzyhiRZ3U1OHRotj/vTYdhJj+ho30HPyJpuYQ==' ENV AZURE_CONTAINER='testfiles' -ENV PROVIDER_SCHEME='http' -ENV PROVIDER_HOST='0.0.0.0' -ENV PROVIDER_PORT='5000' +ENV PROVIDER_URL='http://0.0.0.0:5000' # docker-entrypoint.sh configuration file variables ENV PROVICER_WORKERS='1' diff --git a/README.md b/README.md index d7bf01bf..418e402f 100644 --- a/README.md +++ b/README.md @@ -78,9 +78,7 @@ and when it asks for the Common Name (CN), answer `localhost` Then edit the config file `oceandb.ini` so that: ```yaml -provider.scheme = https -provider.host = localhost -provider.port = 5000 +provider.url = https://localhost:5000 ``` Then execute this command: @@ -114,8 +112,7 @@ In the configuration there are now three sections: - keeper-contracts: This section help you to connect with the network where you have deployed the contracts. You can find more information of how to configure [here](https://github.com/oceanprotocol/squid-py#quick-start). ```yaml [keeper-contracts] - keeper.host=0.0.0.0 - keeper.port=8545 + keeper.url=0.0.0.0:8545 #contracts.folder=venv/contracts market.address=0xbc0be3598a31715bac5235718f96bb242804e61e auth.address=0x6ba5f72e5399aa67db5b22ee791851937d4910f5 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index f137f37b..629d48ec 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -14,5 +14,5 @@ auth=$(python -c "import sys, json; print(json.load(open('/usr/local/keeper-cont sed -i -e "/token.address =/c token.address = ${token}" /provider/oceandb.ini sed -i -e "/market.address =/c market.address = ${market}" /provider/oceandb.ini sed -i -e "/auth.address =/c auth.address = ${auth}" /provider/oceandb.ini -gunicorn -b ${PROVIDER_HOST}:${PROVIDER_PORT} -w ${PROVICER_WORKERS} provider.run:app +gunicorn -b ${PROVIDER_URL#*://} -w ${PROVICER_WORKERS} provider.run:app tail -f /dev/null diff --git a/oceandb.ini b/oceandb.ini index e3b57b58..fc24114d 100644 --- a/oceandb.ini +++ b/oceandb.ini @@ -49,8 +49,7 @@ db.collection = protokeeper ;db.app_key=d068996d8d5b1a66cfc61dc3a83fa7ee [keeper-contracts] -keeper.host = http://127.0.0.1 -keeper.port = 8545 +keeper.url = http://127.0.0.1:8545 keeper.network = development ;contracts.folder=venv/contracts @@ -66,6 +65,4 @@ azure.account.key = k2Vk4yfb88WNlWW+W54a8ytJm8MYO1GW9IgiV7TNGKSdmKyVNXzyhiRZ3U1O azure.container = testfiles ;; These consitute part of the provider url which is used in setting the `api_url` in the `OceanContractsWrapper` -provider.scheme = http -provider.host = localhost -provider.port = 5000 +provider.url = http://localhost:5000 diff --git a/oceandb.ini.template b/oceandb.ini.template index 69939880..81875f42 100644 --- a/oceandb.ini.template +++ b/oceandb.ini.template @@ -40,8 +40,7 @@ db.collection=${DB_COLLECTION} ;db.app_key=d068996d8d5b1a66cfc61dc3a83fa7ee [keeper-contracts] -keeper.host = ${KEEPER_HOST} -keeper.port = ${KEEPER_PORT} +keeper.url = ${KEEPER_URL} keeper.network = ${KEEPER_NETWORK} ;contracts.folder=venv/contracts @@ -56,6 +55,4 @@ azure.account.key = ${AZURE_ACCOUNT_KEY} azure.container = ${AZURE_CONTAINER} ; These consitute part of the provider url which is used in setting the `api_url` in the `OceanContractsWrapper` -provider.scheme = ${PROVIDER_SCHEME} -provider.host = ${PROVIDER_HOST} -provider.port = ${PROVIDER_PORT} +provider.url = ${PROVIDER_URL} diff --git a/scripts/deploy b/scripts/deploy index 1b5982c4..d1639e3a 100755 --- a/scripts/deploy +++ b/scripts/deploy @@ -1,11 +1,12 @@ #!/bin/bash -x #PROVIDERDIR=. -CONF_FILE=oceandb.ini +CONF_TEMPLATE=oceandb.ini +CONF_FILE=config_local.ini #KEEPERDIR=~/Projects/keeper-contracts #cd $KEEPERDIR +cp $CONF_TEMPLATE $CONF_FILE + -echo "Waiting for keeper-contracts to be installed" -docker exec -it docker_keeper-contracts_1 bash -c 'while [ ! -f /keeper-contracts/artifacts/ready ]; do sleep 1; done' market=$(docker exec -it docker_keeper-contracts_1 python -c "import sys, json; print(json.load(open('/keeper-contracts/artifacts/OceanMarket.development.json', 'r'))['address'])") token=$(docker exec -it docker_keeper-contracts_1 python -c "import sys, json; print(json.load(open('/keeper-contracts/artifacts/OceanToken.development.json', 'r'))['address'])") auth=$(docker exec -it docker_keeper-contracts_1 python -c "import sys, json; print(json.load(open('/keeper-contracts/artifacts/OceanAuth.development.json', 'r'))['address'])") diff --git a/tests/test_provider.py b/tests/test_provider.py index 585daddc..8265ac02 100644 --- a/tests/test_provider.py +++ b/tests/test_provider.py @@ -8,7 +8,7 @@ from provider.constants import BaseURLs from tests.conftest import json_dict, json_request_consume -ocean = Ocean(config_file='oceandb.ini') +ocean = Ocean(config_file='config_local.ini') acl_concise = ocean.contracts.auth.contract_concise acl = ocean.contracts.auth.contract