树莓派4B(Raspberry Pi For NAS):penpot开源设计和原型平台

​NO.1
penpot简介

github地址

https://github.com/penpot/penpot

Penpot 是一个面向跨领域团队的开源设计和原型平台。

Penpot 不依赖于操作系统,基于 Web 并采用开放标准 (SVG)

img

原型和UI设计主要有三类

一类是旧的客户端:axure 和 sketch

一类是新的web端:figma

还有一类小众但是开源免费的penpot(figma的替代品)

figma确实好用,但是网络,翻译,以及有限的项目限额是一些限制

在某些情况下,比如不想设计稿暴露在网上,或者需要多人协作,但是又需要相对便宜或者免费的,可以考虑尝试penpot(适合初创公司或者独立开发者)

NO.2
penpot安装

官方网文档

https://help.penpot.app/technical-guide/getting-started/#install-with-docker

拉取docker-compose.yml文件

wget https://raw.githubusercontent.com/penpot/penpot/main/docker/images/docker-compose.yaml

或者在浏览器中打开并复制

img

具体的docker-compose.yml文件

---
version: "3.5"

networks:
penpot:

volumes:
penpot_postgres_v15:
penpot_assets:
# penpot_traefik:
# penpot_minio:

services:
## Traefik service declaration example. Consider using it if you are going to expose
## penpot to the internet or different host than `localhost`.

# 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:
# - "80:80"
# - "443:443"

penpot-frontend:
image: "penpotapp/frontend:latest"
restart: "no"
ports:
- 8006:80

volumes:
- ./penpot_assets:/opt/data/assets

depends_on:
- penpot-backend
- penpot-exporter

networks:
- penpot

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"

## Configuration envronment variables for frontend the container. In this case this
## container only needs the `PENPOT_FLAGS`. This environment variable is shared with
## other services but not all flags are relevant to all services.

environment:
## Relevant flags for frontend:
## - demo-users
## - login-with-github
## - login-with-gitlab
## - login-with-google
## - login-with-ldap
## - login-with-oidc
## - login-with-password
## - registration
## - webhooks
##
## You can read more about all available flags on:
## https://help.penpot.app/technical-guide/configuration/#advanced-configuration

- PENPOT_FLAGS=enable-registration enable-login-with-password

penpot-backend:
image: "penpotapp/backend:latest"
restart: "no"

volumes:
- ./penpot_assets:/opt/data/assets

depends_on:
- penpot-postgres
- penpot-redis

networks:
- penpot

## Configuration envronment variables for backend the
## container.

environment:

## Relevant flags for backend:
## - demo-users
## - email-verification
## - log-emails
## - log-invitation-tokens
## - login-with-github
## - login-with-gitlab
## - login-with-google
## - login-with-ldap
## - login-with-oidc
## - login-with-password
## - registration
## - secure-session-cookies
## - 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

## Penpot SECRET KEY. It serves as a master key from which other keys for subsystems
## (eg http sessions) are derived.
##
## Leave it comment if it is ok for you to have to login again after each backend
## restart.
##
## If you going to uncomment this, we recommend use here a trully randomly generated
## 512 bits base64 encoded string. You can generate one with:
##
## python3 -c "import secrets; print(secrets.token_urlsafe(64))"

# - PENPOT_SECRET_KEY=my-insecure-key

## The PREPL host. Mainly used for external programatic access to penpot backend
## (example: admin). By default it listen on `localhost` but if you are going to use
## the `admin`, you will need to uncomment this and set the host to `0.0.0.0`.

# - PENPOT_PREPL_HOST=0.0.0.0

## Public URI. If you are going to expose this instance to the internet and use it
## under different domain than 'localhost', you will need to adjust it to the final
## domain.
##
## Consider using traefik and set the 'disable-secure-session-cookies' if you are
## not going to serve penpot under HTTPS.

- PENPOT_PUBLIC_URI=http://0.0.0.0:8006

## Database connection parameters. Don't touch them unless you are using custom
## postgresql connection parameters.

- PENPOT_DATABASE_URI=postgresql://penpot-postgres/penpot
- PENPOT_DATABASE_USERNAME=penpot
- PENPOT_DATABASE_PASSWORD=penpot

## Redis is used for the websockets notifications. Don't touch unless the redis
## container has different parameters or different name.

- PENPOT_REDIS_URI=redis://penpot-redis/0

## Default configuration for assets storage: using filesystem based with all files
## stored in a docker volume.

- PENPOT_ASSETS_STORAGE_BACKEND=assets-fs
- PENPOT_STORAGE_ASSETS_FS_DIRECTORY=/opt/data/assets

## Also can be configured to to use a S3 compatible storage
## service like MiniIO. Look below for minio service setup.

