一、fastposter海报生成器介绍
fastposter 是一款海报生成器,它能够让您快速、轻松地创建各种类型的海报。
只需上传一张背景图,然后在需要的位置添加
文字
、图片
、二维
、头像
等组件。点击生成代码按钮,直接获取各种语言 SDK
的调用代码,无需编写复杂的绘图渲染代码,轻松完成海报制作。fastposter支持
Docker
部署和云服务
两种方式,开箱即用,灵活易用,基于低代码理念设计,无需编写复杂代码,能够帮助开发者快速高效地生成各种类型的海报。
二、本次实践介绍
本次实践简介
本次实践部署环境为个人测试环境
本地环境规划
本次实践环境规划:下载镜像fastposter/fastposter:latest,通过docker-cli或者docker compose启动容器
镜像命名 | IP地址 | 容器镜像版本 | 操作系统版本 |
---|---|---|---|
fastposter | localhost | latest | ubuntu 22.04 |
三、检查本地Docker环境
检查本地Docker版本
检查Docker版本:docker version root@WellDone:/home/goodjob# docker version
Client: Docker Engine - Community Version: 25.0.0 API version: 1.44 Go version: go1.21.6 Git commit: e758fe5 Built: Thu Jan 18 17:09:49 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 25.0.0 API version: 1.44 (minimum version 1.24) Go version: go1.21.6 Git commit: 615dfdf Built: Thu Jan 18 17:09:49 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.27 GitCommit: a1496014c916f9e62104b33d1bb5bd03b0858e59 runc: Version: 1.1.11 GitCommit: v1.1.11-0-g4bccb38 docker-init: Version: 0.19.0 GitCommit: de40ad0
root@WellDone:/home/goodjob#
检查Docker服务状态
检查Docker服务状态,确保Docker服务正常运行。
systemctl status docker root@WellDone:/home/goodjob/Downloads# systemctl status docker
● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2024-01-24 08:54:31 CST; 1 day 4h ago
TriggeredBy: ● docker.socket Docs: https://docs.docker.com Main PID: 1549 (dockerd) Tasks: 65 Memory: 419.5M CPU: 38.874s CGroup: /system.slice/docker.service ├─ 1549 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock ├─ 2010 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 6379 -container-ip 172.17.0.2 -container-port 6379 ├─ 2016 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 6379 -container-ip 172.17.0.2 -container-port 6379 ├─ 2029 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 5432 -container-ip 172.17.0.3 -container-port 5432 ├─ 2036 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 5432 -container-ip 172.17.0.3 -container-port 5432 ├─123083 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8888 -container-ip 172.17.0.4 -container-port 8080 └─123095 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8888 -container-ip 172.17.0.4 -container-port 8080 1月 24 08:54:31 WellDone dockerd[1549]: time="2024-01-24T08:54:31.067895045+08:00" level=info msg="API listen on /run/docker.sock"
1月 24 08:54:31 WellDone systemd[1]: Started Docker Application Container Engine.
1月 24 16:13:48 WellDone dockerd[1549]: time="2024-01-24T16:13:48.185008219+08:00" level=info msg="ignoring event" container=8ad99af82d8a41dd661d>
1月 24 16:13:48 WellDone dockerd[1549]: time="2024-01-24T16:13:48.189484205+08:00" level=warning msg="ShouldRestart failed, container will not be>
1月 24 21:58:08 WellDone dockerd[1549]: time="2024-01-24T21:58:08.024915139+08:00" level=info msg="ignoring event" container=27fd28e2993f31b170b8>
1月 24 21:58:08 WellDone dockerd[1549]: time="2024-01-24T21:58:08.029986730+08:00" level=warning msg="ShouldRestart failed, container will not be>
1月 25 10:46:16 WellDone dockerd[1549]: time="2024-01-25T10:46:16.329180722+08:00" level=info msg="Container failed to exit within 10s of signal >
1月 25 10:46:16 WellDone dockerd[1549]: time="2024-01-25T10:46:16.350757439+08:00" level=info msg="ignoring event" container=b1223add00f36bbb3246>
1月 25 10:49:21 WellDone dockerd[1549]: time="2024-01-25T10:49:21.993755983+08:00" level=info msg="Container failed to exit within 10s of signal >
1月 25 10:49:22 WellDone dockerd[1549]: time="2024-01-25T10:49:22.015822650+08:00" level=info msg="ignoring event" container=edb0e153b45dbe62acd8>
lines 1-28/28 (END)
四、部署fastposter镜像
下载fastposter镜像
docker pull fastposter/fastposter root@HEJIAJIN-FX506HE:/docker_software# docker pull fastposter/fastposter
Using default tag: latest
latest: Pulling from fastposter/fastposter
7d63c13d9b9b: Pull complete
6ad2a11ca37b: Pull complete
8076cdef4689: Pull complete
0ba90f5a7dd0: Pull complete
27c191df269f: Pull complete
e332e26a6509: Pull complete
b6aa2cfacc25: Pull complete
Digest: sha256:0d1c173c7bc5ef6b51a815a995f06dd89b4902e4773be98687259134cf6ea267
Status: Downloaded newer image for fastposter/fastposter:latest
docker.io/fastposter/fastposter:latest
创建容器
使用docker快速创建fastposter的容器。
完整创建过程: 1.使用docker-cli启动一个fastposter的容器。 ## 公网部署
部署到公网环境,需要设置变量`POSTER_URI_PREFIX`,把`127.0.0.1`替换成`服务器的IP`即可
注意,`POSTER_URI_PREFIX=http://127.0.0.1:5000/` 后不要带#号。
docker run -it \ -e POSTER_URI_PREFIX=http://127.0.0.1:5000/ \--name fastposter \-p 2000:5000 fastposter/fastposter## 数据持久
持久化数据和图片资源,需要挂载目录`-v $PWD/data:/app/data`
docker run -it \-v $PWD/data:/app/data \--name fastposter \-p 2000:5000 fastposter/fastposter2.使用docker-compose启动一个wechat的容器 version: '3'
services:fastposter:container_name: fastposterimage: fastposter/fastposterrestart: on-failureports:- 2000:5000volumes:- /docker_software/fastposter/data:/app/dataenvironment:TZ: Asia/ShanghaiPOSTER_URI_PREFIX: http://localhost:5000/networks:localhost:
检查容器运行状态
检查容器的运行状态,确保服务的正常运行。
docker ps
root@HEJIAJIN-FX506HE:/docker_software/docker-compose/docker-test# docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
fastposter fastposter/fastposter "/bin/sh -c 'python …" fastposter 5 seconds ago Up 4 seconds 0.0.0.0:2000->5000/tcp, :::2000->5000/tcp
五、访问fastposter
访问ward首页 访问地址:http://localhost:2000