@@ -13,15 +13,15 @@ Simple arithmetic service compatible with SingularityNET
13
13
* Clone the git repository:
14
14
15
15
```
16
- $ git clone [email protected] :singnet/example-service.git
17
- $ cd example-service
16
+ git clone [email protected] :singnet/example-service.git
17
+ cd example-service
18
18
```
19
19
20
20
* Install the dependencies and compile the protobuf file:
21
21
22
22
```
23
- $ pip3 install -r requirements.txt
24
- $ sh buildproto.sh
23
+ pip3 install -r requirements.txt
24
+ sh buildproto.sh
25
25
```
26
26
27
27
### Running
@@ -31,13 +31,13 @@ $ sh buildproto.sh
31
31
* Run the example service directly (without ` SNET Daemon ` ):
32
32
33
33
```
34
- $ python3 run_example_service.py --no-daemon
34
+ python3 run_example_service.py --no-daemon
35
35
```
36
36
37
37
* To test it run the script:
38
38
39
39
```
40
- $ python3 test_example_service.py
40
+ python3 test_example_service.py
41
41
```
42
42
43
43
#### With SingularityNET Daemon
@@ -59,6 +59,9 @@ Create the `SNET Daemon`'s config JSON file (`snetd.config.json`).
59
59
"PASSTHROUGH_ENDPOINT": "http://SERVICE_GRPC_HOST:SERVICE_GRPC_PORT",
60
60
"ORGANIZATION_ID": "ORGANIZATION_ID",
61
61
"SERVICE_ID": "SERVICE_ID",
62
+ "PAYMENT_CHANNEL_STORAGE_SERVER": {
63
+ "DATA_DIR": "/opt/singnet/etcd/"
64
+ },
62
65
"LOG": {
63
66
"LEVEL": "debug",
64
67
"OUTPUT": {
@@ -68,20 +71,20 @@ Create the `SNET Daemon`'s config JSON file (`snetd.config.json`).
68
71
}
69
72
```
70
73
71
- For example, using the Kovan testnet, replace tags with:
74
+ For example, using the Ropsten testnet, replace tags with:
72
75
73
76
- ` 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
76
79
- ` http://SERVICE_GRPC_HOST:SERVICE_GRPC_PORT ` : http://localhost:7003
77
80
- ` ORGANIZATION_ID ` : example-organization
78
81
- ` SERVICE_ID ` : example-service
79
82
80
- For example, using the Ropsten testnet, replace tags with:
83
+ For example, using the Kovan testnet, replace tags with:
81
84
82
85
- ` 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
85
88
- ` http://SERVICE_GRPC_HOST:SERVICE_GRPC_PORT ` : http://localhost:7003
86
89
- ` ORGANIZATION_ID ` : example-organization
87
90
- ` SERVICE_ID ` : example-service
@@ -90,24 +93,33 @@ See [SingularityNet daemon configuration](https://github.com/singnet/snet-daemon
90
93
91
94
##### Running Service + Daemon on Host
92
95
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 ) .
94
98
95
99
```
96
- $ python3 run_example_service.py
100
+ python3 run_example_service.py
97
101
```
98
102
99
103
##### Running Service + Daemon in Docker Container
100
104
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:
102
106
103
107
```
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
108
120
```
109
121
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.
111
123
112
124
From this point we follow the tutorial in the Docker Container's prompt.
113
125
@@ -117,21 +129,24 @@ After this, run the service (with `SNET Daemon`), make sure you have the `snetd.
117
129
# cat snetd.config.json
118
130
{
119
131
"DAEMON_END_POINT": "localhost:7000",
120
- "ETHEREUM_JSON_RPC_ENDPOINT": "https://kovan .infura.io",
132
+ "ETHEREUM_JSON_RPC_ENDPOINT": "https://ropsten .infura.io",
121
133
"IPFS_END_POINT": "http://ipfs.singularitynet.io:80",
122
- "REGISTRY_ADDRESS_KEY": "0xe331bf20044a5b24c1a744abc90c1fd711d2c08d ",
134
+ "REGISTRY_ADDRESS_KEY": "0x5156fde2ca71da4398f8c76763c41bc9633875e4 ",
123
135
"PASSTHROUGH_ENABLED": true,
124
136
"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
+ },
127
142
"LOG": {
128
143
"LEVEL": "debug",
129
144
"OUTPUT": {
130
145
"TYPE": "stdout"
131
146
}
132
147
}
133
148
}
134
- # python3 run_example_service.py &
149
+ # python3 run_example_service.py --daemon-config snetd.config.json &
135
150
```
136
151
137
152
### Testing
0 commit comments