Joplin部署及使用

2023-10-20 14:39:22 浏览数 (1)

简述

在付费了几年为知笔记之后,还是决定把笔记放到自己的服务器上。搜索测试了一圈,发现joplin的多端同步功能非常合适,Joplin支持Dropbox、OneDrive 和 AWS s3(当然国内用费点劲),支持 WebDAV 协议,也支持自家的Joplin Server。

测试

在正式使用之前,最好先run起来测试(熟悉)下配置、功能、同步等操作,避免正式使用的时候因为误操作导致笔记丢失。

代码语言:javascript复制
git  clone https://github.com/lianshitong/joplin
docker run --env-file .env -p 22300:22300 joplin/server:latest

部署

代码语言:javascript复制
# This is a sample docker-compose file that can be used to run Joplin Server
# along with a PostgreSQL server.
#
# All environment variables are optional. If you don't set them, you will get a
# warning from docker-compose, however the app should use working defaults.

version: '3'

services:
    db:
        image: postgres:13.1
        volumes:
            - ./data/postgres:/var/lib/postgresql/data
        ports:
            - "5432:5432"
        restart: unless-stopped
        environment:
            - POSTGRES_PASSWORD=密码
            - POSTGRES_USER=用户名
            - POSTGRES_DB=数据库名
    app:
        image: joplin/server:latest
        depends_on:
            - db
        ports:
            - "22300:22300"
        restart: unless-stopped
        environment:
            - APP_PORT=22300
            - APP_BASE_URL=${APP_BASE_URL}
            - DB_CLIENT=pg
            - POSTGRES_PASSWORD=数据库密码
            - POSTGRES_DATABASE==数据库名称
            - POSTGRES_USER==数据库用户名
            - POSTGRES_PORT==数据库端口
            - POSTGRES_HOST=db

Nginx

代码语言:javascript复制
upstream notedocker { server 127.0.0.1:22300;}
server
    {
        listen 80;
        listen [::]:80;
        ....

    location / {
        proxy_pass http://notedocker;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header x-note-real-ip $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Proto $scheme;

    }

    ...
    }

参考资料

  • Docker镜像:https://hub.docker.com/r/joplin/server
  • github:https://github.com/laurent22/joplin

0 人点赞