Skip to content

Commit

Permalink
Use parameters that squid-py is expecting
Browse files Browse the repository at this point in the history
  • Loading branch information
eruizgar91 committed Oct 18, 2018
1 parent 0e1ae06 commit 1e39c21
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,5 @@ venv.bak/
.mypy_cache/
.idea
docker/docs
config_local.ini

7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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=''
Expand All @@ -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'

Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 2 additions & 5 deletions oceandb.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
7 changes: 2 additions & 5 deletions oceandb.ini.template
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
7 changes: 4 additions & 3 deletions scripts/deploy
Original file line number Diff line number Diff line change
@@ -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'])")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1e39c21

Please sign in to comment.