内网自部署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注释
volumes:
    penpot_postgres_v15:
    penpot_assets:
    penpot_traefik:
    # penpot_minio:
  • services下去掉 traefik以及其下除了command的注释
traefik:
    image: traefik:v2.9
    networks:
        - penpot
    #   command:
    #     - "--api.insecure=true"
    #     - "--entryPoints.web.address=:80"
    #     - "--providers.docker=true"
    #     - "--providers.docker.exposedbydefault=false"
    #     - "--entryPoints.websecure.address=:443"
    #     - "--certificatesresolvers.letsencrypt.acme.tlschallenge=true"
    #     - "--certificatesresolvers.letsencrypt.acme.email=<EMAIL_ADDRESS>"
    #     - "--certificatesresolvers.letsencrypt.acme.storage=/traefik/acme.json"
      volumes:
        - "penpot_traefik:/traefik"
        - "/var/run/docker.sock:/var/run/docker.sock"
      ports:
        - "9002:80"
        - "9443:443"
  • services下的penpot-frontend配置去掉label下的三个注释
penpot-frontend:
    ...
    
    labels:
        - "traefik.enable=true"
    
        ## HTTP: example of labels for the case if you are going to expose penpot to the
        ## internet using only HTTP (without HTTPS) with traefik
        
        - "traefik.http.routers.penpot-http.entrypoints=web"
        - "traefik.http.routers.penpot-http.rule=Host(`<DOMAIN_NAME>`)"
        - "traefik.http.services.penpot-http.loadbalancer.server.port=80"
        
        ## HTTPS: example of labels for the case if you are going to expose penpot to the
        ## internet using with HTTPS using traefik
        
        # - "traefik.http.middlewares.http-redirect.redirectscheme.scheme=https"
        # - "traefik.http.middlewares.http-redirect.redirectscheme.permanent=true"
        # - "traefik.http.routers.penpot-http.entrypoints=web"
        # - "traefik.http.routers.penpot-http.rule=Host(`<DOMAIN_NAME>`)"
        # - "traefik.http.routers.penpot-http.middlewares=http-redirect"
        # - "traefik.http.routers.penpot-https.entrypoints=websecure"
        # - "traefik.http.routers.penpot-https.rule=Host(`<DOMAIN_NAME>`)"
        # - "traefik.http.services.penpot-https.loadbalancer.server.port=80"
        # - "traefik.http.routers.penpot-https.tls=true"
        # - "traefik.http.routers.penpot-https.tls.certresolver=letsencrypt"
  • service下的penpot-backend配置里environmentPENPOT_FLAGS后新增disable-secure-session-cookies
penpot-backend:
    ...
    
    environment:
    
        ## Relevant flags for backend:
        ## - demo-users 测试用户
        ## - email-verification 邮件验证
        ## - log-emails 
        ## - log-invitation-tokens
        ## - login-with-github 基于github登录
        ## - login-with-gitlab 基于gitlab登录
        ## - login-with-google 基于google登录
        ## - login-with-ldap 基于ldap登录
        ## - login-with-oidc
        ## - login-with-password 基于账号密码登录
        ## - registration 注册
        ## - secure-session-cookies 校验session
        ## - smtp 
        ## - smtp-debug
        ## - telemetry
        ## - webhooks
        ## - prepl-server
        ##
        ## You can read more about all available flags and other
        ## environment variables for the backend here:
        ## https://help.penpot.app/technical-guide/configuration/#advanced-configuration
        
        - 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

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