Leanote
目录
docker on pi3
diy
http://mirrors.163.com/debian-cd/current/amd64/iso-cd/ docker build -t evan886/leanote:v1 .
docker
docker at apline on pi3
Leanote 二进制版详细安装教程 Mac and Linux
https://github.com/axboy/docker-leanote/tree/2.6.1
https://github.com/axboy/docker-leanote/blob/master/README.md
monogo
Docker mongo 详情请见
docker monogo
搭建了,要看如何导入数据了 robo好像不行 莓派3B 使用 Docker 安装 MongoDB 由于树莓派是基于 Armv7l 平台,平常用于 x86 的 Mongodb docker 镜像并不能直接安装,因此本文目的为解决在树莓派3B Raspbian Stretch 系统上使用 Docker 安装运行 MongoDB 镜像的问题。 docker pull andresvidal/rpi3-mongodb3 # 创建容器 docker run -d --name rpi-mongodb3 -v /data/mongo:/data.db -p 27017:27017 andresvidal/rpi3-mongodb3 mongod mongodb-clients mongodb-dev mongodb-server 其实要有密码更加好一点 https://www.jianshu.com/p/a3de04b49ea4 https://hub.docker.com/r/andresvidal/rpi3-mongodb3/ #理论上这个是可以的哦 那样就可以 docker化了 导入初始数据 直接用studio 3t -->import -->JSON --> 添加 选择所有的文件 导入初始数据 leanote初始数据存放在 leanote/mongodb_backup/leanote_install_data中。 打开终端, 输入以下命令导入数据。 $> mongorestore -h localhost -d leanote --dir /home/user1/leanote/mongodb_backup/leanote_install_data/ mongorestore -h 192.168.88.98 -d leanote --dir /data/mongo/leanote_install_data/ mongorestore -h localhost -d leanote --directoryperdb /media/sea2t/srv/leanote/mongodb_backup/leanote_install_data/ $> mongorestore -h localhost -d leanote --dir /home/user1/leanote/mongodb_backup/leanote_install_data/
bina monogo
#还有 一种办法就是 下载 bin包 apt-get update echo "deb http://repo.mongodb.org/apt/debian stretch/mongodb-org/4.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list sudo apt-get install -y mongodb-org #这个太老了 apt-get install mongodb systemctl enable mongodb #这个是手工安装mongo的 mkdir -p /data/mongo/data mongod --dbpath /data/mongo/data 此时mongodb数据库已经启动,然后另外打开一个SSH终端窗口输入mongo进入mongodb数据库交互程序 然后输入show dbs 下方会显示数据库列表。 3. 导入leanote初始数据 leanote初始数据存放在 ~/leanote/mongodb_backup/leanote_install_data中。 在SSH终端中输入下方命令导入初始数据(注意:不是在数据库交互程序中) mongorestore -h localhost -d leanote --dir /home/pi/leanote/mongodb_backup/leanote_install_data/
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/
leanote install
https://github.com/leanote/leanote/releases
下载 leanote-linux-amd64-v2.6.1.bin.tar.gz
解压到 /data/apps/leanote/ /usr/bin/nohup /data/apps/frp/frpc -c /data/apps/frp/frpc.ini & #想自启动 入到 /etc/rc.local
超级用户修改和用户添加
./mongo 创建账户 新建的账户名为 test1, 邮箱为 [email protected], 密码由于是加密的, 就不在这里设置, 通过管理员到界面上去重置密码. > use leanote > db.users.insert({"Username": "eva", "Email": "[email protected]"}) 然后改密码在web 界面 改就是了 , http://192.168.88.98:9000/admin/index 最后才是 打开配置文件 改为 admin user 在app.conf中配置 adminUsername=修改后的用户名 cat /data/apps/leanote/conf/app.conf # admin username #adminUsername=admin adminUsername=eva 删除用户 > use leanote switched to db leanote > db.users.remove({"Username":"[email protected]"}) > db.users.remove({"Username":"demo"}) 关闭公开注册 http://192.168.88.98:9000/admin/t?t=setting/open_register
nginx 配置
2020 ng conf
cat leanotefrp.conf #on vps upstream t.upstream.linuxsa.org { server 127.0.0.1:9000; #server 127.0.0.1:7000; keepalive 32; } server { listen 80; server_name note.linuxsa.org; location / { proxy_pass http://t.upstream.linuxsa.org; proxy_http_version 1.1; proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } #index index.html; index index.php index.htm index.html; location ~ .*\.(gif|jpg|jpeg|png|bmp|ico|swf|html|htm|mp3|wma|js|css)$ { root /data/apps/leanote/public/; expires 7d; } access_log off; } ps css 文件上传到vps cat tranlea #!/bin/bash rsync -avz /data/apps/leanote/public/ root@vpsip:/data/apps/leanote/public/ ssh root@vpsip "chown -R www-data:www-data /data/apps/leanote/public/" 外加个定时任务
# on bsd #201811 server { listen 80; server_name t.linuxsa.org; location / { proxy_pass http://t.upstream.linuxsa.org; proxy_http_version 1.1; proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } index index.php index.htm index.html; #index index.html; #这下面4行不要,不然会加载不了 远程intra的 css 什么的 #location ~ .*\.(gif|jpg|jpeg|png|bmp|ico|swf|html|htm|mp3|wma|js|css)$ { #root /data/apps/leanote/public/; # expires 7d; #} access_log off; } upstream t.upstream.linuxsa.org { server 10.46.0.5:9000; keepalive 32; } #on debian at intra cat t.linuxsa.conf upstream t.upstream.linuxsa.org { server 192.168.0.128:9000; keepalive 32; } server { listen 80; server_name t.linuxsa.org; location / { proxy_pass http://t.upstream.linuxsa.org; proxy_http_version 1.1; proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } #index index.html; index index.php index.htm index.html; location ~ .*\.(gif|jpg|jpeg|png|bmp|ico|swf|html|htm|mp3|wma|js|css)$ { root /data/apps/leanote/public/; expires 7d; } access_log off; } #有一次可怕的错误 mv note.linuxsa.org note.linuxsa.org.conf #on pi3 root@mypi3b:/etc/nginx/conf.d# cat note.linuxsa.org.conf upstream t.upstream.linuxsa.org { server 192.168.88.98:9000; keepalive 32; } server { listen 80; server_name note.linuxsa.org; location / { proxy_pass http://t.upstream.linuxsa.org; proxy_http_version 1.1; proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } #index index.html; index index.php index.htm index.html; location ~ .*\.(gif|jpg|jpeg|png|bmp|ico|swf|html|htm|mp3|wma|js|css)$ { root /data/apps/leanote/public/; expires 7d; } access_log off; } root@mypi3b:/etc/nginx/conf.d# cat /data/apps/frp/frpc.ini [common] server_addr = 207.148.106.229 #server_addr = 138.197.220.125 server_port = 7001 auth_token = 123 [leanote] type = http local_port = 9000 custom_domains =note.linuxsa.org #[ssh] #type = tcp #local_ip = 127.0.0.1 #local_port = 22 #remote_port = 6000
frp
frps on vps
cat /data/apps/frp/frps.ini [common] bind_port = 7000 vhost_http_port = 9000 [leanote] type = http auth_token = 123 custom_domains =note.linuxsa.org
frpc on pi3 at intra
cat /data/apps/frp/frpc.ini [common] server_addr = 20.148.15.279 # vps ip at abord server_port = 7000 auth_token = 123 [leanote] type = http local_port = 9000 custom_domains =note.linuxsa.org #[ssh] #type = tcp #local_ip = 127.0.0.1 #local_port = 22 #remote_port = 6000
有几次老是time out 原来是vps上的os防火墙导致的
client app
https://sourceforge.net/projects/leanote-desktop-app/
leanote-desktop-linux-x64-v2.6.zip
android
记得服务器要带有 http 不然会登录不成功哦
备份
backup.sh mongodump -h 127.0.0.1:27017 -d leanote -o /leanote/db_backup -u 数据库的用户名 -p 你的数据库password
优化
要有 systemd 启动脚本 https://www.cnblogs.com/noright/p/install-leanote-on-raspberry-pi.html
How to develop leanote 如何开发leanote
trouble
- 在内网 hosts intra ip会有问题 保存不了
所以 在内网用ip 在外网用 域名吧
- 还有安全问题
- debian ssh起不来
在debian 添加自启动化 却是ssh起不来 搞笑了 放到 nohup 没有输入信息就行了
- css images 不然打开图片全是404
location ~ .*\.(gif|jpg|jpeg|png|bmp|ico|swf|html|htm|mp3|wma|js|css)$ { root /data/apps/leanote/public/;
- 2.6.1 app还是起不来
evan@kalipc:~/apps/leanote$ ./Leanote ./Leanote: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory
evan@kalipc:~/apps/leanote$ sudo apt-get install libgconf-2-4
- pi3 crontab 不成功 为什么 呢
/data/mon/frp.sh /usr/bin/nohup /data/apps/frp/frpc -c /data/apps/frp/frpc.ini &
最后,还要使cron定时任务生效: /etc/init.d/cron restart