Crowi
システム要件
必須
- Node.js (6.x)
- MongoDB
オプション
- Elasticsearch
- Redis
- Amazon S3
- Google Project
- Slack App
システム構成例
- CentOS 7.3.1611 (minimal)
- Node.js 6.10.2 (nodesource)
- MongoDB 3.4.4 (mongodb-org-3.4)
インストール
アップデート
yum clean all && yum -y update && reboot
Node.js
curl -sL https://rpm.nodesource.com/setup_6.x | bash - && yum -y install nodejs
MongoDB
cat << "_EOF_" > /etc/yum.repos.d/mongodb.repo
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
_EOF_
yum -y install mongodb-org && systemctl start mongod && systemctl enable $_
Redis
yum -y install epel-release && yum -y install redis && systemctl start $_ && systemctl enable $_
Elasticsearch
cat << "_EOF_" > /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-5.x]
name=Elasticsearch repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
_EOF_
yum -y install elasticsearch && systemctl start $_ && systemctl enable $_
Crowi
yum -y install git gcc-c++ krb5-devel
useradd crowi && su - crowi
git clone https://github.com/crowi/crowi.git && cd crowi
git checkout $(git tag | tail -n 1)
npm install
exit
krb5-devel がないと 致命的エラー: gssapi/gssapi.h: そのようなファイルやディレクトリはありません
というエラーが出る。
echo 'use crowi' | mongo
mongo crowi --eval 'db.createUser({user: "crowi", pwd: "P@ssw0rd", roles: [{role: "readWrite", db: "crowi"}]})'
mongo admin --eval "db.system.users.find()"
cat << "_EOF_" > /etc/systemd/system/crowi.service
[Unit]
Description=Crowi
After=network.target mongod.service
[Service]
WorkingDirectory=/home/crowi/crowi
EnvironmentFile=/etc/sysconfig/crowi
ExecStart=/usr/bin/node app.js
[Install]
WantedBy=multi-user.target
_EOF_
cat << _EOF_ > /etc/sysconfig/crowi
PORT=3000
NODE_ENV=production
MONGO_URI="mongodb://crowi:P%40ssw0rd@localhost/crowi"
REDIS_URL="redis://localhost:6379"
ELASTICSEARCH_URI="http://localhost:9200"
#SECRET_TOKEN=
PASSWORD_SEED="`openssl rand -base64 128 | head -1`"
FILE_UPLOAD=local
_EOF_
パスワードに @
が含まれる場合は %40
に置き換えてやる必要がある。
systemctl daemon-reload && systemctl start crowi && systemctl enable $_
firewall-cmd --add-port=3000/tcp
setenforce 0