将Crowi在Docker-Node上运行的步骤记录

翻译:
目标

我想要一个能在实验室内进行信息共享的好用的Markdown格式的维基。如果能够在docker上部署就更好了,方便又实用。

Crowi是什么

标记语言的维基百科,参考:http://site.crowi.wiki/

组成

    • docker

 

    • node:4.5-slim

 

    • mongodb

 

    • redis

 

    crowi v1.5.0

※补充说明 2016/09/09
起初我是从crowi的master分支进行克隆的,但根据官方的说明,master已经不推荐使用。
非常感谢指出这一点的朋友们。

セットアップ

节点的配置设置

准备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的构建失败。

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的路径。

$ 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

如果构建失败,JavaScript和CSS将无法加载。在这种情况下需要手动重新构建。

$ npm run build

当在浏览器中访问 http://localhost,并显示以下屏幕时,点击确定。

crowiセットアップ画面

最后

先试试看吧,想要先了解一下使用的感觉。
要用PukiWiki还是用这边的?

附加信息 2016/09/11

我写了一篇关于使用Dockerfile构建Crowi的文章,以及使用Docker Compose运行Crowi

广告
将在 10 秒后关闭
bannerAds