Configuring the REST server with a persistent data store - hyperledger-composer

I am having problems trying to deploy the rest server with persistence storage (mongo db) I ge this message when deploying the rest server:
docker logs -f rest
[2018-03-12 00:01:13] PM2 log: Launching in no daemon mode
[2018-03-12 00:01:14] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
[2018-03-12 00:01:14] PM2 log: App name:composer-rest-server id:0 online
WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
Discovering types from business network definition ...
Connection fails: Error: Error trying to ping. Error: Error trying to query business network. Error: REQUEST_TIMEOUT
It will be retried for the next request.
Exception: Error: Error trying to ping. Error: Error trying to query business network. Error: REQUEST_TIMEOUT
Error: Error trying to ping. Error: Error trying to query business network. Error: REQUEST_TIMEOUT
at _checkRuntimeVersions.then.catch (/home/composer/.npm-global/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:699:34)
at
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
[2018-03-12 00:07:03] PM2 log: App [composer-rest-server] with id [0] and pid [14], exited with code [1] via signal [SIGINT]
I am using composer v.18
is there any work around to fix this error. when I run the composer-rest- server alone it work. but if I try to add the mongodb it does not work

Related

io.fabric8.kubernetes.client.KubernetesClientException: Failure executing

I am trying to install cloudflow 2.0.25 version in the eks cluster using helm. But the pod goes to CrashLoopBackOff status with below error:
ERROR [ActorSystemImpl] - Unexpected error starting cloudflow operator, terminating.
io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://172.20.0.1/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions. Message: the server could not find the requested resource. Received status: Status(apiVersion=v1, code=404, details=StatusDetails(causes=[], group=null, kind=null, name=null, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=the server could not find the requested resource, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=NotFound, status=Failure, additionalProperties={}).
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:570)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(OperationSupport.java:509)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:474)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:435)
at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleCreate(OperationSupport.java:250)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleCreate(BaseOperation.java:871)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.create(BaseOperation.java:366)
at io.fabric8.kubernetes.client.dsl.base.BaseOperation.create(BaseOperation.java:85)
at cloudflow.operator.Main$.checkCRD(Main.scala:140)
at cloudflow.operator.Main$.main(Main.scala:61)
at cloudflow.operator.Main.main(Main.scala)
Please help how to resolve the issue ?
I tried creating crd and then also created custom_roles and rolebindings but it didn't work.

How to resolve (error) ERR unknown command 'service' error in Redis in windows machine?

I installed Redis-cache in my windows machine,after successfully installed i open reddis-cli in that i run service redis_6379 status it's showing following error
(error) ERR unknown command 'service'
How to resolve this error and start the redis server ...?
These are the info about my server
`
Server
redis_version:3.0.504
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:a4f7a6e86f2d60b3
redis_mode:standalone
os:Windows
arch_bits:64
multiplexing_api:WinSock_IOCP
process_id:22004
run_id:7db1c339b5291dc237372c740f8630fd0c665442
tcp_port:6379
uptime_in_seconds:791
uptime_in_days:0
hz:10
lru_clock:2329164
config_file:C:\Program Files\Redis\redis.windows-service.conf
Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
Memory
used_memory:693104
used_memory_human:676.86K
used_memory_rss:655352
used_memory_peak:693104
used_memory_peak_human:676.86K
used_memory_lua:36864
mem_fragmentation_ratio:0.95
mem_allocator:jemalloc-3.6.0
Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1629718325
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok
Stats
total_connections_received:2
total_commands_processed:2
instantaneous_ops_per_sec:0
total_net_input_bytes:290
total_net_output_bytes:2142
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0
Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
CPU
used_cpu_sys:0.28
used_cpu_user:0.36
used_cpu_sys_children:0.00
used_cpu_user_children:0.00
Cluster
cluster_enabled:0
Keyspace
`
The error message is quite clear, there's no Redis command called service.
If you want to check the status of Redis server, you can run INFO command instead. Check thishttps://redis.io/commands) for a list of commands that Redis supports.

: API error (404): network hlfv11_hyperledger not found

