docker部署wizard文档管理系统平台
公司之前用的是showdoc平台,用来进行技术文档的分享和保存,当时只是编写一些简单的markdown文档,但是后来随着文档越来越多,现在需要新的平台的来维持一下,自己也是在网上面找了好久,最终找了wizard,这是一款集成 Markdown 和 Swagger 文档的管理工具,也就是 Wizard 项目了。今天就将部署方法分享一下
大家可以尝试以下云服务器部署下哈,这里咱就用虚拟机哈
官网部署地址:https://gitee.com/orionis/wizard#%E5%8A%9F%E8%83%BD%E6%BC%94%E7%A4%BA
解释一下哈哈
自己也是看了官方文档,如果利用分布式安装的话,首先是个lnmp的架构,其次就是php的扩展的安装比较多,比较耗时间,现如今都是容器化时代,咱们也就利用docker容器来部署吧,部署比较简单,公司里面的生产环境了面也是docker环境,pulll来个镜像跑两个容器就可以解决这个问题了,非常的简单,何乐而不为
涉及的技术内容
搞起来,乐一下
系统版本
|
cpu
|
mem
|
ip
|
注意
|
centos7.5
|
4c
|
4g
|
192.168.100.150
|
cpu和mem这个自己没有测试,但是目前配置来看的话可以正常部署
|
效果图:
部署docker环境
目前大家用的最多的还是docker 的社区版本,这里简单的意思就是用yum进行安装部署,主要是前期的docker环境配置
关闭selinux
[root@localhost ~]# vi /etc/selinux/config #修改selinux配置文件,修改完这个配置文件后需要重启服务器生效的,但是如果说不想重启服务器的话,用下面的那个命令
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost ~]# setenforce 0 #不重启服务器,临时关闭selinux
关闭防火墙
[root@localhost ~]# systemctl stop firewalld #关闭防火墙
[root@localhost ~]# systemctl disable firewalld #关闭防火墙开机自启
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
配置阿里源和加速项
[root@localhost ~]# yum -y install wget #安装wget服务,下载repo文件,配置阿里yum源
已加载插件:fastestmirror
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): extras/7/x86_64/primary_db | 225 kB 00:00:00
(2/4): base/7/x86_64/group_gz | 153 kB 00:00:00
(3/4): updates/7/x86_64/primary_db | 5.6 MB 00:00:01
(4/4): base/7/x86_64/primary_db | 6.1 MB 00:00:03
正在解决依赖关系
--> 正在检查事务
---> 软件包 wget.x86_64.0.1.14-18.el7_6.1 将被 安装
--> 解决依赖关系完成
依赖关系解决
=================================================================================================================================================
Package 架构 版本 源 大小
=================================================================================================================================================
正在安装:
wget x86_64 1.14-18.el7_6.1 base 547 k
=================================================================================================================================================
安装 1 软件包
总下载量:547 k
安装大小:2.0 M
Downloading packages:
警告:/var/cache/yum/x86_64/7/base/packages/wget-1.14-18.el7_6.1.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY0 B --:--:-- ETA
wget-1.14-18.el7_6.1.x86_64.rpm 的公钥尚未安装
wget-1.14-18.el7_6.1.x86_64.rpm | 547 kB 00:00:00
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
用户ID : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
指纹 : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
软件包 : centos-release-7-5.1804.el7.centos.x86_64 (@anaconda)
来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : wget-1.14-18.el7_6.1.x86_64 1/1
验证中 : wget-1.14-18.el7_6.1.x86_64 1/1
wget.x86_64 0:1.14-18.el7_6.1
[root@localhost ~]# cd /etc/yum.repos.d/ #到yum的配置目录中来
[root@localhost yum.repos.d]# ls #下面是没有阿里云的yum源的
CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Sources.repo CentOS-Vault.repo
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo #下载阿里云的yum源
--2021-03-03 16:13:51-- http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 111.63.64.220, 111.63.179.219, 111.63.182.242, ...
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|111.63.64.220|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1919 (1.9K) [application/octet-stream]
正在保存至: “docker-ce.repo”
100%[=======================================================================================================>] 1,919 --.-K/s 用时 0s
2021-03-03 16:13:52 (246 MB/s) - 已保存 “docker-ce.repo” [1919/1919])
[root@localhost yum.repos.d]# ls #下面出现了阿里的docker-ce源
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo docker-ce.repo
[root@localhost yum.repos.d]#
[root@localhost yum.repos.d]# mkdir /etc/docker #创建docker的加速目录
[root@localhost yum.repos.d]# vi /etc/docker/daemon.json #创建并编辑docker的加速文件
"registry-mirrors": ["https://b9pmyelo.mirror.aliyuncs.com"]
}
安装docker
[root@localhost ~]# yum -y install docker-ce #安装docker,由于过程很长,没有粘贴
启动docket
[root@localhost ~]# systemctl start docker #启动docker
[root@localhost ~]# systemctl enable docker #添加到开机自启动里面
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
验证下
[root@localhost ~]# docker info #查看docker的相关信息
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 20.10.5
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-862.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 974.6MiB
Name: localhost.localdomain
ID: ZNHL:MBP3:4SQI:UEE4:B2VS:ED6P:6MFG:TQEQ:ZX5C:WSKP:NEQV:HTYO
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://b9pmyelo.mirror.aliyuncs.com/
Live Restore Enabled: false
出现上面的相关信息,代表着我们的docker已经部署完了,是不是很简单哈
更改一下主机名
[root@localhost ~]# hostnamectl set-hostname api_web #更改主机名为api_web
[root@localhost ~]# init 6 #重启服务器
创建docker自定义网络
[root@api_web ~]# docker network create api #创建自定义网络api,为了最大量的减少服务器暴露的端口
264289fed6124c81dd879ea3bc92021a2e8014badaaea177491f4ffbdb3c7f74
[root@api_web ~]# docker network ls #查看创建的自定义网络
NETWORK ID NAME DRIVER SCOPE
264289fed612 api bridge local
ac0d4938a110 bridge bridge local
5946d5283a3b host host local
c172dc441c48 none null local
拉取mysql5.7
按照官方的文档,需要mysql5.7的版本,当然你也可以在本机上自己部署安装一下,但是这里的话,小编偷个懒,直接用mysql容器来,方便快捷,简单
[root@api_web ~]# docker images #查看当前镜像,目前无
REPOSITORY TAG IMAGE ID CREATED SIZE
[root@api_web ~]# docker pull mysql:5.7 #下拉mysql:5.7镜像
5.7: Pulling from library/mysql
a076a628af6f: Pull complete
f6c208f3f991: Pull complete
88a9455a9165: Pull complete
406c9b8427c6: Pull complete
7c88599c0b25: Pull complete
25b5c6debdaf: Pull complete
43a5816f1617: Pull complete
1831ac1245f4: Pull complete
37677b8c1f79: Pull complete
27e4ac3b0f6e: Pull complete
7227baa8c445: Pull complete
Digest: sha256:b3d1eff023f698cd433695c9506171f0d08a8f92a0c8063c1a4d9db9a55808df
Status: Downloaded newer image for mysql:5.7
docker.io/library/mysql:5.7
[root@api_web ~]# docker images #查看镜像
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7 a70d36bc331a 7 weeks ago 449MB
[root@api_web ~]# docker run -d --name=mysql --net api -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7 #利用mysql:5.7创建一个Mysql容器,mysql的密码为123456
df5863a29b97b01f4ce893296ce4282c9995c2daf08a5d18f51fc32c24b331ad
[root@api_web ~]# docker ps #查看镜像,如果找不到用dicker ps -a看看容器是不是容器自动退出了,如果退出了,说明容器出现问题了,需要排下错喽
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
df5863a29b97 mysql:5.7 "docker-entrypoint.s…" 6 seconds ago Up 4 seconds 3306/tcp, 33060/tcp mysql
[root@api_web ~]# docker inspect mysql | grep -i ipadd #查看Mysql容器的ip地址
"SecondaryIPAddresses": null,
"IPAddress": "",
"IPAddress": "172.18.0.2",
[root@api_web ~]# docker exec -it mysql /bin/bash #进入到mysql容器里面
root@df5863a29b97:/# mysql -uroot -p123456 #连接mysql
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.33 MySQL Community Server (GPL)
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE USER 'wizard'@'%' IDENTIFIED BY 'wizard'; #创建一个叫wizard的用户
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON *.* TO 'wizard'@'%' IDENTIFIED BY 'wizard'; #授权
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> CREATE DATABASE wizard_2; #创建要用到的库
Query OK, 1 row affected (0.00 sec)
mysql> exit #退出mysql
root@df5863a29b97:/# exit #退出容器
[root@api_web ~]#
利用dockerfile来创建wizard镜像
[root@api_web ~]# vi Dockerfile #编写dockerfile
[root@api_web ~]# cat Dockerfile
FROM mylxsw/wizard:latest #基础镜像,如果本地没有会自动下拉
# 数据库连接配置
# 这里可以根据需要添加其它的Env配置,可用选项参考项目的.env.example文件
# 请根据实际情况修改!请根据实际情况修改!请根据实际情况修改!
ENV DB_CONNECTION=mysql #数据库类型
ENV DB_HOST=172.18.0.2 #刚才的那个mysql容器的ip地址
ENV DB_PORT=3306 #数据库端口
ENV DB_DATABASE=wizard_2 #上面所创建的库
ENV DB_USERNAME=wizard #mysql账户
ENV DB_PASSWORD=wizard #密码,所有的配置一定要与上面在Mysql容器里面操作 的一样哈
# 应用名称
ENV APP_NAME="Doc"
# 环境,正式请使用 production
ENV APP_ENV=production
#ENV APP_KEY=base64:pWMnse89AD/SRB042cMGR894FCACcdekgeq91deDQEC091=
# 邮件服务器配置,请根据实际情况修改!请根据实际情况修改!请根据实际情况修改!
ENV MAIL_DRIVER=smtp
ENV MAIL_HOST=
ENV MAIL_PORT=
ENV MAIL_USERNAME=
ENV MAIL_PASSWORD=
ENV MAIL_ENCRYPTION=
ENV MAIL_FROM_NAME=
# 表格文档配置
ENV WIZARD_SPREEDSHEET_MAX_ROWS=1000
ENV WIZARD_SPREEDSHEET_MAX_COLS=26
# 用户帐号是否需要邮件激活
ENV WIZARD_NEED_ACTIVATE=false #这个false代表不用邮箱激活,true要用邮箱激活,如果要用邮箱激活的话,还得配置相应的邮箱服务
# 加密密钥
#ENV WIZARD_JWT_SECRET=QMCEeWEARHJKPR457fqgASGRHAhr573fh452gd
# 访问地址,只有正确配置后,导出的 markdown 文档图片才能正常展示
# 请根据实际情况修改!请根据实际情况修改!请根据实际情况修改!
ENV APP_URL=http://localhost:80
# 文件上传存储目录
VOLUME /webroot/storage/app/public
RUN php artisan config:cache
#利用dockerfile创建镜像
[root@api_web ~]# docker build -t my-wizard .
Sending build context to Docker daemon 12.29kB
Step 1/22 : FROM mylxsw/wizard:latest
latest: Pulling from mylxsw/wizard
852e50cd189d: Pulling fs layer
0266fc315b01: Pulling fs layer
4c8a5fa787a1: Pulling fs layer
46fc127c1884: Pulling fs layer
f768b7fadf16: Pulling fs layer
345b578c1a78: Pulling fs layer
90aafe41e78d: Pulling fs layer
f0e2a6f2509d: Pulling fs layer
0f105eaad828: Pulling fs layer
588384212186: Pulling fs layer
db665418db9f: Pulling fs layer
c0e1772b78a5: Pulling fs layer
51da2c0d5e03: Pulling fs layer
45512e0781a8: Pull complete
83dc12dc36df: Pull complete
74246e883eb7: Pull complete
fd9d87db4637: Pull complete
acfeec3d16a5: Pull complete
e843c5f75f43: Pull complete
1a09ae43b9f1: Pull complete
4de29a76d77b: Pull complete
b237769204ad: Pull complete
51319d2fbd8e: Pull complete
357544009c9d: Pull complete
3c90b9a088e4: Pull complete
0955ec899c5d: Pull complete
19fa9869706a: Pull complete
Digest: sha256:ade1bc93d2ae9a689d44f187a8289130bf35afd6409acb8c704ce8a5133597f4
Status: Downloaded newer image for mylxsw/wizard:latest
---> 9b6ad847767e
Step 2/22 : ENV DB_CONNECTION=mysql
---> Running in 041566c0d124
Removing intermediate container 041566c0d124
---> 00c41b225505
Step 3/22 : ENV DB_HOST=172.18.0.2
---> Running in ece38e6e78e9
Removing intermediate container ece38e6e78e9
---> aadc1e549ca5
Step 4/22 : ENV DB_PORT=3306
---> Running in 46f84b9d1382
Removing intermediate container 46f84b9d1382
---> 7eb468fd87f6
Step 5/22 : ENV DB_DATABASE=wizard_2
---> Running in f940f14d322a
Removing intermediate container f940f14d322a
---> 7180b5d9fd13
Step 6/22 : ENV DB_USERNAME=wizard
---> Running in 8ec2f608f294
Removing intermediate container 8ec2f608f294
---> 9aed9ba378c6
Step 7/22 : ENV DB_PASSWORD=wizard
---> Running in f3eae84d9492
Removing intermediate container f3eae84d9492
---> 8d0e146da8ab
Step 8/22 : ENV APP_NAME="Doc"
---> Running in 995f430c97fd
Removing intermediate container 995f430c97fd
---> 3b7b850428b6
Step 9/22 : ENV APP_ENV=production
---> Running in e5d50e972a09
Removing intermediate container e5d50e972a09
---> d22b10cbf4da
Step 10/22 : ENV MAIL_DRIVER=smtp
---> Running in 5ff110472556
Removing intermediate container 5ff110472556
---> 0a6439c1ad9d
Step 11/22 : ENV MAIL_HOST=
---> Running in d11e61c0267f
Removing intermediate container d11e61c0267f
---> 38059cc65ff8
Step 12/22 : ENV MAIL_PORT=
---> Running in c4924a409e4c
Removing intermediate container c4924a409e4c
---> e941ce926d1e
Step 13/22 : ENV MAIL_USERNAME=
---> Running in 4d8feb4fca01
Removing intermediate container 4d8feb4fca01
---> d955638e2549
Step 14/22 : ENV MAIL_PASSWORD=
---> Running in 1dd150ef935d
Removing intermediate container 1dd150ef935d
---> a3af1d1b5daa
Step 15/22 : ENV MAIL_ENCRYPTION=
---> Running in effb08850b2e
Removing intermediate container effb08850b2e
---> 0d7f3cf68cae
Step 16/22 : ENV MAIL_FROM_NAME=
---> Running in 2b4bfa1e1c5f
Removing intermediate container 2b4bfa1e1c5f
---> 514f6391f91a
Step 17/22 : ENV WIZARD_SPREEDSHEET_MAX_ROWS=1000
---> Running in 16b334cb5eb9
Removing intermediate container 16b334cb5eb9
---> de7a51041e58
Step 18/22 : ENV WIZARD_SPREEDSHEET_MAX_COLS=26
---> Running in dbe526a89f23
Removing intermediate container dbe526a89f23
---> 60f222f69252
Step 19/22 : ENV WIZARD_NEED_ACTIVATE=false
---> Running in 43f566f712e7
Removing intermediate container 43f566f712e7
---> 5aef7cd77344
Step 20/22 : ENV APP_URL=http://localhost:80
---> Running in f0a36eb8faf6
Removing intermediate container f0a36eb8faf6
---> 26436b9f7b22
Step 21/22 : VOLUME /webroot/storage/app/public
---> Running in 736d6b850dba
Removing intermediate container 736d6b850dba
---> 5545ce91b72c
Step 22/22 : RUN php artisan config:cache
---> Running in d5f7af2663c2
Configuration cache cleared!
Configuration cached successfully!
Removing intermediate container d5f7af2663c2
---> 8197540005d6
Successfully built 8197540005d6
Successfully tagged my-wizard:latest
[root@api_web ~]#
##对数据库进行初始化
[root@api_web ~]# docker run -it --rm --name my-wizard --net api my-wizard php artisan migrate:install
Migration table created successfully.
[root@api_web ~]# docker run -it --rm --name my-wizard --net api my-wizard php artisan migrate
**************************************
* Application In Production! *
**************************************
Do you really wish to run this command? (yes/no) [no]:
> yes #这里输入yes
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table (0.02 seconds)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table (0.01 seconds)
Migrating: 2017_07_31_012730_create_project_table
Migrated: 2017_07_31_012730_create_project_table (0.01 seconds)
Migrating: 2017_07_31_013758_create_page_table
Migrated: 2017_07_31_013758_create_page_table (0.01 seconds)
Migrating: 2017_08_01_151100_create_page_history_table
Migrated: 2017_08_01_151100_create_page_history_table (0.01 seconds)
Migrating: 2017_08_03_232417_create_operation_logs_table
Migrated: 2017_08_03_232417_create_operation_logs_table (0.01 seconds)
Migrating: 2017_08_04_143640_create_template_table
Migrated: 2017_08_04_143640_create_template_table (0.01 seconds)
Migrating: 2017_08_06_115558_create_group_table
Migrated: 2017_08_06_115558_create_group_table (0.01 seconds)
Migrating: 2017_08_06_120713_create_user_group_ref_table
Migrated: 2017_08_06_120713_create_user_group_ref_table (0.01 seconds)
Migrating: 2017_08_06_122310_update_user_table
Migrated: 2017_08_06_122310_update_user_table (0.01 seconds)
Migrating: 2017_08_06_124106_create_project_group_ref_table
Migrated: 2017_08_06_124106_create_project_group_ref_table (0.01 seconds)
Migrating: 2017_08_10_093939_create_categories_table
Migrated: 2017_08_10_093939_create_categories_table (0.01 seconds)
Migrating: 2017_08_11_171545_create_share_table
Migrated: 2017_08_11_171545_create_share_table (0.01 seconds)
Migrating: 2017_08_17_224954_create_comments_table
Migrated: 2017_08_17_224954_create_comments_table (0.01 seconds)
Migrating: 2017_08_18_133716_create_attachments_table
Migrated: 2017_08_18_133716_create_attachments_table (0.01 seconds)
Migrating: 2017_08_19_002350_create_notifications_table
Migrated: 2017_08_19_002350_create_notifications_table (0.03 seconds)
Migrating: 2017_09_19_174315_modify_operation_logs
Migrated: 2017_09_19_174315_modify_operation_logs (0.01 seconds)
Migrating: 2017_09_24_145801_modify_user_table
Migrated: 2017_09_24_145801_modify_user_table (0.01 seconds)
Migrating: 2018_01_27_150601_modify_project_table
Migrated: 2018_01_27_150601_modify_project_table (0.01 seconds)
Migrating: 2018_04_11_172516_create_project_catalogs_table
Migrated: 2018_04_11_172516_create_project_catalogs_table (0.01 seconds)
Migrating: 2018_04_11_172816_modify_project_add_catalog
Migrated: 2018_04_11_172816_modify_project_add_catalog (0.01 seconds)
Migrating: 2018_04_12_143655_create_project_star_table
Migrated: 2018_04_12_143655_create_project_star_table (0.01 seconds)
Migrating: 2018_05_10_105015_create_tags_table
Migrated: 2018_05_10_105015_create_tags_table (0.01 seconds)
Migrating: 2018_05_10_105629_create_page_tag_table
Migrated: 2018_05_10_105629_create_page_tag_table (0.02 seconds)
Migrating: 2018_12_11_164112_add_sort_to_nav
Migrated: 2018_12_11_164112_add_sort_to_nav (0.01 seconds)
Migrating: 2018_12_11_164721_add_sort_to_nav_history
Migrated: 2018_12_11_164721_add_sort_to_nav_history (0.01 seconds)
Migrating: 2019_04_20_141850_add_sync_to_pages
Migrated: 2019_04_20_141850_add_sync_to_pages (0.01 seconds)
Migrating: 2019_04_20_141934_add_sync_filed_to_page_histories
Migrated: 2019_04_20_141934_add_sync_filed_to_page_histories (0.01 seconds)
Migrating: 2019_04_27_214733_add_objectguid_column
Migrated: 2019_04_27_214733_add_objectguid_column (0.01 seconds)
Migrating: 2019_08_09_115948_optimize_pages
Migrated: 2019_08_09_115948_optimize_pages (0.01 seconds)
Migrating: 2019_08_09_120209_optimize_page_histories
Migrated: 2019_08_09_120209_optimize_page_histories (0.01 seconds)
Migrating: 2019_08_09_120318_optimize_project_stars
Migrated: 2019_08_09_120318_optimize_project_stars (0.01 seconds)
Migrating: 2019_08_09_120748_optimize_attachments
Migrated: 2019_08_09_120748_optimize_attachments (0.01 seconds)
Migrating: 2019_11_13_103848_add_show_in_home_to_catalogs
Migrated: 2019_11_13_103848_add_show_in_home_to_catalogs (0.01 seconds)
Migrating: 2019_12_31_115014_create_widget_table
Migrated: 2019_12_31_115014_create_widget_table (0.01 seconds)
Migrating: 2020_10_10_180119_create_page_score
Migrated: 2020_10_10_180119_create_page_score (0.01 seconds)
[root@api_web ~]#
#l利用镜像创建一个容器,并把80端口映射出来,供浏览器进行访问
[root@api_web ~]# docker run -d --name my-wizard --net api --mount source=my-wizard,target=/webroot/storage/app/public -p 80:80 my-wizard
cd309739f45e60c950f830202656e886b42b0ea56917df73fa70bcece1424c8e
[root@api_web ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cd309739f45e my-wizard "docker-php-entrypoi…" 3 seconds ago Up 2 seconds 0.0.0.0:80->80/tcp my-wizard
df5863a29b97 mysql:5.7 "docker-entrypoint.s…" 16 minutes ago Up 16 minutes 3306/tcp, 33060/tcp mysql
[root@api_web ~]# curl 192.168.100.150 #本地访问测试
<!DOCTYPE html>
<html lang="zh-CN">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<meta name="description" content="">
<meta name="author" content="">
<meta name="csrf-token" content="qrusE4Z9LY43pFrRW0dvSfhzLlJfa3xvqzRBqu39">
<!-- 网站icon,来自于Google开源图标 -->
<link rel="icon" type="image/png" href="/favorite.png">
<title>首页 - Doc</title>
<link href="/assets/css/normalize.css" rel="stylesheet">
<link href="/assets/css/tagmanager.css" rel="stylesheet">
*************************省略
[root@api_web ~]# ss -antup | grep 80 #查看映射端口是否正常开启
tcp LISTEN 0 128 *:80 *:* users:(("docker-proxy",pid=2616,fd=4))
验证一下
打开浏览器,输入 服务器IP+容器映射的端口,就可以访问了,例如我的是192.168.100.150:80
一些基本的使用
注册账号
切记:注册的第一个账户为管理员
其他的就自己摸索吧,加油奥里给
其他的一些配置
[root@api_web ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cd309739f45e my-wizard "docker-php-entrypoi…" 5 minutes ago Up 5 minutes 0.0.0.0:80->80/tcp my-wizard
df5863a29b97 mysql:5.7 "docker-entrypoint.s…" 22 minutes ago Up 22 minutes 3306/tcp, 33060/tcp mysql
[root@api_web ~]# docker exec -it cd309739f45e /bin/bash #进入到容器里面
root@cd309739f45e:/webroot# which php
/usr/local/bin/php
root@cd309739f45e:/webroot# php --ini #查看php的ini文件位置
Configuration File (php.ini) Path: /usr/local/etc/php
Loaded Configuration File: (none)
Scan for additional .ini files in: /usr/local/etc/php/conf.d
Additional .ini files parsed: /usr/local/etc/php/conf.d/date_timezone.ini,
/usr/local/etc/php/conf.d/docker-php-ext-exif.ini,
/usr/local/etc/php/conf.d/docker-php-ext-gd.ini,
/usr/local/etc/php/conf.d/docker-php-ext-ldap.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini,
/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini,
/usr/local/etc/php/conf.d/docker-php-ext-zip.ini,
/usr/local/etc/php/conf.d/memory-limit.ini, #内存限制
/usr/local/etc/php/conf.d/upload-limit.ini #控制上传
root@cd309739f45e:/webroot# cat /usr/local/etc/php/conf.d/upload-limit.ini
upload_max_filesize = 100M #这里面的100代表着,上传附件的限制是100M,当然可以根据需要自己调整
post_max_size = 0 #0代表着不限制,如果不为零,一定要比上面的数大
结束
熬夜只是为了更好的明天