mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-14 04:32:49 +00:00
no message
This commit is contained in:
parent
467f2368dd
commit
7ef31bc0b5
@ -124,7 +124,7 @@ class Apps
|
|||||||
self::saveAppConfig($appName, $updateConfig);
|
self::saveAppConfig($appName, $updateConfig);
|
||||||
|
|
||||||
// 执行docker-compose命令
|
// 执行docker-compose命令
|
||||||
$curlPath = "apps/{$command}/{$appName}";
|
$curlPath = "app/{$command}/{$appName}";
|
||||||
if ($command === 'up') {
|
if ($command === 'up') {
|
||||||
$curlPath .= "?callback_url=" . urlencode("http://host.docker.internal:" . env("APP_PORT") . "/api/apps/install/callback?install_num=" . $updateConfig[$prefix . '_num']);
|
$curlPath .= "?callback_url=" . urlencode("http://host.docker.internal:" . env("APP_PORT") . "/api/apps/install/callback?install_num=" . $updateConfig[$prefix . '_num']);
|
||||||
}
|
}
|
||||||
@ -177,12 +177,6 @@ class Apps
|
|||||||
return Base::retError('更新状态失败');
|
return Base::retError('更新状态失败');
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = self::nginxUpdate($appName);
|
|
||||||
if (Base::isError($res)) {
|
|
||||||
self::saveAppConfig($appName, ['status' => 'error']);
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理安装成功或卸载成功后的操作
|
// 处理安装成功或卸载成功后的操作
|
||||||
$message = '更新成功';
|
$message = '更新成功';
|
||||||
if ($status == 'installed') {
|
if ($status == 'installed') {
|
||||||
@ -197,46 +191,6 @@ class Apps
|
|||||||
return Base::retSuccess($message);
|
return Base::retSuccess($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新nginx配置
|
|
||||||
* @param string $appName
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public static function nginxUpdate(string $appName): array
|
|
||||||
{
|
|
||||||
// 获取安装配置信息
|
|
||||||
$appConfig = self::getAppConfig($appName);
|
|
||||||
|
|
||||||
// nginx配置文件处理
|
|
||||||
$nginxFile = base_path('docker/appstore/apps/' . $appName . '/' . $appConfig['install_version'] . '/nginx.conf');
|
|
||||||
$nginxTarget = base_path('docker/appstore/configs/' . $appName . '/nginx.conf');
|
|
||||||
$needReload = false;
|
|
||||||
if (file_exists($nginxTarget)) {
|
|
||||||
unlink($nginxTarget);
|
|
||||||
$needReload = true;
|
|
||||||
}
|
|
||||||
if (file_exists($nginxFile) && $appConfig['status'] === 'installed') {
|
|
||||||
copy($nginxFile, $nginxTarget);
|
|
||||||
$res = self::curl("nginx/test");
|
|
||||||
if (Base::isError($res)) {
|
|
||||||
unlink($nginxTarget);
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
$needReload = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重启nginx
|
|
||||||
if ($needReload) {
|
|
||||||
$res = self::curl("nginx/reload");
|
|
||||||
if (Base::isError($res)) {
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 返回结果
|
|
||||||
return Base::retSuccess("success");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取应用信息
|
* 获取应用信息
|
||||||
* @param string $appName 应用名称
|
* @param string $appName 应用名称
|
||||||
|
|||||||
@ -39,6 +39,7 @@ services:
|
|||||||
- "${APP_PORT}:80"
|
- "${APP_PORT}:80"
|
||||||
- "${APP_SSL_PORT:-}:443"
|
- "${APP_SSL_PORT:-}:443"
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
|
||||||
- ./:/var/www
|
- ./:/var/www
|
||||||
networks:
|
networks:
|
||||||
extnetwork:
|
extnetwork:
|
||||||
|
|||||||
@ -3,6 +3,6 @@ Directory structure
|
|||||||
```
|
```
|
||||||
appstore/
|
appstore/
|
||||||
├── apps/ # Application Directory
|
├── apps/ # Application Directory
|
||||||
├── config/ # Configuration file directory
|
├── configs/ # Configuration file directory
|
||||||
└── logs/ # Log file directory
|
└── logs/ # Log file directory
|
||||||
```
|
```
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user