【docker】又一个笔记软件!免费、开源、全平台同步——Joplin

2024-08-20 17:46:03 浏览数 (2)

本文发布于399天前,最后更新于1天前,其中的信息可能有所发展或是发生改变。

1.前言

官网:Joplin (joplinapp.org)

GitHub:laurent22/joplin: Joplin

2.准备

3.部署(docker-compose)

代码语言:javascript复制
# 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:15
        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

完整配置文件如下:

代码语言:javascript复制
version: '3'
services:
    postgres_db:
        image: postgres:13
        container_name: postgres_db
        volumes:
            - ./postgres:/var/lib/postgresql
        ports:
            - 5432:5432
        restart: unless-stopped
        environment:
            - POSTGRES_PASSWORD=joplin
            - POSTGRES_USER=joplin
            - POSTGRES_DB=joplin
    joplin_server:
        image: joplin/server:latest
        container_name: joplin_server
        depends_on:
            - postgres_db
        ports:
            - 22300:22300
        restart: unless-stopped
        environment:
            - APP_PORT=22300  #默认访问端口
            - APP_BASE_URL=https://yourDomain.com  #访问(反向代理)域名,如果不用域名,请输入ip:22300
            - DB_CLIENT=pg
            - POSTGRES_PASSWORD=joplin
            - POSTGRES_DATABASE=joplin
            - POSTGRES_USER=joplin
            - POSTGRES_PORT=5432
            - POSTGRES_HOST=postgres_db
# 下面是邮箱配置,按照自己的SMTP服务填写即可
            - MAILER_ENABLED=true
            - MAILER_HOST=
            - MAILER_PORT=
            - MAILER_SECURITY=
            - MAILER_AUTH_USER=
            - MAILER_AUTH_PASSWORD=
            - MAILER_NOREPLY_NAME=
            - MAILER_NOREPLY_EMAIL=
            - SUPPORT_EMAIL=
            - SUPPORT_NAME=
            - BUSINESS_EMAIL=

启动

代码语言:javascript复制
docker-compose up -d

然后访问ip:22300,即可看到页面。这时由于你的代理还没有设置,可能会不让你访问

如果需要以Ip 端口的形式先访问,可以将上面环境变量的APP_BASE_URL改成http://ip:22300,注意,一定要写端口号,而且端口号后面不能有斜杠/

打开页面后,使用默认的账户名 admin@localhost 和密码 admin 登录,然后修改账号和密码即可。 如果你的邮箱配置正确,会收到修改密码的确认邮件。

4.部署(脚本)

代码语言:javascript复制
wget -O - https://raw.githubusercontent.com/laurent22/joplin/dev/Joplin_install_and_update.sh | bash

5.使用

0 人点赞