running catapult-server on ubuntu16.04

catapult serverのビルド([building catapult-server on ubuntu16.04](https://qiita.com/ryosasa/items/f851518347f74836c9b8))が完了したので、次はcatapultの起動確認。


なんか動き始めたけど、絶対なにか違いそう。
./catapult.tools.nemgenでエラーになっているんだよな・・・
正式ドキュメントを待つか・・・

###追記
たぶんnemesisファイルは以下の手順で再生成する必要がある。
[generating nemesis block for catapult-server](https://qiita.com/ryosasa/items/d3df68213e5db29efc48)

#### catapult-serverの起動
```
cd catapult-server/_build/bin
mkdir -p ../data/00000
mkdir -p ../seed/mijin-test
./catapult.tools.nemgen -r ../../tools/nemgen/resources/mijin-test.properties
cp ../seed/mijin-test/00000/00001.dat ../data/00000
./catapult.server ../..
...
...
...
```

## 以下ゴミ。あとで消す。

しかし、やっぱりエラーで先に進めない^^;

```
cd catapult-server/_build/bin
mkdir ../data
./catapult.server ../..
...
...
...
pushing scope 'booting local node'
2018-05-17 04:16:34.998610 0x00007f7cff179740: <error> (io::RawFile.cpp@193) couldn't open the file ../data/00000/00001.dat (invalid)
2018-05-17 04:16:34.998741 0x00007f7cff179740: <error> (io::RawFile.cpp@193) Throwing exception: couldn't open the file
2018-05-17 04:16:34.999352 0x00007f7cff179740: <info> (utils::StackLogger.h@47) popping scope 'booting local node' (1ms)

```
たぶん、catapult.server起動時のエラーは、最初のブロック(nemesis)の入ったファイル(../data/00000/00001.dat)が見つからないというエラーのように思うんだけど。

しかし、nemesisの作成方法がわからねー！

これか?
bin/catapult.tools.nemgen

とりあえず実行してみたけどやっぱりaddressが違うっていうエラーが出てダメだった。

```
./catapult.tools.nemgen -r ../../tools/nemgen/resources/mijin-test.nis1.properties
Nemesis Block Generator Tool
Copyright (c) Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp.
catapult version: 0.1.0.1 f9014ab [master]
...
2018-05-17 05:34:23.117794 0x00007f2adad52740: <warning> (nemgen::main.cpp@126) address SCHC72JZZSO3OKXIB6TSOVA4BTT6A2CRXMVKOJAV is invalid
```

これ私の勘違い！
~~"address SCHC72JZZSO3OKXIB6TSOVA4BTT6A2CRXMVKOJAV is invalid"か・・・
そういえば、たしかmijinのアドレスはM始まりじゃなかったっけなーと思ったので、SをMに置換して実行したら少し進んだ。~~

#### catapult-server/tools/nemgen/resources/mijin-test.nis1.properties
```
[distribution>nem:xem]

MCA6I5AP4X4B3U4GTO2FU7SJD4UDX37I6SEVR3GP = 409'090'909'000'000
MCHC72JZZSO3OKXIB6TSOVA4BTT6A2CRXMVKOJAV = 409'090'909'000'000
MBJMEHK43TA4GYFDK6WZDYZEIDNTI7UVFLA4ISCQ = 409'090'909'000'000
MCTMMUHWPBQSVQGHWOZBOHWM3QRNU6KZRAPS3TDP = 409'090'909'000'000
...
```

```
cd bin
mkdir -p ../seed/mijin-test
./catapult.tools.nemgen -r ../../tools/nemgen/resources/mijin-test.properties
...
2018-05-17 05:57:30.558614 0x00007f2d765ff740: <error> (io::FileBasedStorage.cpp@108) Throwing exception: hashes.dat has invalid size (0)

ls ../seed/mijin-test/00000/
00001.dat  hashes.dat

cp ../seed/mijin-test/00000/00001.dat ../data/0000
./catapult.server ../..
...
2018-05-17 06:01:20.806556 0x00007f28a8c81700: <warning> (chain::RemoteApiForwarder.h@54) [21 log count] no packet io available for operation 'pull unconfirmed transactions task'
2018-05-17 06:01:32.721910 0x00007f28a8c81700: <warning> (src::NetworkPacketWritersService.cpp@46) could not find any peer for detecting chain heights
2018-05-17 06:01:47.723392 0x00007f28a3fff700: <warning> (src::NetworkPacketWritersService.cpp@46) could not find any peer for detecting chain heights
```


## 手順
#### 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-serverの実行
```
cd catapult-server/_build/bin
mkdir ../data
./catapult.server ../..
```

#### ログ
```
Copyright (c) Jaguar0625, gimre, BloodyRookie, Tech Bureau, Corp.
catapult version: 0.1.0.1 f9014ab [master]
loading resources from "../../resources"
loading configuration from "../../resources/config-network.properties"
loading configuration from "../../resources/config-user.properties"
loading configuration from "../../resources/config-logging.properties"
loading configuration from "../../resources/config-node.properties"
2018-05-17 04:16:34.907622 0x00007f7cff179740: <info> (server::ServerMain.cpp@61) booting local node with public key 43EEB17F0BAB10DD51AB70983C25200A1742D31B3B7B54C38C34D7B827B26EED
2018-05-17 04:16:34.914221 0x00007f7cff179740: <info> (thread::IoServiceThreadPool.cpp@105) server IoServiceThreadPool spawned 2 workers
2018-05-17 04:16:34.914688 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.unbondedpruning.so
2018-05-17 04:16:34.918881 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.unbondedpruning
2018-05-17 04:16:34.919089 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.sync.so
2018-05-17 04:16:34.926301 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.sync
loading configuration from "../../resources/config-task.properties"
2018-05-17 04:16:34.929089 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.packetserver.so
2018-05-17 04:16:34.934414 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.packetserver
2018-05-17 04:16:34.934673 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.nodediscovery.so
2018-05-17 04:16:34.940278 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.nodediscovery
2018-05-17 04:16:34.941190 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.diagnostics.so
2018-05-17 04:16:34.944598 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.diagnostics
2018-05-17 04:16:34.944825 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.syncsource.so
2018-05-17 04:16:34.948362 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.syncsource
2018-05-17 04:16:34.948846 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.eventsource.so
2018-05-17 04:16:34.954185 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.eventsource
2018-05-17 04:16:34.954428 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.timesync.so
2018-05-17 04:16:34.961431 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.timesync
loading configuration from "../../resources/config-timesync.properties"
2018-05-17 04:16:34.961937 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.networkheight.so
2018-05-17 04:16:34.965544 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.networkheight
2018-05-17 04:16:34.965748 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.harvesting.so
2018-05-17 04:16:34.970379 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.harvesting
loading configuration from "../../resources/config-harvesting.properties"
2018-05-17 04:16:34.971104 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.hashcache.so
2018-05-17 04:16:34.974078 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.hashcache
2018-05-17 04:16:34.974353 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.transactionsink.so
2018-05-17 04:16:34.977400 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.transactionsink
2018-05-17 04:16:34.977663 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libextension.filechain.so
2018-05-17 04:16:34.980450 0x00007f7cff179740: <info> (extensions::LocalNodeBootstrapper.cpp@102) registering dynamic extension extension.filechain
2018-05-17 04:16:34.981091 0x00007f7cff179740: <info> (local::BasicLocalNode.cpp@64) registering system plugins
2018-05-17 04:16:34.981476 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libcatapult.plugins.signature.so
2018-05-17 04:16:34.982446 0x00007f7cff179740: <info> (plugins::PluginLoader.cpp@50) registering dynamic plugin catapult.plugins.signature
2018-05-17 04:16:34.982552 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libcatapult.plugins.hashcache.so
2018-05-17 04:16:34.983961 0x00007f7cff179740: <info> (plugins::PluginLoader.cpp@50) registering dynamic plugin catapult.plugins.hashcache
2018-05-17 04:16:34.984335 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libcatapult.plugins.aggregate.so
2018-05-17 04:16:34.986039 0x00007f7cff179740: <info> (plugins::PluginLoader.cpp@50) registering dynamic plugin catapult.plugins.aggregate
2018-05-17 04:16:34.986422 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libcatapult.plugins.lock.so
2018-05-17 04:16:34.988740 0x00007f7cff179740: <info> (plugins::PluginLoader.cpp@50) registering dynamic plugin catapult.plugins.lock
2018-05-17 04:16:34.989208 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libcatapult.plugins.transfer.so
2018-05-17 04:16:34.990704 0x00007f7cff179740: <info> (plugins::PluginLoader.cpp@50) registering dynamic plugin catapult.plugins.transfer
2018-05-17 04:16:34.990944 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libcatapult.plugins.namespace.so
2018-05-17 04:16:34.993591 0x00007f7cff179740: <info> (plugins::PluginLoader.cpp@50) registering dynamic plugin catapult.plugins.namespace
2018-05-17 04:16:34.994681 0x00007f7cff179740: <info> (plugins::PluginModule.cpp@79) loading plugin from ./libcatapult.plugins.multisig.so
2018-05-17 04:16:34.996726 0x00007f7cff179740: <info> (plugins::PluginLoader.cpp@50) registering dynamic plugin catapult.plugins.multisig
2018-05-17 04:16:34.997387 0x00007f7cff179740: <info> (utils::StackLogger.h@37) pushing scope 'booting local node'
2018-05-17 04:16:34.998610 0x00007f7cff179740: <error> (io::RawFile.cpp@193) couldn't open the file ../data/00000/00001.dat (invalid)
2018-05-17 04:16:34.998741 0x00007f7cff179740: <error> (io::RawFile.cpp@193) Throwing exception: couldn't open the file
2018-05-17 04:16:34.999352 0x00007f7cff179740: <info> (utils::StackLogger.h@47) popping scope 'booting local node' (1ms)
2018-05-17 04:16:34.999504 0x00007f7cff179740: <fatal> (local::BasicLocalNode.cpp@199) unhandled exception while boot!
/home/ryo/catapult/catapult-server/src/catapult/io/RawFile.cpp(193): Throw in function catapult::io::RawFile::RawFile(const string&, catapult::io::OpenMode, catapult::io::LockMode)
Dynamic exception type: boost::exception_detail::clone_impl<catapult::catapult_error<catapult::catapult_error<std::runtime_error> > >
std::exception::what: couldn't open the file

2018-05-17 04:16:34.999738 0x00007f7cff179740: <error> (local::BasicLocalNode.cpp@200) Throwing exception: couldn't open the file
2018-05-17 04:16:34.999910 0x00007f7cff179740: <info> (utils::StackLogger.h@37) pushing scope 'shutting down local node'
2018-05-17 04:16:35.001946 0x00007f7cff179740: <info> (thread::IoServiceThreadPool.cpp@114) server IoServiceThreadPool all threadpool threads exited
2018-05-17 04:16:35.002123 0x00007f7cff179740: <info> (utils::StackLogger.h@47) popping scope 'shutting down local node' (2ms)
2018-05-17 04:16:35.002439 0x00007f7cff179740: <info> (extensions::ServiceLocator.h@45) destroying 0 rooted services
2018-05-17 04:16:35.005205 0x00007f7cff179740: <fatal> (server::ServerMain.cpp@100) unhandled exception while running local node!
/home/ryo/catapult/catapult-server/src/catapult/local/BasicLocalNode.cpp(200): Throw in function std::unique_ptr<catapult::local::BootedLocalNode> catapult::local::CreateBasicLocalNode(const catapult::crypto::KeyPair&, std::unique_ptr<catapult::extensions::LocalNodeBootstrapper>&&)
Dynamic exception type: boost::exception_detail::clone_impl<catapult::catapult_error<std::runtime_error> >
std::exception::what: couldn't open the file
```