Wednesday, June 28, 2017

Orient.me - Failed to exec start script 'npm run start migrate'connections


ในการติดตั้ง Orient.me สำหรับ IBM Connections 6.0 นั้นถือได้ว่าเป็นส่วนใหม่ที่หลายคนอาจไม่คุ้นเคยมาก่อน เพราะ Orient.me เป็นความสามารถแรกของ Connections ที่รันอยู่บน Pink Architecture (ไว้ว่างๆจะมาเล่ารายละเอียดให้ฟังกัน)


สำหรับวันนี้เป็นเรื่องของการแก้ปัญหาการระหว่างทำการ migrate people data จาก Connections 6.0 ที่อยู่บน Blue Architecture มายัง Pink Architecture เพื่อใช้สำหรับการแสดงผลของ Orient.me กันครับ



--> หลังจากเราติดตั้ง Orient.me และ configure Redis กันไปเรียบร้อยแล้ว ขั้นตอนเกือบจะสุดท้ายก็ว่าได้คือการ เข้าไปใน  "people-datamigration-service" เพื่อรัน Node.js script เพื่อทำการดึงข้อมูลผู้ใช้จาก Connections 6.0 มายัง Orient.me ด้วยคำสั่ง 'npm run start migrate' ซึ่งควรจะไม่มีปัญหาอะไร แต่ผมดันเจอปัญหาครับ



[root@people-migrate-4029352936-2vv1q app]# npm start migrate

npm info it worked if it ends with ok

npm info using npm@3.10.8

npm info using node@v6.9.1

npm info lifecycle people-datamigration-service@0.0.1~prestart: people-datamigration-service@0.0.1

npm info lifecycle people-datamigration-service@0.0.1~start: people-datamigration-service@0.0.1



> people-datamigration-service@0.0.1 start /usr/src/app

> cross-env NODE_ENV=production node lib/server.js "migrate"



2017-06-28T04:58:59.201Z - info: [migrator] Mongo DB URL: mongodb://mongo-0.mongo:27017,mongo-1.mongo:27017,mongo-2.mongo:27017/relationshipdb?replicaSet=rs0&readPreference=primaryPreferred&wtimeoutMS=2000

2017-06-28T04:58:59.203Z - info: [migrator] Mongo DB URL: mongodb://mongo-0.mongo:27017,mongo-1.mongo:27017,mongo-2.mongo:27017/datamigrationdb?replicaSet=rs0&readPreference=primaryPreferred&wtimeoutMS=2000

2017-06-28T04:58:59.204Z - info: [migrator] Mongo DB URL: mongodb://mongo-0.mongo:27017,mongo-1.mongo:27017,mongo-2.mongo:27017/profiledb?replicaSet=rs0&readPreference=primaryPreferred&wtimeoutMS=2000

2017-06-28T04:58:59.844Z - info: [migrator] total request number: 1

2017-06-28T04:58:59.848Z - info: [populator] Start to populate URL:

--"https://wwts-con6.ibmcollabcloud.com/profiles/admin/atom/profiles.do?ps=100"



/usr/src/app/lib/utils/connApiUtil.js:183

    const links = _get__('_').concat([], jsObj.link);

                                              ^



TypeError: Cannot read property 'link' of null

    at Object.getNextLink (/usr/src/app/lib/utils/connApiUtil.js:183:47)

    at IncomingMessage.res.on (/usr/src/app/lib/service/populator.js:79:45)

    at emitNone (events.js:91:20)

    at IncomingMessage.emit (events.js:185:7)

    at endReadableNT (_stream_readable.js:974:12)

    at _combinedTickCallback (internal/process/next_tick.js:74:11)

    at process._tickCallback (internal/process/next_tick.js:98:9)



npm info lifecycle people-datamigration-service@0.0.1~start: Failed to exec start script

npm ERR! Linux 3.10.0-514.el7.x86_64

npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" "migrate"

npm ERR! node v6.9.1

npm ERR! npm  v3.10.8

npm ERR! code ELIFECYCLE

npm ERR! people-datamigration-service@0.0.1 start: `cross-env NODE_ENV=production node lib/server.js "migrate"`

npm ERR! Exit status 1

npm ERR! 

npm ERR! Failed at the people-datamigration-service@0.0.1 start script 'cross-env NODE_ENV=production node lib/server.js "migrate"'.

npm ERR! Make sure you have the latest version of node.js and npm installed.

npm ERR! If you do, this is most likely a problem with the people-datamigration-service package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system:

npm ERR!     cross-env NODE_ENV=production node lib/server.js "migrate"

npm ERR! You can get information on how to open an issue for this project with:

npm ERR!     npm bugs people-datamigration-service

npm ERR! Or if that isn't available, you can get their info via:

npm ERR!     npm owner ls people-datamigration-service

npm ERR! There is likely additional logging output above.



npm ERR! Please include the following file with any support request:

npm ERR!     /usr/src/app/npm-debug.log

[root@people-migrate-4029352936-2vv1q app]# ls 


--> จาก Error message ด้านบน ต้องยอมรับเลยครับว่าไม่ได้บอกอะไรเกี่ยวกับปัญหาเรื่องการเชื่อมต่อเลย แต่จะทำให้เราไป focus ที่  node.js ไม่ update ซึ่งเป็นไปไม่ได้เพราะเรา pull image มาจาก repository โดยตรง
เมื่อลองค้นคว้าข้อมูลพบว่า Ben Williams  ได้แนะนำการแก้ปัญหาในขั้นตอนการ migrate people data ไว้ใน http://www.collaborationben.com ว่าควรตรวจสอบเรื่อง connection ระหว่าง people-datamigration-service กับ Connections server และ Mongo DB (เนื่องจาก people-datamigration-service รันอยู่ใน docker จึงไม่สามารถมั่นใจได้ว่า host เข้าถึง Connections  และ Mongo ได้แล้ว people-datamigration-service จะเข้าถึงได้)

ดังนั้นผมจึงรอบทดสอบจาก


ping mongo







ping mongo-0  พบว่าไม่สามารถเชื่อมต่อได้





ping mongo-0.mongo





 ping Connections server พบว่าระบบเข้าถึง Connections server ผิดตัว เนื่องจากผมตั้งชื่อ Connections server ของผมซ้ำกับ server จริงๆ ของ IBM






 
ดังนั้นผมจึงทดลองแก้ปัญหานี้ด้วยการกำหนดค่าใน  /etc/hosts จากเดิมที่เป็น








 
โดยการ mapping ip address  เข้ากับ server name ของ Mongo และ Connections









 
และเมื่อทดลองรัน 'npm run start migrate' อีกครั้งก็สามารถ migrate data  เข้ามาได้โดยสมบูรณ์










No comments: