LoginSignup
8
8

More than 5 years have passed since last update.

Crowiをdocker-nodeで動かすまでのメモ

Last updated at Posted at 2016-09-07

目的

研究室内の情報共有用にいい感じで使えるmarkdown形式のwikiがほしい。
ついでにdockerでデプロイ出来ると楽だしいいな。

Crowiとは

markdown表記のwiki
ref: http://site.crowi.wiki/

構成

  • docker
  • node:4.5-slim
  • mongodb
  • redis
  • crowi v1.5.0

※追記 2016/09/09
最初crowiのmasterブランチからcloneしてましたが、公式によるとmasterは非推奨でした。
ご指摘してくださった方ありがとうございます。

セットアップ

nodeの設定

nodeコンテナの用意

$ docker run -dit --name crowi -p 80:80 node:4.5-slim

以下コンテナ内での作業

# aptのupdateとcrowiに必要なバイナリのインストール
$ apt-get update
$ apt-get -y install git python g++ make mongodb redis-server

# crowiのクローン
$ git clone -b v1.5.0 https://github.com/crowi/crowi.git
$ cd crowi
$ npm install

なんかエラー出た...

npm ERR! Linux 4.4.12-boot2docker
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.5.0
npm ERR! npm  v2.15.9
npm ERR! code ELIFECYCLE

npm ERR! time@0.11.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the time@0.11.4 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the time package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs time
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls time
npm ERR! There is likely additional logging output above.

c++やpythonが入っていないとエラーがnode-gypのbuildで失敗する模様。

ref: https://github.com/nodejs/node-gyp
If node-gyp is called by way of npm and you have multiple versions of Python installed, then you can set npm's 'python' config key to the appropriate value:

$ npm config set python /path/to/executable/python2.7

npmにpythonのpathを教えてあげる

$ npm config set `which python`

再度 npm install を実行

mongodb起動

$ mongod --dbpath /var/lib/mongodb --logpath /var/log/mongodb.log

redis起動

$ redis-server

crowi起動

$ PORT=80 MONGO_URI=mongodb://localhost/var/lib/mongodb REDIS_URL=redis://localhost:6379 node app.js

buildに失敗しているとjsやcssが読み込まれない。その場合は手動でbuildしなおす。

$ npm run build

http://localhostにアクセスし次の画面が表示されたらok


crowiセットアップ画面

さいごに

とりあえず使っみてどんな感じか把握したいなー
pukiwikiを使うかこちらを使うか...

追記 2016/09/11

DockerfileでCrowiをビルドする記事を書きました
-> DockerfileでCrowiのビルドとDocker ComposeでCrowiの実行

8
8
0

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
8
8