(云原生之使用Docker部署Laverna笔记工具)

一、Laverna介绍

Laverna是一个开源的、用 JavaScript 编写的笔记网络应用程序,可以部署在个人服务器上使用。

二、检查本地环境状态

1.检查系统版本

[root@server001 ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

2.检查docker状态

[root@server001 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2022-11-06 06:02:26 CST; 1 weeks 2 days ago
     Docs: https://docs.docker.com
 Main PID: 9869 (dockerd)
    Tasks: 29
   Memory: 2.4G
   CGroup: /system.slice/docker.service
           ├─  9869 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
           ├─116625 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8765 -container-ip 172.17.0.2 -container-port 80
           └─116630 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8765 -container-ip 172.17.0.2 -container-port 80

Nov 14 22:30:23 server001 dockerd[9869]: time="2022-11-14T22:30:23.149457043+08:00" level=info msg="Container failed to exit within 10s ...03a5f88d
Nov 14 22:30:23 server001 dockerd[9869]: time="2022-11-14T22:30:23.191892564+08:00" level=info msg="ignoring event" container=672c3438d9...kDelete"
Nov 14 22:41:26 server001 dockerd[9869]: time="2022-11-14T22:41:26.110484832+08:00" level=info msg="ignoring event" container=37a7401ce7...kDelete"
Nov 14 23:00:03 server001 dockerd[9869]: time="2022-11-14T23:00:03.899436227+08:00" level=info msg="Container failed to exit within 10s ...dde0d014
Nov 14 23:00:03 server001 dockerd[9869]: time="2022-11-14T23:00:03.942747053+08:00" level=info msg="ignoring event" container=7c726140a1...kDelete"
Nov 14 23:07:40 server001 dockerd[9869]: time="2022-11-14T23:07:40.338292217+08:00" level=info msg="ignoring event" container=9c78d5b9d1...kDelete"
Nov 14 23:07:40 server001 dockerd[9869]: time="2022-11-14T23:07:40.556135522+08:00" level=info msg="ignoring event" container=1932d4e66d...kDelete"
Nov 14 23:32:22 server001 dockerd[9869]: time="2022-11-14T23:32:22.670922544+08:00" level=info msg="ignoring event" container=60235239f1...kDelete"
Nov 14 23:32:22 server001 dockerd[9869]: time="2022-11-14T23:32:22.855970045+08:00" level=info msg="ignoring event" container=c4a43ebc18...kDelete"
Nov 14 23:32:23 server001 dockerd[9869]: time="2022-11-14T23:32:23.088696932+08:00" level=info msg="ignoring event" container=e1bec0a05f...kDelete"
Hint: Some lines were ellipsized, use -l to show in full.

三、下载Laverna镜像


[root@server001 ~]# docker pull thklein/laverna
Using default tag: latest
latest: Pulling from thklein/laverna
Image docker.io/thklein/laverna:latest uses outdated schema1 manifest format. Please upgrade to a schema2 image for better future compatibility. More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/
6ffe5d2d6a97: Pull complete 
f4e00f994fd4: Pull complete 
e99f3d1fc87b: Pull complete 
a3ed95caeb02: Pull complete 
ededd75b6753: Pull complete 
1ddde157dd31: Pull complete 
b1fa3eb3cc18: Pull complete 
a1704470ed47: Pull complete 
3dd83205b755: Pull complete 
49a5665b2cca: Pull complete 
93d2530c6321: Pull complete 
eb4c934836f7: Pull complete 
665c57aee3f3: Pull complete 
Digest: sha256:c738d0f72de7caf8123eaf786dbc4971bf4adc8abb3e27fbd3991bc8a1933302
Status: Downloaded newer image for thklein/laverna:latest
docker.io/thklein/laverna:latest


四、部署Laverna

1.运行Laverna容器


[root@server001 ~]# docker run -d --name laverna -p 80:80 thklein/laverna:latest
16539a40754c3f059bd01c04e713046fd6142e0c7be3b59647e866ec1f9adbeb


2.查看Laverna容器状态

[root@server001 ~]# docker ps
CONTAINER ID   IMAGE                          COMMAND                  CREATED          STATUS          PORTS                                   NAMES
16539a40754c   thklein/laverna:latest         "/bin/sh -c 'supervi…"   10 seconds ago   Up 10 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp       laverna




3.查看容器运行日志


[root@server001 ~]# docker logs laverna 
2022-11-15 05:09:48,499 CRIT Supervisor running as root (no user in config file)
2022-11-15 05:09:48,500 INFO supervisord started with pid 7
2022-11-15 05:09:49,503 INFO spawned: 'nginx' with pid 10
2022-11-15 05:09:49,504 INFO spawned: 'php5-fpm' with pid 11
2022-11-15 05:09:50,516 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2022-11-15 05:09:50,517 INFO success: php5-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

五、设置Laverna登录密码

image.png

六、访问Laverna

image.png image.png