✖ Starting business network definition. This may take a minute...
Error: Error trying to start business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: failed to execute transaction b5c260c02b4792c4ae4b85b3d4ccb4565a495da399d27917dccc1a84244e631f: error starting container: error starting container: API error (404): network hlfv11_hyperledger not found
Response from attempted peer comms was an error: Error: failed to execute transaction b5c260c02b4792c4ae4b85b3d4ccb4565a495da399d27917dccc1a84244e631f: error starting container: error starting container: API error (404): network hlfv11_hyperledger not found
This looks like it is a Docker problem trying to start a new ChainCode container on a Docker Network bridge called "hlfv11_hyperledger" which doesn't exist.
(The word 'network' here is ambiguous in the error message :-( )
This is the same problem and hopefully the same solution as a previous post.

Hyperledger composer multi user identity

I am following below tutorial
https://hyperledger.github.io/composer/integrating/enabling-rest-authentication.html
I am able to complete the steps till setting up default wallet identity. After this when i try system ping method I get the error.
{
"error": {
"statusCode": 500,
"name": "Error",
"message": "Error trying to ping. Error: Error trying to query chaincode. Error: chaincode error (status: 500, message: Error: The current identity has not been registered:maeid1)",
"stack": "Error: Error trying to ping. Error: Error trying to query chaincode. Error: chaincode error (status: 500, message: Error: The current identity has not been registered:maeid1)\n at _checkRuntimeVersions.then.catch (/home/praval/.nvm/versions/node/v6.11.1/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:696:34)"
}
}
The same error I get while testing from access token.
curl -v http://localhost:3000/api/system/ping?access_token=xxxxx
Though I can run network ping successfully.
composer network ping -p hlfv1 -n 'digitalproperty-network' -i maeid1 -s NfUhmXtiaSUH
Thanks for help.
The problem you are seeing is described by this issue
https://github.com/hyperledger/composer/issues/1761
Both the CLI and Rest server have enrolled the user but this results in both environments storing certificates for the same identity that differ (for example issue and expiry dates). Whichever environment used their certificate first for that identity and activated that identity/participant in the runtime has their certificate registered. When the other environment presents their certificate it isn't found (because it is different to the first environment) and so reports that the identity is not registered.
The way to address this is if you plan to use the identity in the rest server, don't ping it from the CLI first.

Try to update hyperledger-composer version,but still not compatible with the client version

I just a new beginner of Hyperledger Composer.So I try to deploy REST server using Docker by following this guide
Deploying the REST server for a business network
Then when i run docker, it show this error on docker logs
docker logs rest
0|composer | WARNING: NODE_APP_INSTANCE value of '0' did not match any instance config file names.
0|composer | WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
0|composer | Discovering types from business network definition ...
0|composer | D0831 07:04:36.180952003 24 env_linux.c:66] Warning: insecure environment read function 'getenv' used
0|composer | D0831 07:04:37.574385287 24 env_linux.c:66] Warning: insecure environment read function 'getenv' used
0|composer | Connection fails: Error: Error trying to ping. Error: Composer runtime (0.11.3) is not compatible with client (0.11.2)
0|composer | It will be retried for the next request.
0|composer | Exception: Error: Error trying to ping. Error: Composer runtime (0.11.3) is not compatible with client (0.11.2)
0|composer | Error: Error trying to ping. Error: Composer runtime (0.11.3) is not compatible with client (0.11.2)
0|composer | at _checkRuntimeVersions.then.catch (/usr/local/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:696:34)
PM2 | App [composer-rest-server] with id [0] and pid [24], exited with code [1] via signal [SIGINT]
PM2 | Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
PM2 | App name:composer-rest-server id:0 online
So i try to update the version by following on this guide on the same doc
Updating Hyperledger Composer
But after I stop/reboot fabric, redeploy the chaincode again and run the docker, the error still exist.
Can anyone please tell me what i've missing?
Note: I try this solution too but still have the same problem.
Ok i've solve the problem. I remove all docker image and start new fabric to download image again,and it works!!
docker rmi $(docker images -q)

Resources