4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

building and running catapult-rest on ubuntu16.04

Last updated at Posted at 2018-05-17

catapult-serverはなんとなく動いているよう。

  • catapult-serverの構築と実行

次はcatapult-restの構築と実行に挑戦。
とりあえず動いたみたい。

次は複数ノードを立ち上げてみるか・・・

npm start resources/rest.json
> catapult-api-rest@1.0.7 start /home/ryo/catapult/catapult-rest/rest
> node _build/index.js "resources/rest.json"

info: loading config from resources/rest.json
2018-05-17T22:40:33.900Z - verbose: finished loading rest server config
{ network:
   { name: 'mijinTest',
     description: 'catapult development network' },
  port: 3000,
  crossDomainHttpMethods: [ 'GET', 'POST', 'PUT', 'OPTIONS' ],
  clientPrivateKey: '0000000000000000000000000000000000000000000000000000000000000000',
  extensions: [ 'aggregate', 'lock', 'multisig', 'namespace', 'transfer' ],
  db:
   { url: 'mongodb://localhost:27017/',
     name: 'catapult',
     pageSizeMin: 10,
     pageSizeMax: 100,
     pageSizeStep: 25,
     maxConnectionAttempts: 5,
     baseRetryDelay: 500 },
  apiNode:
   { host: '127.0.0.1',
     port: 7900,
     publicKey: 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' },
  websocket:
   { mq:
      { host: '127.0.0.1',
        port: 7902,
        monitorInterval: 500,
        connectTimeout: 10000,
        monitorLoggingThrottle: 60000 },
     allowOptionalAddress: true },
  logging:
   { console:
      { colorize: true,
        level: 'verbose',
        handleExceptions: true,
        prettyPrint: true,
        timestamp: true },
     file:
      { level: 'verbose',
        handleExceptions: true,
        prettyPrint: true,
        timestamp: true,
        filename: 'catapult-rest.log',
        maxsize: 20971520,
        maxFiles: 100 } } }
2018-05-17T22:40:33.914Z - info: connecting to mongodb://localhost:27017/ (database:catapult)
2018-05-17T22:40:34.023Z - verbose: connected to mongo at mongodb://localhost:27017/catapult
2018-05-17T22:40:34.025Z - info: registering routes
2018-05-17T22:40:34.101Z - info: listening on port 3000

以下、手順。

yarn

sudo apt install -y apt-transport-https
sudo apt-get -qq update
sudo apt-get -qq -y install curl
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install -y yarn

nodejs

curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt install -y nodejs
sudo apt install -y npm
sudo npm cache clean
sudo npm install n -g
sudo n 9.11.0
sudo rm /usr/bin/nodejs /usr/bin/npm
sudo ln -s /usr/local/bin/node /usr/bin/nodejs
sudo ln -s /usr/local/bin/npm /usr/bin/npm

mongodb

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt update
sudo apt install -y apt-transport-https
sudo apt install -y mongodb-org
sudo service mongod start

catapult-rest(package.jsonを修正しないと動かなかった)

git clone https://github.com/nemtech/catapult-rest
cd catapult-rest
# ちょっと修正。後述
vi rest/package.json
./yarn_setup.sh
cd rest
npm install
npm run-script build
npm start resources/rest.json

rest/package.json

--- package.json.bak    2018-05-17 19:20:34.444544896 -0400
+++ package.json        2018-05-17 18:22:14.033178093 -0400
@@ -35,7 +35,7 @@
     "rimraf": "^2.6.2"
   },
   "dependencies": {
-    "catapult-sdk": "link:../catapult-sdk",
+    "catapult-sdk": "../catapult-sdk",
     "coveralls": "^3.0.1",
     "mongodb": "^3.0.3",
     "nyc": "^11.8.0",

4
0
10

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?