opencrvs / opencrvs-core

A global solution to civil registration
https://www.opencrvs.org
Other
88 stars 70 forks source link

Installation problems #1525

Closed moli1987 closed 4 years ago

moli1987 commented 4 years ago

Using instruction provided we get following issues during installation 1.There is no data/elasticsearch provided in opecrvs-core(should it be created manually?) 2.Whenever we try to populate database with Zambia test data we get following error. docker: Error response from daemon: Could not attach to network opencrvs_default: rpc error: code = NotFound desc = network opencrvs_default not found.

Sadman-Ilham commented 4 years ago
moli1987 commented 4 years ago

Yes I initiated swarm.

Sadman-Ilham commented 4 years ago

Can you please give me a screenshot of your docker network list?

docker network ls

moli1987 commented 4 years ago

screenshot

Sadman-Ilham commented 4 years ago

The network is not created, which should be created when you run the opencrvs-core. Did you able to run opencrvs-core successfully? You need to run the opencrvs-core first to restore the database from opencrvs-zambia.

moli1987 commented 4 years ago

Yes I run opencrvs-core according to instructions but: In case if I don't install MongoDB separately code throws following errors: [0] @opencrvs/user-mgnt: {"level":50,"time":1584085640939,"pid":1759,"hostname":"ip-172-31-5-116","name":"MongoNetworkError","errorLabels":["TransientTransactionError"],"msg":"failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16) {\n name: 'MongoNetworkError',\n errorLabels: [Array],\n [Symbol(mongoErrorContextSymbol)]: {}\n}]","stack":"MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16) {\n name: 'MongoNetworkError',\n errorLabels: [Array],\n [Symbol(mongoErrorContextSymbol)]: {}\n}]\n at Pool. (/home/ubuntu/opencrvs-core/node_modules/mongodb/lib/core/topologies/server.js:431:11)\n at Pool.emit (events.js:311:20)\n at Pool.EventEmitter.emit (domain.js:482:12)\n at /home/ubuntu/opencrvs-core/node_modules/mongodb/lib/core/connection/pool.js:580:14\n at /home/ubuntu/opencrvs-core/node_modules/mongodb/lib/core/connection/connect.js:39:11\n at callback (/home/ubuntu/opencrvs-core/node_modules/mongodb/lib/core/connection/connect.js:261:5)\n at Socket. (/home/ubuntu/opencrvs-core/node_modules/mongodb/lib/core/connection/connect.js:286:7)\n at Object.onceWrapper (events.js:418:26)\n at Socket.emit (events.js:311:20)\n at Socket.EventEmitter.emit (domain.js:482:12)\n at emitErrorNT (internal/streams/destroy.js:92:8)\n at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)\n at processTicksAndRejections (internal/process/task_queues.js:84:21)","type":"Error","v":1} If I install Mongodb separately on my server core is finished with Compiled successfully message but I get following problem with Zambia test database restore.

Sadman-Ilham commented 4 years ago

All the services here are containerized. You don't need to install mongodb manually. So the mongo network error should not be there in the first place. I think something weird is happening when docker-compose is getting executed.

Can you please make sure that,

My suggestion is, pull the images manually into your local docker registry. And then run the application.

Some helpful commands,

If still things doesn't work, I recommend you to delete everything and start from the scratch as per instruction given in the readme. Even delete and install fresh new docker, docker-compose etc.

moli1987 commented 4 years ago

Which images exactly should I pull manually? Should I get the list from docker-compose file or where?

Sadman-Ilham commented 4 years ago

You can get the image list from docker-compose.deps.yml

moli1987 commented 4 years ago

The problem with installation is corrected and I was able to fill database with data but now when I go to url:http://ip:3020 to login I see error TypeError: Cannot read property 'COUNTRY' of undefined Is there any other step I need to do? Thank you in advance.

Sadman-Ilham commented 4 years ago

You need to run the opencrvs-zambia also.

First execute the opencrvs-core and then opencrvs-zambia.

moli1987 commented 4 years ago

Yes I did that 1.Run Core 2.Run zambia using CERT_PUBLIC_KEY_PATH=/home/ubuntu/opencrvs-core/.secrets/public-key.pem yarn start 3.fill database using yarn db:backup:restore all the above was executed succesfully

Sadman-Ilham commented 4 years ago

Both the applications are in running condition? Can you please provide some more details about the error? Or maybe a screenshot?

moli1987 commented 4 years ago

Yes all of them are in running state error

Sadman-Ilham commented 4 years ago

I think the login app cannot communicate with zambia package. Can you please give me the console error? By the way, where did you deploy the application? It should have been localhost if you're running it on your machine. And if you're in dev mode the login package communicate with zambia package through localhost:3040.

moli1987 commented 4 years ago

I deployed application on aws cloud server. 1.so when I call ip:3020 URL there is no error in core or zambia logs only in browser console I see following message Uncaught TypeError: Cannot read property 'COUNTRY' of undefined at Module../src/common/DarkPage/DarkPage.tsx (DarkPage.tsx:23) at webpack_require (bootstrap:781) at fn (bootstrap:149) at Module../src/common/PageContainer.tsx (PageContainer.tsx:1) at webpack_require (bootstrap:781) at fn (bootstrap:149) at Module../src/App.tsx (index.js:30) at webpack_require (bootstrap:781) at fn (bootstrap:149) at Module../src/index.tsx (utils.ts:18) at webpack_require (bootstrap:781) at fn (bootstrap:149) at Object.0 (updatePasswordForm.tsx:299) at __webpack_require__ (bootstrap:781) at checkDeferredModules (bootstrap:45) at Array.webpackJsonpCallback [as push] (bootstrap:32) at main.chunk.js:1 2.when I call ip:3040 responce is {"statusCode":404,"error":"Not Found","message":"Not Found"} and I see following message in zambia logs

{"level":30,"time":1585126329718,"pid":13203,"hostname":"ip-172-31-5-116","req":{"id":"1585126329717:ip-172-31-5-116:13203:k8732i8s:10001","method":"get","url":"/favicon.ico","headers":{"host":"13.48.85.129:3040","connection":"keep-alive","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","accept":"image/webp,image/apng,image/,/;q=0.8","referer":"http://13.48.85.129:3040/","accept-encoding":"gzip, deflate","accept-language":"en,ka;q=0.9"},"remoteAddress":"94.43.4.208","remotePort":55015},"req":{"id":"1585126329717:ip-172-31-5-116:13203:k8732i8s:10001","method":"get","url":"/favicon.ico","headers":{"host":"13.48.85.129:3040","connection":"keep-alive","user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36","accept":"image/webp,image/apng,image/,/;q=0.8","referer":"http://13.48.85.129:3040/","accept-encoding":"gzip, deflate","accept-language":"en,ka;q=0.9"},"remoteAddress":"94.43.4.208","remotePort":55015},"res":{"statusCode":404,"headers":{"content-type":"application/json; charset=utf-8","vary":"origin","access-control-expose-headers":"WWW-Authenticate,Server-Authorization","cache-control":"no-cache","content-length":60}},"responseTime":1,"msg":"request completed","v":1}

Sadman-Ilham commented 4 years ago

In this case you need to replace localhost with your ip for all the endpoints that are getting invoked from front end side.

I believe updating the resource url with your IP will help you run the login and client package. https://github.com/opencrvs/opencrvs-core/blob/77860ebb187f5e14e9db1b5785f7284b4d14a34b/packages/login/craco.config.js#L15 https://github.com/opencrvs/opencrvs-core/blob/77860ebb187f5e14e9db1b5785f7284b4d14a34b/packages/client/craco.config.js#L15

But you also need to update the URLs in login config https://github.com/opencrvs/opencrvs-zambia/blob/master/src/zmb/config/login-config.js and client-config https://github.com/opencrvs/opencrvs-zambia/blob/master/src/zmb/config/client-config.js in opencrvs-zambia repo

But I'm wondering why are you setting up the development environment in a cloud machine instead of your local machine.

Sadman-Ilham commented 4 years ago

Hi, I'm closing this issue. Please don't hesitate to open new issues if you need any help.