Joplin全平台笔记软件同步服务器搭建

发布于 / 折腾 / 0 条评论

一、安装Docker

#国内机
curl -sSL https://get.daocloud.io/docker | sh

#国外机
curl -sSL https://get.docker.com/ | sh

开机自启/关闭

systemctl start docker

systemctl enable docker

二、安装 Docker-compose

#国内机
curl -L https://get.daocloud.io/docker/compose/releases/download/v2.1.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

#国外机
curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

三、安装Joplin Server

#创建目录
cd ~
mkdir joplin
#进入目录
cd joplin
#下载
wget https://raw.githubusercontent.com/laurent22/joplin/dev/docker-compose.server.yml
#重命名
mv docker-compose.server.yml docker-compose.yml 
#修改域名和密码
vim docker-compose.yml

修改POSTGRES_USER、POSTGRES_PASSWORD、APP_BASE_URL,其中APP_BASE_URL填写你的域名。如下所示

# This is a sample docker-compose file that can be used to run Joplin Server
# along with a PostgreSQL server.
#
# Update the following fields in the stanza below:
#
# POSTGRES_USER
# POSTGRES_PASSWORD
# APP_BASE_URL
#
# APP_BASE_URL: This is the base public URL where the service will be running.
#  - If Joplin Server needs to be accessible over the internet, configure APP_BASE_URL as follows: https://example.com/joplin. 
#  - If Joplin Server does not need to be accessible over the internet, set the the APP_BASE_URL to your server's hostname. 
#     For Example: http://[hostname]:22300. The base URL can include the port.
# APP_PORT: The local port on which the Docker container will listen. 
#  - This would typically be mapped to port to 443 (TLS) with a reverse proxy.
#  - If Joplin Server does not need to be accessible over the internet, the port can be mapped to 22300.
version: '3'
services:
    db:
        image: postgres:13
        volumes:
            - ./data/postgres:/var/lib/postgresql/data
        ports:
            - "5432:5432"
        restart: unless-stopped
        environment:
            - POSTGRES_PASSWORD=sdsadadasd
            - POSTGRES_USER=canxuns
            - POSTGRES_DB=joplin
    app:
        image: joplin/server:latest
        depends_on:
            - db
        ports:
            - "22300:22300"
        restart: unless-stopped
        environment:
            - APP_PORT=22300
            #此处写你后续需要反向代理的域名
            - APP_BASE_URL=https://xx.uquq.cn
            - DB_CLIENT=pg
            - POSTGRES_PASSWORD=sdsadadasd
            - POSTGRES_DATABASE=joplin
            - POSTGRES_USER=canxuns
            - POSTGRES_PORT=5432
            - POSTGRES_HOST=db

运行

docker-compose up -d

四、反向代理

登陆 web 管理页面:https://你域名 SSL记得配置默认帐号 admin@localhost,默认密码 admin

在https://域名/admin/users/ 修改你账号密码

五、设置同步

打开Joplin同步设置,填写你的 Joplin Server访问地址,填写账号和密码,完成设置。

记得关闭防火墙 POST提交同步可能拦截

六、自动备份插件 插件搜索Simple Backup安装

根据需要设置备份路径 参数

CAPTCHAis initialing...
Not Comment Found