ししちにじゅうはち 4x7=28

よんたったー https://twitter.com/keita44_f4

Raspberry Pi 2でのWekanの動かし方

まとめ

  • Raspberry PiでWekanは動くらしい
  • 個人的にはWekanをRaspberry Piで動かせなかった
    • Wekan(prebuild)は起動途中でnodeパッケージがELFエラーする
    • MeteorでWekanをbuildしようとすると、パッケージcfs:gridfsのArmv7向けがなく失敗する

参考元

概要

Node.jsの準備
→Meteorのインストール
→Wekanのビルド
→Wekanのインストール

  • apt-getしておくツール
    • git-core mongodb mongodb-server make g++ gcc build-essential libssl-dev curl

Node.jsの準備

gitレポジトリからnode.jsを持ってくる。
Wekanの都合から、node.jsはv0.10.40をいれないといけない。
nvm(Node Version Manager)とnpm(node package manager)を使うのがメジャーなようなので、採用する。
なお、node.jsのインストールは時間がかかる。
また、source ~/.nvm/nvm.shを.profileに記述する。

$ git clone https://github.com/creationix/nvm.git ~/.nvm
$ ~/.nvm/nvm.sh
$ nvm install v0.10.40
$ npm update -g npm

Meteorのインストール

MeteorはWekanのビルドに必要なだけなので、$HOMEへ置く。
管理者権限は必要ない。
そこそこ時間がかかる。

$ cd $HOME
$ git clone --depth 1 https://github.com/4commerce-technologies-AG/meteor.git
$ $HOME/meteor/meteor --version

途中でcurlの認証書エラーがする場合は、必要に応じて証明書をアップデートする。
ただし、ラズパイの証明書のアップデート方法を調べるのがめんどかったので、今回は-kオプションを使いエラーを無視した。

--- ./git/meteor/meteor 2016-04-07 14:41:11.560265384 +0900
+++ ./meteor/meteor     2016-04-07 22:41:14.946819041 +0900
@@ -1,6 +1,8 @@
 #!/usr/bin/env bash

 BUNDLE_VERSION=0.5.16
+CURLFLAGS='-k'

 # OS Check. Put here because here is where we download the precompiled
 # bundles that are arch specific.
@@ -100,7 +102,7 @@

     # test if we can download the dev_bundle tarball
     function __check_tarball_download() {
-      CHECK_TARBALL=$(curl --head --location --silent "$DEV_BUNDLE_URL_ROOT$TARBALL" --output /dev/null --write-out '%{http_code}')
+      CHECK_TARBALL=$(curl $CURLFLAGS --head --location --silent "$DEV_BUNDLE_URL_ROOT$TARBALL" --output /dev/null --write-out '%{http_code}')
       # Write down a message instead doing a false download
       if [ "$CHECK_TARBALL" != "200" ] ; then
         if [ -n "$METEOR_UNIVERSAL_FLAG" ] ; then
@@ -127,11 +129,11 @@
     elif [ -n "$SAVE_DEV_BUNDLE_TARBALL" ] ; then
         # URL duplicated in tools/server/target.sh.in
         __check_tarball_download
-        curl --location -# "$DEV_BUNDLE_URL_ROOT$TARBALL" >"$SCRIPT_DIR/$TARBALL"
+        curl $CURLFLAGS --location -# "$DEV_BUNDLE_URL_ROOT$TARBALL" >"$SCRIPT_DIR/$TARBALL"
         tar -xzf "$SCRIPT_DIR/$TARBALL" -C "$BUNDLE_TMPDIR"
     else
         __check_tarball_download
-        curl --location -# "$DEV_BUNDLE_URL_ROOT$TARBALL" | tar -xzf - -C "$BUNDLE_TMPDIR"
+        curl $CURLFLAGS --location -# "$DEV_BUNDLE_URL_ROOT$TARBALL" | tar -xzf - -C "$BUNDLE_TMPDIR"
     fi

     # In case that we have to use the universal system environment, make sure

(Additional)Meteorのインストールの確認

心配な人はMeteorのexampleを動かす。
時間はかかる。

$ cd $HOME
$ $HOME/meteor/meteor create --example todos
$ cd todos
$ $HOME/meteor/meteor
$ # この後に、http://[IP Address]:3000/ にアクセス

以下のようなエラーが起きた場合は、localesをen_GB.UTF-8からen_US.UTF-8に変更すると治る。
公式githubで議論されてる。

$ ~/meteor/meteor
[[[[[ ~/tmp/meteor-test/todos ]]]]]

=> Started proxy.
Unexpected mongo exit code 1. Restarting.
Unexpected mongo exit code 1. Restarting.
Unexpected mongo exit code 1. Restarting.
Can't start Mongo server.
MongoDB failed global initialization

Looks like MongoDB doesn't understand your locale settings. See
https://github.com/meteor/meteor/issues/4019 for more details.
$ sudo dpkg-reconfigure locales # en_US.UTF-8にする
$ ~/meteor/meteor
[[[[[ ~/tmp/meteor-test/todos ]]]]]

=> Started proxy.
=> Started MongoDB.
   Starting your app
$ # この後に、http://[IP Address]:3000/ にアクセス

Wekanのビルド

TODO、うまくいってない。

$ git clone https://github.com/wekan/wekan.git
$ cd wekan
$ git checkout v0.10.1

Wekanのインストール

公式提供のautoscriptを使う。
ただし、公式のレポジトリからzipを落とす部分を、自分でビルドしたWekanを使うように書き換えて実行する。
また、sudoではなくsudo suしてrootアカウントにならないとディレクトリ権限がおかしくなりエラーで落ちる。
気づかずにだいぶハマった。

$ git clone https://github.com/anselal/wekan/blob/master/autoinstall_wekan.sh
$ vi ./wekan/autoinstall_wekan.sh
$ sudo su
# ./wekan/autoinstall_wekan.sh
- wget https://github.com/wekan/wekan/releases/download/v0.10.1/wekan-0.10.1.tar.gz
+ # wget https://github.com/wekan/wekan/releases/download/v0.10.1/wekan-0.10.1.tar.gz

終わると、/etc/init.d/wekanと/usr/local/bin/get-ip-addressと/etc/network/if-up.d/show-ip-addressが作成される。
ポート番号などの設定は/etc/init.d/wekanの変数を書き換える。
get-ip-addressの中身は単純なbash script。
ちなみに、Debian testingを使った際は、ifconfigのフォーマットが合わないので改変する必要がある。