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