Docker环境下部署Ghost开源内容管理系统
一、Ghost介绍
1.1 Ghost简介
Ghost是一款用于博客、出版物和内容网站的免费且开源的CMS(内容管理系统),它是完全基于JavaScript编写的。Ghost的主要特点是简单易用、高度可扩展、精美的设计和优秀的性能。
1.2 Ghost特点
- 简单易用:Ghost的用户界面非常简单和直观,因此非常易于使用。它提供了一个简单的写作体验,让您专注于写作。
- 可扩展:Ghost提供了一个强大的API,使得开发者可以轻松地扩展其功能,并将其与其他应用程序集成。
- 设计优美:Ghost的设计非常美观和优雅,它为您提供了多种主题和自定义选项来满足您的需求。
- 性能优越:Ghost的性能非常好,因为它是基于Node.js构建的,使用了非阻塞I/O,可以处理大量的请求和并发连接。
二、本地环境介绍
2.1 本地环境规划
本次实践为个人测试环境,操作系统版本为centos7.6。
hostnameIP地址操作系统版本Docker版本jeven192.168.3.166centos 7.620.10.17
2.2 本次实践介绍
1.本次实践部署环境为个人测试环境,生产环境请谨慎使用;
2.在Docker环境下成功部署Ghost开源内容管理系统。
三、本地环境检查
3.1 检查Docker服务状态
检查Docker服务是否正常运行,确保Docker正常运行。
[root@jeven ~]# 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 2023-06-11 19:08:26 CST; 7h ago
Docs: https://docs.docker.com
Main PID: 11727(dockerd)
Tasks: 10
Memory: 133.4M
3.2 检查Docker版本
检查Docker版本
[root@jeven ~]# docker -v
Docker version 20.10.17, build 100c701
3.3 检查docker compose 版本
检查Docker compose版本,确保2.0以上版本。
[root@jeven ~]# docker compose version
Docker Compose version v2.6.0
四、下载Ghost镜像
在docker hub下载Ghost镜像,版本为latest。
[root@jeven ~]# docker pull ghost
Using default tag: latest
latest: Pulling from library/ghost
72a69066d2fe: Already exists
24892ef5fd86: Pull complete
b352cb85f08b: Pull complete
d184ccfb32cc: Pull complete
a1aa0950435d: Pull complete
6af76194e172: Pull complete
6ecb9543cf3f: Pull complete
f5dc5f4a448f: Pull complete
c5c6987f6d28: Pull complete
Digest: sha256:8123a7eabc533746cfa7302c71b780e763ee292f92c10f44e12d08baa0b489f9
Status: Downloaded newer image for ghost:latest
docker.io/library/ghost:latest
五、部署Ghost开源内容管理系统
5.1 创建数据目录
- 创建数据目录
mkdir -p /data/ghost
5.2 创建Ghost容器
- 使用docker-cli快速创建Ghost容器
docker run -d \
--restart always \
--name ghost \
-p 2368:2368 \
-v /data/ghost:/var/lib/ghost/content \
-e NODE_ENV=development \
-e url=http://192.168.3.166:2368 \
ghost
- 目录授权
chmod -R 777 /data/ghost/
- 重启ghost容器
docker restart ghost
5.3 检查Ghost容器状态
检查Ghost容器状态,确保容器正常启动。
[root@jeven ghost]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d9c108ddbd3c ghost "docker-entrypoint.s…" About a minute ago Up 26 seconds 0.0.0.0:2368->2368/tcp, :::2368->2368/tcp ghost
5.4 检查Ghost容器运行日志
查Ghost容器运行日志,检查有无报错,确保Ghost服务正常启动。
[root@jeven ghost]# docker logs ghost [2023-06-11 18:43:17] INFO Ghost is running in development...
[2023-06-11 18:43:17] INFO Listening on: 0.0.0.0:2368
[2023-06-11 18:43:17] INFO Url configured as: http://192.168.3.166:2368/
[2023-06-11 18:43:17] INFO Ctrl+C to shut down
[2023-06-11 18:43:17] INFO Ghost server started in0.264s
[2023-06-11 18:43:17] WARN Database state requires initialisation.
[2023-06-11 18:43:17] INFO Creating table: posts
[2023-06-11 18:43:17] INFO Creating table: posts_meta
[2023-06-11 18:43:17] INFO Creating table: users[2023-06-11 18:43:17] INFO Creating table: oauth
[2023-06-11 18:43:17] INFO Creating table: posts_authors
[2023-06-11 18:43:17] INFO Creating table: roles
[2023-06-11 18:43:17] INFO Creating table: roles_users
[2023-06-11 18:43:17] INFO Creating table: permissions
[2023-06-11 18:43:17] INFO Creating table: permissions_users
[2023-06-11 18:43:17] INFO Creating table: permissions_roles
[2023-06-11 18:43:17] INFO Creating table: settings
[2023-06-11 18:43:17] INFO Creating table: tags
[2023-06-11 18:43:17] INFO Creating table: posts_tags
[2023-06-11 18:43:17] INFO Creating table: invites
[2023-06-11 18:43:17] INFO Creating table: brute
[2023-06-11 18:43:17] INFO Creating table: sessions
[2023-06-11 18:43:17] INFO Creating table: integrations
[2023-06-11 18:43:17] INFO Creating table: webhooks
[2023-06-11 18:43:17] INFO Creating table: api_keys
[2023-06-11 18:43:17] INFO Creating table: mobiledoc_revisions
[2023-06-11 18:43:17] INFO Creating table: members
[2023-06-11 18:43:17] INFO Creating table: products
[2023-06-11 18:43:17] INFO Creating table: offers
[2023-06-11 18:43:17] INFO Creating table: benefits
[2023-06-11 18:43:17] INFO Creating table: products_benefits
[2023-06-11 18:43:17] INFO Creating table: members_products
[2023-06-11 18:43:17] INFO Creating table: members_payment_events
[2023-06-11 18:43:17] INFO Creating table: members_login_events
[2023-06-11 18:43:17] INFO Creating table: members_email_change_events
[2023-06-11 18:43:17] INFO Creating table: members_status_events
[2023-06-11 18:43:17] INFO Creating table: members_product_events
[2023-06-11 18:43:17] INFO Creating table: members_paid_subscription_events
[2023-06-11 18:43:17] INFO Creating table: labels
[2023-06-11 18:43:17] INFO Creating table: members_labels
[2023-06-11 18:43:17] INFO Creating table: members_stripe_customers
[2023-06-11 18:43:17] INFO Creating table: members_stripe_customers_subscriptions
[2023-06-11 18:43:17] INFO Creating table: offer_redemptions
[2023-06-11 18:43:17] INFO Creating table: members_subscribe_events
[2023-06-11 18:43:17] INFO Creating table: stripe_products
[2023-06-11 18:43:17] INFO Creating table: stripe_prices
[2023-06-11 18:43:17] INFO Creating table: actions
[2023-06-11 18:43:17] INFO Creating table: emails
[2023-06-11 18:43:17] INFO Creating table: email_batches
[2023-06-11 18:43:17] INFO Creating table: email_recipients
[2023-06-11 18:43:17] INFO Creating table: tokens
[2023-06-11 18:43:17] INFO Creating table: snippets
[2023-06-11 18:43:17] INFO Creating table: temp_member_analytic_events
[2023-06-11 18:43:17] INFO Creating table: custom_theme_settings
[2023-06-11 18:43:17] INFO Model: Product
[2023-06-11 18:43:17] INFO Model: Tag
[2023-06-11 18:43:17] INFO Model: Role
[2023-06-11 18:43:17] INFO Model: Permission
[2023-06-11 18:43:18] INFO Model: User
[2023-06-11 18:43:41] INFO Model: Post
[2023-06-11 18:43:41] INFO Model: Integration
[2023-06-11 18:43:42] INFO Relation: Role to Permission
[2023-06-11 18:43:42] INFO Relation: Post to Tag
[2023-06-11 18:43:42] INFO Relation: User to Role
[2023-06-11 18:43:42] INFO Database is in a ready state.
[2023-06-11 18:43:42] INFO Ghost database ready in25.315s
[2023-06-11 18:43:43] INFO Ghost booted in26.941s
[2023-06-11 18:43:43] INFO Adding offloaded job to the queue
[2023-06-11 18:43:43] INFO Scheduling job update-check at 9338 * * *. Next run on: Mon Jun 122023 08:33:09 GMT+0000 (Coordinated Universal Time)[2023-06-11 18:43:44] INFO Ghost URL Service Ready in27.199s
[2023-06-11 18:44:44] WARN Ghost is shutting down
[2023-06-11 18:44:44] WARN Ghost has shut down
[2023-06-11 18:44:44] WARN Ghost was running for a minute
[2023-06-11 18:44:45] INFO Ghost is running in development...
[2023-06-11 18:44:45] INFO Listening on: 0.0.0.0:2368
[2023-06-11 18:44:45] INFO Url configured as: http://192.168.3.166:2368/
[2023-06-11 18:44:45] INFO Ctrl+C to shut down
[2023-06-11 18:44:45] INFO Ghost server started in0.25s
[2023-06-11 18:44:45] INFO Database is in a ready state.
[2023-06-11 18:44:45] INFO Ghost database ready in0.392s
[2023-06-11 18:44:46] INFO Ghost booted in1.71s
[2023-06-11 18:44:46] INFO Adding offloaded job to the queue
[2023-06-11 18:44:46] INFO Scheduling job update-check at 33815 * * *. Next run on: Mon Jun 12202315:38:03 GMT+0000 (Coordinated Universal Time)[2023-06-11 18:44:47] INFO Ghost URL Service Ready in2.014s
六、注册Ghost账号
6.1 访问Ghost首页
6.2 进入账号注册页面
6.3 填写账号信息
Site title: myweb
Full name: admin
Email address: admin@qq.com
Password: 自定义。
6.4 进入Ghost后台管理页面
七、发布网站内容
7.1 进入内容编辑页面
按如下操作,进入内容编辑页面。
7.2 编辑网站内容
编辑网站内容,选择pulish。
7.3 查看网站内容
访问地址: http://192.168.3.166:2368/
查看新增网页内容
版权归原作者 江湖有缘 所有, 如有侵权,请联系我们删除。