diff --git a/.gitignore b/.gitignore index d658720..6823fb6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ .tox/ .cache .idea +data __pycache__ -/data/ agent/tests/output diff --git a/.gitmodules b/.gitmodules index 04abeab..234c838 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "agent/sn_agent/network/ethereum/core"] path = agent/sn_agent/network/ethereum/core url = https://github.com/singnet/core + branch = agent-stable diff --git a/docker/.gitignore b/docker/.gitignore new file mode 100644 index 0000000..1269488 --- /dev/null +++ b/docker/.gitignore @@ -0,0 +1 @@ +data diff --git a/docker/docker-compose.abc.yml b/docker/docker-compose.abc.yml new file mode 100644 index 0000000..f2cf9c5 --- /dev/null +++ b/docker/docker-compose.abc.yml @@ -0,0 +1,68 @@ + +version: "3" + +services: + + alice: + build: ../agent + environment: + - SN_AGENT_ID=b545478a-971a-48ec-bc56-4b9b7176799c + - SN_NETWORK_WEB_PORT=9050 + - SN_SERVICE_ADAPTER_CONFIG_FILE=alice_config.yml + - PYTHONPATH=/code + - SN_DS_TEST_OUTPUT_DIRECTORY=/data + - SN_NETWORK_ACCOUNT_PASSWORD=${SN_NETWORK_ACCOUNT_PASSWORD} + ports: + - "9050:9050" + volumes: + - ./data/agent/alice:/data + links: + - testrpc + - bob + - charlie + - relex + + bob: + build: ../agent + environment: + - SN_AGENT_ID=c545478a-971a-48ec-bc56-aaaaaaaaaaaa + - SN_NETWORK_WEB_PORT=9060 + - SN_SERVICE_ADAPTER_CONFIG_FILE=bob_config.yml + - PYTHONPATH=/code + - SN_NETWORK_ACCOUNT_PASSWORD=${SN_NETWORK_ACCOUNT_PASSWORD} + ports: + - "9060:9060" + volumes: + - ./data/agent/bob:/data + links: + - testrpc + + charlie: + build: ../agent + environment: + - SN_AGENT_ID=b545478a-971a-cccc-bc56-bbbbbbbbbbbb + - SN_NETWORK_WEB_PORT=9065 + - SN_SERVICE_ADAPTER_CONFIG_FILE=charlie_config.yml + - PYTHONPATH=/code + - SN_DS_TEST_OUTPUT_DIRECTORY=/data + - SN_NETWORK_ACCOUNT_PASSWORD=${SN_NETWORK_ACCOUNT_PASSWORD} + ports: + - "9065:9065" + volumes: + - ./data/agent/charlie:/data + links: + - testrpc + + testrpc: + build: testrpc + ports: + - "8545:8545" + - "8546:8546" + - "30303:30303" + command: ganache-cli + + relex: + image: opencog/relex + ports: + - "9000:9000" + command: bash -l -c ./link-grammar-server.sh 9000 diff --git a/docker/docker-compose.demo.yml b/docker/docker-compose.demo.yml new file mode 100644 index 0000000..e584c88 --- /dev/null +++ b/docker/docker-compose.demo.yml @@ -0,0 +1,41 @@ + +version: "3" + +services: + + demo: + build: ../agent + environment: + - SN_AGENT_ID=b545478a-FFFF-FFFF-FFFF-4b9b7176FFFF + - SN_NETWORK_WEB_PORT=9250 + - SN_SERVICE_ADAPTER_CONFIG_FILE=demo_config.yml + - PYTHONPATH=/code + - SN_DS_TEST_OUTPUT_DIRECTORY=/data + - SN_NETWORK_CLIENT_URL=http://parity:8545 + - SN_NETWORK_ACCOUNT=0x1934ab10860362eabcfaa111847bc75ecf43fcbd + - SN_NETWORK_ACCOUNT_PASSWORD=${SN_NETWORK_ACCOUNT_PASSWORD} + ports: + - "9250:9250" + volumes: + - ./data/agent/demo:/data + links: + - parity + - relex + + parity: + build: parity + ports: + - "8080:8080" + - "8180:8180" + - "8545:8545" + - "8546:8546" + - "30303:30303" + - "30303:30303/udp" + volumes: + - ./data/parity:/parity-data + + relex: + image: opencog/relex + ports: + - "9000:9000" + command: bash -l -c ./link-grammar-server.sh 9000 diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml new file mode 100644 index 0000000..e297b35 --- /dev/null +++ b/docker/docker-compose.dev.yml @@ -0,0 +1,54 @@ + +version: "3" + +services: + + dev: + build: ../agent + container_name: agent + environment: + - SN_AGENT_ID=b545478a-971a-48ec-bc56-4b9b7176799c + - SN_NETWORK_WEB_PORT=8000 + - SN_SERVICE_ADAPTER_CONFIG_FILE=dev_config.yml + - SN_NETWORK_ACCOUNT_PASSWORD=${SN_NETWORK_ACCOUNT_PASSWORD} + - "8000:8000" + volumes: + - ./data/agent/dev:/data + links: + - testrpc + - relex + +# parity: +# build: parity +# ports: +# - "8080:8080" +# - "8180:8180" +# - "8545:8545" +# - "8546:8546" +# - "30303:30303" +# - "30303:30303/udp" +# volumes: +# - ./data/parity:/parity-data + + testrpc: + container_name: testrpc + build: testrpc + ports: + - "8545:8545" + - "8546:8546" + - "30303:30303" + command: ganache-cli + + relex: + container_name: relex + image: opencog/relex + ports: + - "9000:9000" + command: bash -l -c ./link-grammar-server.sh 9000 + + truffle: + container_name: truffle + build: ../agent/sn_agent/network/ethereum/core + volumes: + - ./data/agent/dev:/data + command: bash -l -c 'pwd; ls -al; ./truffle_tools.sh' diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..127d6c3 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,28 @@ + +version: "3" + +services: + + test: + build: ../agent + environment: + - SN_AGENT_ID=b545478a-971a-48ec-bc56-4b9b7176799c + - SN_NETWORK_WEB_PORT=9070 + - SN_SERVICE_ADAPTER_CONFIG_FILE=test_config.yml + - PYTHONPATH=/code + - SN_DS_TEST_OUTPUT_DIRECTORY=/data + - SN_NETWORK_ACCOUNT_PASSWORD=${SN_NETWORK_ACCOUNT_PASSWORD} + ports: + - "9070:9070" + volumes: + - ./data/agent/test:/data + links: + - testrpc + + testrpc: + build: testrpc + ports: + - "8545:8545" + - "8546:8546" + - "30303:30303" + command: ganache-cli diff --git a/docker/parity/Dockerfile b/docker/parity/Dockerfile new file mode 100644 index 0000000..c0eb715 --- /dev/null +++ b/docker/parity/Dockerfile @@ -0,0 +1,9 @@ +FROM parity/parity:stable + +WORKDIR /parity +COPY config.toml . +COPY parity.sh . + +ENTRYPOINT ["/parity/parity.sh"] +CMD ["run"] + diff --git a/docker/parity/config.toml b/docker/parity/config.toml new file mode 100644 index 0000000..439587e --- /dev/null +++ b/docker/parity/config.toml @@ -0,0 +1,7 @@ +[parity] +chain = "kovan" +base_path = "/parity-data" + +[rpc] +force = true +interface = "all" diff --git a/docker/parity/parity.sh b/docker/parity/parity.sh new file mode 100644 index 0000000..c0f4232 --- /dev/null +++ b/docker/parity/parity.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset + +case "$1" in + +noop) + ;; + +create-account) + ./parity --config config.toml account new + ;; + +run) + ./parity --config config.toml + ;; + +*) echo 'No operation specified' + exit 0; + ;; + +esac diff --git a/docker/testrpc/Dockerfile b/docker/testrpc/Dockerfile new file mode 100644 index 0000000..25835a1 --- /dev/null +++ b/docker/testrpc/Dockerfile @@ -0,0 +1,5 @@ +FROM node:8 + +WORKDIR /code + +RUN npm install -g ganache-cli diff --git a/tools.sh b/tools.sh index 563539c..30db77b 100755 --- a/tools.sh +++ b/tools.sh @@ -22,8 +22,25 @@ demo-down) docker-compose -f docker/docker-compose.demo.yml down --remove-orphans ;; +truffle) + docker-compose -f docker/docker-compose.dev.yml create --build --force-recreate truffle + docker-compose -f docker/docker-compose.dev.yml run --service-ports truffle + ;; + dev) + docker-compose -f docker/docker-compose.dev.yml create --build dev + docker-compose -f docker/docker-compose.dev.yml run --service-ports dev ./agent.sh run + ;; + +dev-force-build) docker-compose -f docker/docker-compose.dev.yml create --build --force-recreate dev + ;; + +dev-build) + docker-compose -f docker/docker-compose.dev.yml create --build dev + ;; + +dev-run) docker-compose -f docker/docker-compose.dev.yml run --service-ports dev ./agent.sh run ;;