Joplin 笔记服务搭建(文章链接: https://word.plfish.top/index.php/archives/25/)
1. Joplin 介绍
Joplin 是一款开源笔记应用程序。拥有 Windows/macOS/Linux/iOS/Android/Terminal
版本的客户端。
Joplin 在同步上做得不错,支持 Dropbox、OneDrive 和 AWS s3(当然国内都没法用),支持 WebDAV 协议,也支持自家的 Joplin Server。
2. 相关链接
- Joplin 官网:https://joplinapp.org/
- Joplin Github:https://github.com/laurent22/joplin
- Joplin 服务安装介绍:https://github.com/laurent22/joplin/blob/dev/packages/server/README.md
- Joplin 官方提供的 docker-compose 文件:https://raw.githubusercontent.com/laurent22/joplin/dev/docker-compose.server.yml
- Joplin 官方提供的环境变量文件:https://github.com/laurent22/joplin/blob/dev/.env-sample
3. 准备工作
本人采用的是 VPS 来进行测试安装,其他的比如 NAS 或者家用服务器操作步骤大致相同可能会有一点点区别
- VPS(NAS 或者家用服务器等)
- 域名(可有可无,如果需要放公网,想使用域名来访问)
- 反向代理软件(如果需要使用域名来访问)
4. 安装
本人这里是使用 docker 安装,直接使用 ip 来进行测试,不使用域名,使用域名的小伙伴还需要参考其他的一些资料。
4.1 创建安装目录
mkdir -p /root/data/docker_data/joplin
Bash
复制
cd /root/data/docker_data/joplin
Bash
复制
4.2 创建 docker-compose.yml
官方是支持直接使用 SQLite 数据库,如果是需要使用 SQLite 数据库的可以删除官方文件里面的提供的 postgres 数据库选项,并进行设置。官方文件里面使用的默认端口,如果有被占用的,请自行修改。
# 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:16
volumes:
- ./data/postgres:/var/lib/postgresql/data
ports:
- "5432:5432"
restart: unless-stopped
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_DB=${POSTGRES_DATABASE}
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_PASSWORD}
- POSTGRES_DATABASE=${POSTGRES_DATABASE}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_HOST=db
Yml
复制
4.3 创建.env
可以看见上面的 docker-compose 文件中设定了很多环境变量的选项,如果不想使用环境变量的小伙伴,可以删除环境变量的定义方法,在其中直接定义。
# =============================================================================
# PRODUCTION CONFIG EXAMPLE
# -----------------------------------------------------------------------------
# By default it will use SQLite, but that's mostly to test and evaluate the
# server. So you'll want to specify db connection settings to use Postgres.
# =============================================================================
#
# APP_BASE_URL=https://example.com/joplin
# APP_PORT=22300
#
# DB_CLIENT=pg
POSTGRES_PASSWORD=joplin
POSTGRES_DATABASE=joplin
POSTGRES_USER=joplin
POSTGRES_PORT=5432
# POSTGRES_HOST=localhost
# =============================================================================
# DEV CONFIG EXAMPLE
# -----------------------------------------------------------------------------
# Example of local config, for development. In dev mode, you would usually use
# SQLite so database settings are not needed.
# =============================================================================
#
APP_BASE_URL=http://142.171.63.122:22300
# APP_PORT=22300
Bash
复制
4.4 运行
docker-compose up -d
Bash
复制
5. 使用
浏览器输入 ip:端口,进入服务后台。
输入默认管理员账户 admin<a href="https://github.com/localhost" title="@localhost" class="at-link">@localhost</a>
和密码 admin
登录,然后修改账号和密码即可。
桌面端软件设置同步
之后就在本地编写然后点同步就可以同步到服务器上。
6. 总结
这只是一个简单的搭建步骤,详细的更多内容,大家可以去官网看看具体一些配置的介绍。比如我看里面还有一些大文件存储的配置还有具体反向代理的配置,还有如何进行迁移。
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于