Wiki source code of iTop开发调试指南
Version 1.1 by superadmin on 2024/12/12, 16:56
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | = 开发调试指南 = |
| 2 | |||
| 3 | |||
| 4 | 本文档解释了如何快速搭建开发调试环境 | ||
| 5 | |||
| 6 | |||
| 7 | 这里我们使用docker进行环境部署和开发调试。 | ||
| 8 | |||
| 9 | 1、下载代码到本地,解压web目录,在目录中执行以下命令 | ||
| 10 | |||
| 11 | {{{docker run -d -p 8000:80 -p 3306:3306 -v $PWD:/var/www/html/ --name=itop-3.0.0 vbkunin/itop:3.0.0 | ||
| 12 | }}} | ||
| 13 | |||
| 14 | |||
| 15 | 2、输入http:~/~/localhost:8000/,进行安装。 | ||
| 16 | |||
| 17 | |||
| 18 | 3、安装中需要输入数据库地址和密码,执行下方命令: | ||
| 19 | |||
| 20 | {{{docker logs itop-3.0.0 | grep -A7 -B1 "Your MySQL user 'admin' has password:" | ||
| 21 | }}} | ||
| 22 | |||
| 23 | |||
| 24 | 4、安装toolkit | ||
| 25 | |||
| 26 | {{{docker exec itop-3.0.0 /install-toolkit.sh | ||
| 27 | }}} | ||
| 28 | |||
| 29 | |||
| 30 | 国内无法访问对应包,可以下载后,拷贝到开发程序目录中。 | ||
| 31 | |||
| 32 | |||
| 33 | 地址来源: | ||
| 34 | |||
| 35 | * [[https:~~/~~/www.combodo.com/documentation/iTopDataModelToolkit-3.0.0.zip>>url:https://www.combodo.com/documentation/iTopDataModelToolkit-3.0.0.zip]] | ||
| 36 | * [[https:~~/~~/github.com/Combodo/itop-toolkit-community/archive/refs/tags/3.0.0.zip>>url:https://github.com/Combodo/itop-toolkit-community/archive/refs/tags/3.0.0.zip]] | ||
| 37 | |||
| 38 | |||
| 39 | 5、开启远程调试 | ||
| 40 | |||
| 41 | 首先,调整源: | ||
| 42 | |||
| 43 | {{{# 进入容器 | ||
| 44 | docker exec -it itop-3.0.0 /bin/bash | ||
| 45 | # 执行以下命令 | ||
| 46 | echo ' | ||
| 47 | deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse | ||
| 48 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse | ||
| 49 | |||
| 50 | deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse | ||
| 51 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse | ||
| 52 | |||
| 53 | deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse | ||
| 54 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse | ||
| 55 | |||
| 56 | deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse | ||
| 57 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse | ||
| 58 | |||
| 59 | deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse | ||
| 60 | deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse | ||
| 61 | |||
| 62 | deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu focal main | ||
| 63 | #deb-src https://ppa.launchpadcontent.net/ondrej/php/ubuntu focal main | ||
| 64 | ' > /etc/apt/sources.list.d/aliyun.list | ||
| 65 | # 退出 | ||
| 66 | exit | ||
| 67 | }}} | ||
| 68 | |||
| 69 | |||
| 70 | 其次,执行调试命令:docker exec itop-3.0.0 /install-xdebug.sh [client_port] [idekey],如下 | ||
| 71 | |||
| 72 | {{{docker exec itop-3.0.0 /install-xdebug.sh 9003 phpstorm | ||
| 73 | }}} | ||
| 74 | |||
| 75 | 6、配置PHPSTORM | ||
| 76 | |||
| 77 | * Languages & Frameworks » PHP »Debug 设置9003端口 | ||
| 78 | * 新建调试Run/Debug Configurations | ||
| 79 | * 新建PHP Remote Debug -> 新建Server -> Host地址 ->mapping path ->IDE KEY(PHPSTORM) | ||
| 80 | * Validate验证配置 | ||
| 81 | |||
| 82 | ---- | ||
| 83 | |||
| 84 | **参考资料:** | ||
| 85 | |||
| 86 | * 1、https:~/~/github.com/vbkunin/itop-docker | ||
| 87 | * 2、http:~/~/wjhsh.net/yjken-p-6555438.html | ||
| 88 | * 3、https:~/~/github.com/Combodo/itop-toolkit-community/releases |