官方文档:https://resources.count.ly/docs/installing-countly-server
服务器:ubuntu 16.04
直接执行即可:
sudo su -
wget -qO- http://c.ly/install | bash
问题1:
跑完后使用systemctl
查看服务,结果没有需要的内容。需要手动重新安装:
bash countly/bin/countly.install_ubuntu.sh
问题2:
mongo数据库启动失败,日志:
mongod.service: Main process exited, code=exited, status=1/FAILURE
mongod.service: Unit entered failed state.
mongod.service: Failed with result 'exit-code'.
修改/etc/systemd/system/mongod.service
[Unit]
Description=An object/document-oriented database
Documentation=man:mongod(1)
Wants=network.target
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
User=mongodb
Group=mongodb
Type=simple
LimitFSIZE=infinity
LimitCPU=infinity
LimitAS=infinity
LimitNOFILE=64000
LimitRSS=infinity
LimitNPROC=64000
TimeoutStopSec=300
Restart=always
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/lib/mongodb
ExecStartPre=/bin/chown mongodb:mongodb /var/lib/mongodb
ExecStartPre=/bin/chown mongodb:mongodb /var/log/mongodb/mongod.log
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
ExecReload=/bin/kill -HUP $MAINPID
原因是/var/lib/mongodb
和/var/log/mongodb/,ongod.log
没有权限。
问题3:
countly启动失败,api和dash都没有运行,查看端口:
netstat -ant | grep 3001
netstat -ant | grep 6001
查看js的log:
Error: Could not locate the bindings file. Tried:
解决方案:
# 第一步:
npm rebuild
# 第二步:
grunt dist-all
直接把/var/lib/mongodb
映射过去就是。
缺点:构建非常非常慢!!!