# - AWS_ACCESS_KEY_ID=<KEY_ID>
# - AWS_SECRET_ACCESS_KEY=<ACCESS_KEY>
# - PENPOT_ASSETS_STORAGE_BACKEND=assets-s3
# - PENPOT_STORAGE_ASSETS_S3_ENDPOINT=http://penpot-minio:9000
# - PENPOT_STORAGE_ASSETS_S3_BUCKET=<BUKET_NAME>

## Telemetry. When enabled, a periodical process will send anonymous data about this
## instance. Telemetry data will enable us to learn on how the application is used,
## based on real scenarios. If you want to help us, please leave it enabled. You can
## audit what data we send with the code available on github

- PENPOT_TELEMETRY_ENABLED=true

## Example SMTP/Email configuration. By default, emails are sent to the mailcatch
## service, but for production usage is recommended to setup a real SMTP
## provider. Emails are used to confirm user registrations & invitations. Look below
## how mailcatch service is configured.

- PENPOT_SMTP_DEFAULT_FROM=no-reply@example.com
- PENPOT_SMTP_DEFAULT_REPLY_TO=no-reply@example.com
- PENPOT_SMTP_HOST=penpot-mailcatch
- PENPOT_SMTP_PORT=1025
- PENPOT_SMTP_USERNAME=
- PENPOT_SMTP_PASSWORD=
- PENPOT_SMTP_TLS=false
- PENPOT_SMTP_SSL=false

penpot-exporter:
image: "penpotapp/exporter:latest"
restart: "no"
networks:
- penpot

environment:
# Don't touch it; this uses internal docker network to
# communicate with the frontend.
- PENPOT_PUBLIC_URI=http://penpot-frontend

## Redis is used for the websockets notifications.
- PENPOT_REDIS_URI=redis://penpot-redis/0

penpot-postgres:
image: "postgres:15"
restart: "no"
stop_signal: SIGINT

volumes:
- ./penpot_postgres_v15:/var/lib/postgresql/data

networks:
- penpot

environment:
- POSTGRES_INITDB_ARGS=--data-checksums
- POSTGRES_DB=penpot
- POSTGRES_USER=penpot
- POSTGRES_PASSWORD=penpot

penpot-redis:
image: redis:7
restart: "no"
networks:
- penpot

## A mailcatch service, used as temporal SMTP server. You can access via HTTP to the
## port 1080 for read all emails the penpot platform has sent. Should be only used as a
## temporal solution meanwhile you don't have a real SMTP provider configured.

penpot-mailcatch:
image: sj26/mailcatcher:latest
restart: "no"
expose:
- '1025'
ports:
- "1080:1080"
networks:
- penpot

## Example configuration of MiniIO (S3 compatible object storage service); If you don't
## have preference, then just use filesystem, this is here just for the completeness.

# minio:
# image: "minio/minio:latest"
# command: minio server /mnt/data --console-address ":9001"
# restart: always
#
# volumes:
# - "penpot_minio:/mnt/data"
#
# environment:
# - MINIO_ROOT_USER=minioadmin
# - MINIO_ROOT_PASSWORD=minioadmin
#
# ports:
# - 9000:9000
# - 9001:9001

开放端口

sudo ufw allow 8006

拉取镜像并启动服务

docker compose -p penpot -f docker-compose.yml up

img

NO.3
penpot使用

访问Ip和端口

特别注意

安装需要一段时间,大概是10分钟左右,如果前分钟访问,会提示网关错误

img

实际上仍然需要等待5-10分钟左右,因为树莓派性能相对低,构建相对慢,并非树莓派不支持或者其他问题

等待一段时间后,再次访问

img

点击创建账号

img

设置名称

点击创建账号

img

进入首页

img

选择开始我的项目(按你自己的来)

这里使用了网页翻译,实际上英文界面

img

第二步

img

第三步

img

第四步

img

继续

img

继续

img

继续

img

稍后创建团队

img

创建新文档

img

开始设计

img

具体的使用请参考官方文档

https://help.penpot.app/user-guide/

NO.4
Tips

之前介绍了YApi,Jenkins,这期介绍了penpot

这是初创公司或者独立开发者搭建的开源系列

从需求管理(禅道)+原型设计(penpot)+UI设计(penpot)+代码管理(gitlab)+API文档(yapi)+bug管理(禅道)+自动化部署(jenkins)+数据上报(sentry)等

同样的树莓派不仅仅适合部署轻量静态网页,也适合部署一些适合在用户端使用内存和算力的项目

比如

Tesseract.js可以在浏览器中识别ocr

drawio和excalidraw都在浏览器中绘图

squoosh使用webassembly在浏览器中处理图片

ffmpeg.wasm在浏览器端处理音视频 

EmulatorJS在线NES和arcade街机游戏

也就是树莓派只是网站的部署和访问,但是真正对文件和数据进行展示和处理的,是使用浏览器客户端的cpu和gpu,无关于树莓派本身的性能

END.

推荐阅读

<<树莓派4B(Raspberry Pi For NAS):YApi可视化接口管理平台>>

<<树莓派4B(Raspberry Pi For NAS):jenkins自动化服务>>