@@ -13,15 +13,15 @@ Simple arithmetic service compatible with SingularityNET
1313* Clone the git repository:
1414
1515```
16- $ git clone git@github.com:singnet/example-service.git
17- $ cd example-service
16+ git clone git@github.com:singnet/example-service.git
17+ cd example-service
1818```
1919
2020* Install the dependencies and compile the protobuf file:
2121
2222```
23- $ pip3 install -r requirements.txt
24- $ sh buildproto.sh
23+ pip3 install -r requirements.txt
24+ sh buildproto.sh
2525```
2626
2727### Running
@@ -31,13 +31,13 @@ $ sh buildproto.sh
3131* Run the example service directly (without ` SNET Daemon ` ):
3232
3333```
34- $ python3 run_example_service.py --no-daemon
34+ python3 run_example_service.py --no-daemon
3535```
3636
3737* To test it run the script:
3838
3939```
40- $ python3 test_example_service.py
40+ python3 test_example_service.py
4141```
4242
4343#### With SingularityNET Daemon
@@ -59,6 +59,9 @@ Create the `SNET Daemon`'s config JSON file (`snetd.config.json`).
5959 "PASSTHROUGH_ENDPOINT": "http://SERVICE_GRPC_HOST:SERVICE_GRPC_PORT",
6060 "ORGANIZATION_ID": "ORGANIZATION_ID",
6161 "SERVICE_ID": "SERVICE_ID",
62+ "PAYMENT_CHANNEL_STORAGE_SERVER": {
63+ "DATA_DIR": "/opt/singnet/etcd/"
64+ },
6265 "LOG": {
6366 "LEVEL": "debug",
6467 "OUTPUT": {
@@ -68,20 +71,20 @@ Create the `SNET Daemon`'s config JSON file (`snetd.config.json`).
6871}
6972```
7073
71- For example, using the Kovan testnet, replace tags with:
74+ For example, using the Ropsten testnet, replace tags with:
7275
7376- ` DAEMON_HOST:DAEMON_PORT ` : localhost:7000
74- - ` https://JSON_RPC_ENDPOINT ` : https://kovan .infura.io
75- - ` REGISTRY_ADDRESS ` : 0xe331bf20044a5b24c1a744abc90c1fd711d2c08d
77+ - ` https://JSON_RPC_ENDPOINT ` : https://ropsten .infura.io
78+ - ` REGISTRY_ADDRESS ` : 0x5156fde2ca71da4398f8c76763c41bc9633875e4
7679- ` http://SERVICE_GRPC_HOST:SERVICE_GRPC_PORT ` : http://localhost:7003
7780- ` ORGANIZATION_ID ` : example-organization
7881- ` SERVICE_ID ` : example-service
7982
80- For example, using the Ropsten testnet, replace tags with:
83+ For example, using the Kovan testnet, replace tags with:
8184
8285- ` DAEMON_HOST:DAEMON_PORT ` : localhost:7000
83- - ` https://JSON_RPC_ENDPOINT ` : https://ropsten .infura.io
84- - ` REGISTRY_ADDRESS ` : 0x5156fde2ca71da4398f8c76763c41bc9633875e4
86+ - ` https://JSON_RPC_ENDPOINT ` : https://kovan .infura.io
87+ - ` REGISTRY_ADDRESS ` : 0xe331bf20044a5b24c1a744abc90c1fd711d2c08d
8588- ` http://SERVICE_GRPC_HOST:SERVICE_GRPC_PORT ` : http://localhost:7003
8689- ` ORGANIZATION_ID ` : example-organization
8790- ` SERVICE_ID ` : example-service
@@ -90,24 +93,33 @@ See [SingularityNet daemon configuration](https://github.com/singnet/snet-daemon
9093
9194##### Running Service + Daemon on Host
9295
93- * Run the script without flag to launch both ` SNET Daemon ` and the service
96+ * Run the script without flag to launch both ` SNET Daemon ` and the service. But first,
97+ download the latest ` SNET Daemon ` [ release here] ( https://github.com/singnet/snet-daemon/releases ) .
9498
9599```
96- $ python3 run_example_service.py
100+ python3 run_example_service.py
97101```
98102
99103##### Running Service + Daemon in Docker Container
100104
101- * Build the docker image and run a Container from it:
105+ * Build the docker image (with proper ` SNET Daemon ` version) and run a Container from it:
102106
103107```
104- $ docker build -t snet_example_service https://github.com/singnet/example-service.git#master
105- $ export ETCD_HOST_FOLDER=$HOME/singnet/etcd/example-service/
106- $ export ETCD_CONTAINER_FOLDER=/opt/singnet/example-service/storage-data-dir-1.etcd/
107- $ docker run -p 7000:7000 -v $ETCD_HOST_FOLDER:$ETCD_CONTAINER_FOLDER -ti snet_example_service bash
108+ SNETD_VERSION="v0.1.7"
109+ docker build \
110+ --build-arg snetd_version=$SNETD_VERSION \
111+ -t snet_example_service \
112+ https://github.com/singnet/example-service.git#master
113+
114+ export ETCD_HOST=$HOME/.snet/etcd/example-service/
115+ export ETCD_CONTAINER=/opt/singnet/etcd/
116+ docker run \
117+ -p 7000:7000 \
118+ -v $ETCD_HOST:$ETCD_CONTAINER \
119+ -ti snet_example_service bash
108120```
109121
110- Note that the ` $ETCD_(HOST|CONTAINER)_FOLDER ` are useful to keep your service's etcd folder outside the container.
122+ Note that the ` $ETCD_(HOST|CONTAINER) ` are useful to keep your service's etcd folder outside the container.
111123
112124From this point we follow the tutorial in the Docker Container's prompt.
113125
@@ -117,21 +129,24 @@ After this, run the service (with `SNET Daemon`), make sure you have the `snetd.
117129# cat snetd.config.json
118130{
119131 "DAEMON_END_POINT": "localhost:7000",
120- "ETHEREUM_JSON_RPC_ENDPOINT": "https://kovan .infura.io",
132+ "ETHEREUM_JSON_RPC_ENDPOINT": "https://ropsten .infura.io",
121133 "IPFS_END_POINT": "http://ipfs.singularitynet.io:80",
122- "REGISTRY_ADDRESS_KEY": "0xe331bf20044a5b24c1a744abc90c1fd711d2c08d ",
134+ "REGISTRY_ADDRESS_KEY": "0x5156fde2ca71da4398f8c76763c41bc9633875e4 ",
123135 "PASSTHROUGH_ENABLED": true,
124136 "PASSTHROUGH_ENDPOINT": "http://localhost:7003",
125- "ORGANIZATION_ID": "example-organization",
126- "SERVICE_ID": "example-service",
137+ "ORGANIZATION_ID": "my-organization",
138+ "SERVICE_ID": "my-service",
139+ "PAYMENT_CHANNEL_STORAGE_SERVER": {
140+ "DATA_DIR": "/opt/singnet/etcd/"
141+ },
127142 "LOG": {
128143 "LEVEL": "debug",
129144 "OUTPUT": {
130145 "TYPE": "stdout"
131146 }
132147 }
133148}
134- # python3 run_example_service.py &
149+ # python3 run_example_service.py --daemon-config snetd.config.json &
135150```
136151
137152### Testing
0 commit comments