NS CGM 安装必要条件
- 有自己的云服务器
- 好像没有2,有云服务器就行了
安装顺序
- 先安装数据库,目前支持的是 MongoDB ,官方推荐4,其实目前最新版本就行。可以用宝塔安装,比较简单
- 克隆代码,我是放到 /opt/ns 目录中了
- 安装nodejs,进入代码目录,运行 npm install
- 启动cgm
具体代码
yum install epel-releasecurl -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh | bash
nvm install 16.20.1
nvm use 16.20.1cd /opt
git clone https://github.com/nightscout/cgm-remote-monitor.git
ln -s cgm-remote-monitor nightscout
cd nightscoutnpm inpm install pm2 -g# 这里需要创建一个 my.env ,保存配置文件,文件内容见下方env $(cat my.env) PORT=1337 pm2 start server.jspm2 savepm2 startup
pm2 unstartup systemd
my.env 配置文件,官方有个工具,可以用这个工具生成配置:
https://nightscout.github.io/_downloads/8ff7fa269d11fd145d3ac558602ade94/NightscoutVariablesUbuntu.html
ALARM_HIGH=on
ALARM_LOW=on
ALARM_TIMEAGO_URGENT=on
ALARM_TYPES=simple
ALARM_TIMEAGO_WARN=on
ALARM_URGENT_HIGH=on
ALARM_URGENT_LOW=on
BRIDGE_SERVER=US
DISPLAY_UNITS=mmol/l
NIGHT_MODE=on
THEME=colors
TIME_FORMAT=24
ALARM_TIMEAGO_URGENT_MINS=30
ALARM_TIMEAGO_WARN_MINS=15
BASE_URL=http://127.0.0.1:1337
API_SECRET=111111111111111111111111
BG_HIGH=260
BG_LOW=55
BG_TARGET_BOTTOM=70
BG_TARGET_TOP=180
BOLUS_RENDER_OVER=1
BRIDGE_PASSWORD=
BRIDGE_USER_NAME=
CUSTOM_TITLE=Nightscout
ENABLE=careportal%20basal%20dbsize%20rawbg%20iob%20maker%20cob%20bwp%20cage%20iage%20sage%20boluscalc%20pushover%20treatmentnotify%20loop%20pump%20profile%20food%20openaps%20bage%20alexa%20override%20speech%20cors
MONGO_CONNECTION=mongodb://127.0.0.1:27017/ns
SHOW_PLUGINS=careportal%20dbsizePORT=1337
HOSTNAME=0.0.0.0
配置一下nginx,做个代理
location / {proxy_pass http://127.0.0.1:1337;proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection 'upgrade';proxy_set_header Host $host;proxy_cache_bypass $http_upgrade;proxy_set_header X-Forwarded-Proto "https";}location /translations/ {}
location /bundle/ {}
location /js/ {}