一、flatnotes介绍
1.flatnotes简介
一个自托管的,无数据库的笔记网络应用程序,利用平面文件夹的markdown文件进行存储。
2.项目特点
A.干净简单的用户界面B.响应式移动端界面C.原生/所见即所得Markdown编辑模式D.高级搜索功能E.笔记“标签”功能F.支持wikilink易链接其它笔记G.明暗主题切换H.多种认证选项I.提供Restful API
二、本次实践介绍
1. 本次实践简介
a.本次实践部署环境为个人笔记本ubuntu日常工作的测试环境,若是生产环境请谨慎部署;
b.本次实践为快速使用docker部署开源flatnotes于个人ubuntu上。
2. 本地环境规划
本次实践环境规划:下载镜像dullage/flatnotes,通过docker-cli或者docker compose启动容器
镜像命名 | IP地址 | 容器镜像版本 | 操作系统版本 |
---|---|---|---|
flatnotes | localhost | latest | ubuntu 22.04 |
三、检查本地Docker环境
1. 检查本地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#
2. 检查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)
四、下载flatnotes镜像
1.下载flatnotes镜像 root@HEJIAJIN-FX506HE:/home/welldone# docker pull dullage/flatnotes Using default tag: latest latest: Pulling from dullage/flatnotes 70ba6f391a98: Pull complete fd1d7a3a6a58: Pull complete 240fcc724b86: Pull complete 193f307df575: Pull complete 1001d7abe1f6: Pull complete ef78ccb6ecdd: Pull complete 62b5565ce964: Pull complete 855483b56fbe: Pull complete 9d9b183a46bb: Pull complete 4f4fb700ef54: Pull complete cfd40209fcc9: Pull complete 376d4ecc88fd: Pull complete 110bfda3eca3: Pull complete f9d6652969c0: Pull complete 5d6e1e8a35e7: Pull complete Digest: sha256:94a55c27886f8edf38117c2d0c1bd0cc187c9d04093a0c9712f1b5868008fc98 Status: Downloaded newer image for dullage/flatnotes:latest docker.io/dullage/flatnotes:latest2.使用docker-compose启动一个flatnotes的容器 version: '3.9' services:flatnotes:image: dullage/flatnotes:latestcontainer_name: flatnotesenvironment:- PUID=1000- PGID=1000- FLATNOTES_AUTH_TYPE=password- FLATNOTES_USERNAME=user- FLATNOTES_PASSWORD=123!@#- FLATNOTES_SECRET_KEY=aLongRandomSeriesOfCharactersvolumes:- /container/flatnotes:/dataports:- "18080:8080"restart: always3.使用docker-cli启动一个flatnotes的容器docker run -d \ -e "PUID=1000" \ -e "PGID=1000" \ -e "FLATNOTES_AUTH_TYPE=password" \ -e "FLATNOTES_USERNAME=user" \ -e "FLATNOTES_PASSWORD=123!@#" \ -e "FLATNOTES_SECRET_KEY=aLongRandomSeriesOfCharacters" \ -v "/container/flatnotes:/data" \ -p "18080:8080" \ dullage/flatnotes:latest4.查看flatnotes容器状态 root@HEJIAJIN-FX506HE:/container/docker-compose/docker-firsttest# docker compose psNAME IMAGE COMMAND SERVICE CREATED STATUS PORTS flatnotes dullage/flatnotes:latest "/entrypoint.sh" flatnotes 4 seconds ago Up 4 seconds 0.0.0.0:18080->8080/tcp, :::18080->8080/tcp
六、访问flatnotes首页
访问地址http://localhost:18080 账号user,密码123!@#