|
|
@@ -105,37 +105,37 @@ class Start
|
|
|
system("cp -Rf /workspace/projects/boss {$directory}");
|
|
|
system("cp -Rf /workspace/projects/festival {$directory}");
|
|
|
// 创建日志相关目录
|
|
|
- mkdir($directory . 'log/pm2', 0777, true); //
|
|
|
- mkdir($directory . 'log/proginn_cache', 0777, true); //
|
|
|
+ mkdir($directory . '/log/pm2', 0777, true); //
|
|
|
+ mkdir($directory . '/log/proginn_cache', 0777, true); //
|
|
|
// 配置存放目录
|
|
|
- mkdir($directory . 'config', 0777, true); //
|
|
|
+ mkdir($directory . '/config', 0777, true); //
|
|
|
// yml 文件
|
|
|
- $template = file_get_contents(ROOT_DIR . 'dockerfile/template.yml');
|
|
|
+ $template = file_get_contents(ROOT_DIR . '/dockerfile/template.yml');
|
|
|
$template = str_replace('<containerName>', $name, $template);
|
|
|
$template = str_replace('<ip>', $ipv4, $template);
|
|
|
$template = str_replace('<proginn-branch>', $proginnBranch, $template);
|
|
|
$template = str_replace('<rooter-branch>', $rooterBranch, $template);
|
|
|
$template = str_replace('<proginn-frontend-branch>', $proginnFrontendBranch, $template);
|
|
|
$template = str_replace('<domain>', $fullDomain, $template);
|
|
|
- file_put_contents($directory . 'config/docker.yml', $template);
|
|
|
+ file_put_contents($directory . '/config/docker.yml', $template);
|
|
|
// nginx 配置
|
|
|
- $proxy = file_get_contents(ROOT_DIR . 'config/nginx/template/proxy.nginx.conf');
|
|
|
+ $proxy = file_get_contents(ROOT_DIR . '/config/nginx/template/proxy.nginx.conf');
|
|
|
$proxy = str_replace('{{domain}}', $domain, $proxy);
|
|
|
$proxy = str_replace('{{ip}}', $ipv4, $proxy);
|
|
|
file_put_contents("/workspace/commonContainers/nginx/conf.d/{$name}.conf", $proxy);
|
|
|
- $proginn = file_get_contents(ROOT_DIR . 'config/nginx/template/proginn.nginx.conf');
|
|
|
+ $proginn = file_get_contents(ROOT_DIR . '/config/nginx/template/proginn.nginx.conf');
|
|
|
$proginn = str_replace('{{domain}}', $domain, $proginn);
|
|
|
$proginn = str_replace('{{ip}}', $ipv4, $proginn);
|
|
|
- file_put_contents("{$directory}config/nginx.conf", $proginn);
|
|
|
+ file_put_contents("{$directory}/config/nginx.conf", $proginn);
|
|
|
// 启动容器
|
|
|
- system("docker-compose -f {$directory}config/docker.yml up -d");
|
|
|
+ system("docker-compose -f {$directory}/config/docker.yml up -d");
|
|
|
// 重载Nginx
|
|
|
system("docker exec nginx nginx -s reload");
|
|
|
$this->getConnection()->query('commit');
|
|
|
} catch (\Throwable $e) {
|
|
|
$this->getConnection()->query('rollback');
|
|
|
- if (file_exists($directory . 'config/docker.yml')) {
|
|
|
- system("docker-compose -f {$directory}config/docker.yml rm -s -f");
|
|
|
+ if (file_exists($directory . '/config/docker.yml')) {
|
|
|
+ system("docker-compose -f {$directory}/config/docker.yml rm -s -f");
|
|
|
}
|
|
|
// 容器存储目录
|
|
|
$directory = $this->containersBasePath . $name;
|
|
|
@@ -161,8 +161,8 @@ class Start
|
|
|
$db->delete('sites', [
|
|
|
'name' => $name,
|
|
|
]);
|
|
|
- if (file_exists($directory . 'config/docker.yml')) {
|
|
|
- system("docker-compose -f {$directory}config/docker.yml rm -s -f");
|
|
|
+ if (file_exists($directory . '/config/docker.yml')) {
|
|
|
+ system("docker-compose -f {$directory}/config/docker.yml rm -s -f");
|
|
|
}
|
|
|
// 容器存储目录
|
|
|
$directory = $this->containersBasePath . $name;
|