内网自部署penpot并可局域网内多人注册使用的详细记录

penpot简介

系统版本说明

  • 操作系统: CentOS 7.6
  • Docker version 20.10.11
  • Docker Compose version v2.16.0

操作步骤

操作非常简单, 前置条件就不再赘述

如果希望本机启用并访问

  • 直接在文件所在目录执行命令 docker-compose up -d
  • 等待启动完成后, 通过浏览器打开 http://localhost:9001然后注册账号,登录即可(邮箱校验默认关闭,随便输入就行)

如果希望局域网内可使用

  • 编辑docker-compose.yaml文件
  • volumes下去掉 penpot_traefik注释
Lang: yaml
1volumes:
2    penpot_postgres_v15:
3    penpot_assets:
4    penpot_traefik:
5    # penpot_minio:
  • services下去掉 traefik以及其下除了command的注释
Lang: yaml
 1traefik:
 2    image: traefik:v2.9
 3    networks:
 4        - penpot
 5    #   command:
 6    #     - "--api.insecure=true"
 7    #     - "--entryPoints.web.address=:80"
 8    #     - "--providers.docker=true"
 9    #     - "--providers.docker.exposedbydefault=false"
10    #     - "--entryPoints.websecure.address=:443"
11    #     - "--certificatesresolvers.letsencrypt.acme.tlschallenge=true"
12    #     - "--certificatesresolvers.letsencrypt.acme.email=<EMAIL_ADDRESS>"
13    #     - "--certificatesresolvers.letsencrypt.acme.storage=/traefik/acme.json"
14      volumes:
15        - "penpot_traefik:/traefik"
16        - "/var/run/docker.sock:/var/run/docker.sock"
17      ports:
18        - "9002:80"
19        - "9443:443"
  • services下的penpot-frontend配置去掉label下的三个注释
Lang: yaml
 1penpot-frontend:
 2    ...
 3    
 4    labels:
 5        - "traefik.enable=true"
 6    
 7        ## HTTP: example of labels for the case if you are going to expose penpot to the
 8        ## internet using only HTTP (without HTTPS) with traefik
 9        
10        - "traefik.http.routers.penpot-http.entrypoints=web"
11        - "traefik.http.routers.penpot-http.rule=Host(`<DOMAIN_NAME>`)"
12        - "traefik.http.services.penpot-http.loadbalancer.server.port=80"
13        
14        ## HTTPS: example of labels for the case if you are going to expose penpot to the
15        ## internet using with HTTPS using traefik
16        
17        # - "traefik.http.middlewares.http-redirect.redirectscheme.scheme=https"
18        # - "traefik.http.middlewares.http-redirect.redirectscheme.permanent=true"
19        # - "traefik.http.routers.penpot-http.entrypoints=web"
20        # - "traefik.http.routers.penpot-http.rule=Host(`<DOMAIN_NAME>`)"
21        # - "traefik.http.routers.penpot-http.middlewares=http-redirect"
22        # - "traefik.http.routers.penpot-https.entrypoints=websecure"
23        # - "traefik.http.routers.penpot-https.rule=Host(`<DOMAIN_NAME>`)"
24        # - "traefik.http.services.penpot-https.loadbalancer.server.port=80"
25        # - "traefik.http.routers.penpot-https.tls=true"
26        # - "traefik.http.routers.penpot-https.tls.certresolver=letsencrypt"
  • service下的penpot-backend配置里environmentPENPOT_FLAGS后新增disable-secure-session-cookies
Lang: yaml
 1penpot-backend:
 2    ...
 3    
 4    environment:
 5    
 6        ## Relevant flags for backend:
 7        ## - demo-users 测试用户
 8        ## - email-verification 邮件验证
 9        ## - log-emails 
10        ## - log-invitation-tokens
11        ## - login-with-github 基于github登录
12        ## - login-with-gitlab 基于gitlab登录
13        ## - login-with-google 基于google登录
14        ## - login-with-ldap 基于ldap登录
15        ## - login-with-oidc
16        ## - login-with-password 基于账号密码登录
17        ## - registration 注册
18        ## - secure-session-cookies 校验session
19        ## - smtp 
20        ## - smtp-debug
21        ## - telemetry
22        ## - webhooks
23        ## - prepl-server
24        ##
25        ## You can read more about all available flags and other
26        ## environment variables for the backend here:
27        ## https://help.penpot.app/technical-guide/configuration/#advanced-configuration
28        
29        - PENPOT_FLAGS=enable-registration enable-login-with-password disable-email-verification enable-smtp enable-prepl-server disable-secure-session-cookies
  • 默认flags信息说明如下:

  • enable-registration: 开启注册

  • enable-login-with-password: 开启账号密码登录

  • disable-email-verification: 禁用注册邮箱校验(注册时会发校验邮件到邮箱内, 需要配置smtp)

  • enable-smtp: 启用smtp服务

  • disable-secure-session-cookies: 启用session校验, 如果不添加该flags, 内网基于ip访问时登录会提示发现一些错误

  • 其他flags具体用法使用请参考官网

  • PENPOT_PUBLIC_URI修改为http://0.0.0.0:9001

Lang: yaml
1- PENPOT_PUBLIC_URI=http://0.0.0.0:9001
  • 保存后执行 docker-compose up -d
  • 启动完成后, 浏览器打开 http://192.168.1.222:9001即可注册登录了