mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 02:12:53 +00:00
perf: 优化docker配置
This commit is contained in:
parent
193ad8d902
commit
9716d7fe43
@ -17,7 +17,7 @@ LOG_CHANNEL=stack
|
|||||||
LOG_LEVEL=debug
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
DB_CONNECTION=mysql
|
DB_CONNECTION=mysql
|
||||||
DB_HOST="${APP_IPPR}.5"
|
DB_HOST=mariadb
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
DB_DATABASE=dootask
|
DB_DATABASE=dootask
|
||||||
DB_USERNAME=dootask
|
DB_USERNAME=dootask
|
||||||
@ -34,7 +34,7 @@ SESSION_LIFETIME=120
|
|||||||
|
|
||||||
MEMCACHED_HOST=127.0.0.1
|
MEMCACHED_HOST=127.0.0.1
|
||||||
|
|
||||||
REDIS_HOST="${APP_IPPR}.4"
|
REDIS_HOST=redis
|
||||||
REDIS_PASSWORD=null
|
REDIS_PASSWORD=null
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
|||||||
@ -666,7 +666,7 @@ class FileController extends AbstractController
|
|||||||
//
|
//
|
||||||
if ($status === 2) {
|
if ($status === 2) {
|
||||||
$parse = parse_url($url);
|
$parse = parse_url($url);
|
||||||
$from = 'http://' . env('APP_IPPR') . '.3' . $parse['path'] . '?' . $parse['query'];
|
$from = 'http://nginx' . $parse['path'] . '?' . $parse['query'];
|
||||||
$path = 'uploads/file/' . $file->type . '/' . date("Ym") . '/' . $file->id . '/' . $key;
|
$path = 'uploads/file/' . $file->type . '/' . date("Ym") . '/' . $file->id . '/' . $key;
|
||||||
$save = public_path($path);
|
$save = public_path($path);
|
||||||
Base::makeDir(dirname($save));
|
Base::makeDir(dirname($save));
|
||||||
|
|||||||
@ -1510,7 +1510,7 @@ class SystemController extends AbstractController
|
|||||||
}
|
}
|
||||||
// 添加office资源
|
// 添加office资源
|
||||||
$officePath = '';
|
$officePath = '';
|
||||||
$officeApi = 'http://' . env('APP_IPPR') . '.6/web-apps/apps/api/documents/api.js';
|
$officeApi = 'http://office/web-apps/apps/api/documents/api.js';
|
||||||
$content = @file_get_contents($officeApi);
|
$content = @file_get_contents($officeApi);
|
||||||
if ($content) {
|
if ($content) {
|
||||||
if (preg_match("/const\s+ver\s*=\s*'\/*([^']+)'/", $content, $matches)) {
|
if (preg_match("/const\s+ver\s*=\s*'\/*([^']+)'/", $content, $matches)) {
|
||||||
|
|||||||
@ -493,7 +493,7 @@ class IndexController extends InvokeController
|
|||||||
if (in_array($ext, File::localExt)) {
|
if (in_array($ext, File::localExt)) {
|
||||||
$url = Base::fillUrl($path);
|
$url = Base::fillUrl($path);
|
||||||
} else {
|
} else {
|
||||||
$url = 'http://' . env('APP_IPPR') . '.3/' . $path;
|
$url = 'http://nginx/' . $path;
|
||||||
}
|
}
|
||||||
$url = Base::urlAddparameter($url, [
|
$url = Base::urlAddparameter($url, [
|
||||||
'fullfilename' => Base::rightDelete($name, '.' . $ext) . '_' . filemtime($file) . '.' . $ext
|
'fullfilename' => Base::rightDelete($name, '.' . $ext) . '_' . filemtime($file) . '.' . $ext
|
||||||
|
|||||||
@ -47,7 +47,7 @@ class UserCheckinFace extends AbstractModel
|
|||||||
$record = base64_encode(file_get_contents($faceFile));
|
$record = base64_encode(file_get_contents($faceFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = 'http://' . env('APP_IPPR') . '.14' . ":7788/user";
|
$url = "http://face:7788/user";
|
||||||
$data = [
|
$data = [
|
||||||
'name' => $nickname,
|
'name' => $nickname,
|
||||||
'enrollid' => $userid,
|
'enrollid' => $userid,
|
||||||
@ -92,7 +92,7 @@ class UserCheckinFace extends AbstractModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function deleteDeviceUser($userid) {
|
public static function deleteDeviceUser($userid) {
|
||||||
$url = 'http://' . env('APP_IPPR') . '.14' . ":7788/user/delete";
|
$url = "http://face:7788/user/delete";
|
||||||
$data = [
|
$data = [
|
||||||
'enrollid' => $userid,
|
'enrollid' => $userid,
|
||||||
'backupnum' => 50, // 13 删除整个用户 50 删除图片
|
'backupnum' => 50, // 13 删除整个用户 50 删除图片
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class ElasticSearchBase
|
|||||||
*/
|
*/
|
||||||
public function __construct($index = null)
|
public function __construct($index = null)
|
||||||
{
|
{
|
||||||
$host = env('ELASTICSEARCH_HOST', env('APP_IPPR') . '.15');
|
$host = env('ELASTICSEARCH_HOST', 'es');
|
||||||
$port = env('ELASTICSEARCH_PORT', '9200');
|
$port = env('ELASTICSEARCH_PORT', '9200');
|
||||||
$scheme = env('ELASTICSEARCH_SCHEME', 'http');
|
$scheme = env('ELASTICSEARCH_SCHEME', 'http');
|
||||||
$user = env('ELASTICSEARCH_USER', '');
|
$user = env('ELASTICSEARCH_USER', '');
|
||||||
|
|||||||
@ -424,7 +424,7 @@ class BotReceiveMsgTask extends AbstractTask
|
|||||||
*/
|
*/
|
||||||
private function botWebhookBusiness(string $command, WebSocketDialogMsg $msg, User $botUser, WebSocketDialog $dialog)
|
private function botWebhookBusiness(string $command, WebSocketDialogMsg $msg, User $botUser, WebSocketDialog $dialog)
|
||||||
{
|
{
|
||||||
$serverUrl = 'http://' . env('APP_IPPR') . '.3';
|
$serverUrl = 'http://nginx';
|
||||||
$userBot = null;
|
$userBot = null;
|
||||||
$extras = [];
|
$extras = [];
|
||||||
$errorContent = null;
|
$errorContent = null;
|
||||||
|
|||||||
31
cmd
31
cmd
@ -463,7 +463,7 @@ if [ $# -gt 0 ]; then
|
|||||||
# 启动容器
|
# 启动容器
|
||||||
[[ "$(arg_get port)" -gt 0 ]] && env_set APP_PORT "$(arg_get port)"
|
[[ "$(arg_get port)" -gt 0 ]] && env_set APP_PORT "$(arg_get port)"
|
||||||
$COMPOSE up php -d
|
$COMPOSE up php -d
|
||||||
# 安装composer依赖
|
# 安装PHP依赖
|
||||||
run_exec php "composer install"
|
run_exec php "composer install"
|
||||||
if [ ! -f "${cur_path}/vendor/autoload.php" ]; then
|
if [ ! -f "${cur_path}/vendor/autoload.php" ]; then
|
||||||
run_exec php "composer config repo.packagist composer https://packagist.phpcomposer.com"
|
run_exec php "composer config repo.packagist composer https://packagist.phpcomposer.com"
|
||||||
@ -475,32 +475,15 @@ if [ $# -gt 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
[[ -z "$(env_get APP_KEY)" ]] && run_exec php "php artisan key:generate"
|
[[ -z "$(env_get APP_KEY)" ]] && run_exec php "php artisan key:generate"
|
||||||
|
# 设置生产模式
|
||||||
switch_debug "false"
|
switch_debug "false"
|
||||||
# 检查数据库
|
|
||||||
remaining=10
|
|
||||||
while [ ! -f "${cur_path}/docker/mysql/data/$(env_get DB_DATABASE)/db.opt" ]; do
|
|
||||||
((remaining=$remaining-1))
|
|
||||||
if [ $remaining -lt 0 ]; then
|
|
||||||
error "数据库初始化失败!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sleep 3
|
|
||||||
done
|
|
||||||
# 数据库迁移
|
# 数据库迁移
|
||||||
remaining=10
|
run_exec php "php artisan migrate --seed"
|
||||||
while [ ! -f "${cur_path}/docker/mysql/data/$(env_get DB_DATABASE)/$(env_get DB_PREFIX)migrations.ibd" ]; do
|
# 启动其他容器
|
||||||
((remaining=$remaining-1))
|
|
||||||
if [ $remaining -lt 0 ]; then
|
|
||||||
error "数据库安装失败!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sleep 3
|
|
||||||
run_exec php "php artisan migrate --seed"
|
|
||||||
done
|
|
||||||
# 设置初始化密码
|
|
||||||
$COMPOSE up -d
|
$COMPOSE up -d
|
||||||
success "安装完成"
|
success "安装完成"
|
||||||
info "地址: http://${GreenBG}127.0.0.1:$(env_get APP_PORT)${Font}"
|
info "地址: http://${GreenBG}127.0.0.1:$(env_get APP_PORT)${Font}"
|
||||||
|
# 设置初始化密码
|
||||||
run_exec mariadb "sh /etc/mysql/repassword.sh"
|
run_exec mariadb "sh /etc/mysql/repassword.sh"
|
||||||
elif [[ "$1" == "update" ]]; then
|
elif [[ "$1" == "update" ]]; then
|
||||||
shift 1
|
shift 1
|
||||||
@ -594,9 +577,9 @@ if [ $# -gt 0 ]; then
|
|||||||
elif [[ "$1" == "npm" ]]; then
|
elif [[ "$1" == "npm" ]]; then
|
||||||
shift 1
|
shift 1
|
||||||
npm $@
|
npm $@
|
||||||
cd electron
|
pushd electron || exit
|
||||||
npm $@
|
npm $@
|
||||||
cd ..
|
popd || exit
|
||||||
docker run --rm -it -v ${cur_path}/resources/mobile:/work -w /work --entrypoint=/bin/bash node:16 -c "npm $@"
|
docker run --rm -it -v ${cur_path}/resources/mobile:/work -w /work --entrypoint=/bin/bash node:16 -c "npm $@"
|
||||||
elif [[ "$1" == "doc" ]]; then
|
elif [[ "$1" == "doc" ]]; then
|
||||||
shift 1
|
shift 1
|
||||||
|
|||||||
@ -25,9 +25,10 @@ services:
|
|||||||
extnetwork:
|
extnetwork:
|
||||||
ipv4_address: "${APP_IPPR}.2"
|
ipv4_address: "${APP_IPPR}.2"
|
||||||
depends_on:
|
depends_on:
|
||||||
- mariadb
|
mariadb:
|
||||||
- redis
|
condition: service_healthy
|
||||||
- es
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
@ -42,20 +43,16 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
extnetwork:
|
extnetwork:
|
||||||
ipv4_address: "${APP_IPPR}.3"
|
ipv4_address: "${APP_IPPR}.3"
|
||||||
links:
|
|
||||||
- php
|
|
||||||
- office
|
|
||||||
- fileview
|
|
||||||
- drawio-webapp
|
|
||||||
- drawio-export
|
|
||||||
- minder
|
|
||||||
- okr
|
|
||||||
- ai
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
container_name: "dootask-redis-${APP_ID}"
|
container_name: "dootask-redis-${APP_ID}"
|
||||||
image: "redis:alpine"
|
image: "redis:alpine"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
networks:
|
networks:
|
||||||
extnetwork:
|
extnetwork:
|
||||||
ipv4_address: "${APP_IPPR}.4"
|
ipv4_address: "${APP_IPPR}.4"
|
||||||
@ -74,6 +71,11 @@ services:
|
|||||||
MYSQL_DATABASE: "${DB_DATABASE}"
|
MYSQL_DATABASE: "${DB_DATABASE}"
|
||||||
MYSQL_USER: "${DB_USERNAME}"
|
MYSQL_USER: "${DB_USERNAME}"
|
||||||
MYSQL_PASSWORD: "${DB_PASSWORD}"
|
MYSQL_PASSWORD: "${DB_PASSWORD}"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "${DB_USERNAME}", "-p${DB_PASSWORD}"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
networks:
|
networks:
|
||||||
extnetwork:
|
extnetwork:
|
||||||
ipv4_address: "${APP_IPPR}.5"
|
ipv4_address: "${APP_IPPR}.5"
|
||||||
@ -126,8 +128,6 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
extnetwork:
|
extnetwork:
|
||||||
ipv4_address: "${APP_IPPR}.8"
|
ipv4_address: "${APP_IPPR}.8"
|
||||||
depends_on:
|
|
||||||
- drawio-export
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
drawio-export:
|
drawio-export:
|
||||||
@ -164,8 +164,6 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
extnetwork:
|
extnetwork:
|
||||||
ipv4_address: "${APP_IPPR}.11"
|
ipv4_address: "${APP_IPPR}.11"
|
||||||
depends_on:
|
|
||||||
- mariadb
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
ai:
|
ai:
|
||||||
@ -178,8 +176,6 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
extnetwork:
|
extnetwork:
|
||||||
ipv4_address: "${APP_IPPR}.12"
|
ipv4_address: "${APP_IPPR}.12"
|
||||||
depends_on:
|
|
||||||
- redis
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
okr:
|
okr:
|
||||||
@ -187,7 +183,7 @@ services:
|
|||||||
image: "kuaifan/doookr:0.4.5"
|
image: "kuaifan/doookr:0.4.5"
|
||||||
environment:
|
environment:
|
||||||
TZ: "${TIMEZONE:-PRC}"
|
TZ: "${TIMEZONE:-PRC}"
|
||||||
DOO_TASK_URL: "http://${APP_IPPR}.3"
|
DOO_TASK_URL: "http://nginx"
|
||||||
MYSQL_HOST: "${DB_HOST}"
|
MYSQL_HOST: "${DB_HOST}"
|
||||||
MYSQL_PORT: "${DB_PORT}"
|
MYSQL_PORT: "${DB_PORT}"
|
||||||
MYSQL_DBNAME: "${DB_DATABASE}"
|
MYSQL_DBNAME: "${DB_DATABASE}"
|
||||||
@ -199,8 +195,6 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
extnetwork:
|
extnetwork:
|
||||||
ipv4_address: "${APP_IPPR}.13"
|
ipv4_address: "${APP_IPPR}.13"
|
||||||
depends_on:
|
|
||||||
- mariadb
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
face:
|
face:
|
||||||
@ -217,9 +211,7 @@ services:
|
|||||||
MYSQL_PASSWORD: "${DB_PASSWORD}"
|
MYSQL_PASSWORD: "${DB_PASSWORD}"
|
||||||
MYSQL_DB_NAME: "${DB_DATABASE}"
|
MYSQL_DB_NAME: "${DB_DATABASE}"
|
||||||
DB_PREFIX: "${DB_PREFIX}"
|
DB_PREFIX: "${DB_PREFIX}"
|
||||||
REPORT_API: "http://${APP_IPPR}.3:80/api/public/checkin/report"
|
REPORT_API: "http://nginx/api/public/checkin/report"
|
||||||
depends_on:
|
|
||||||
- mariadb
|
|
||||||
networks:
|
networks:
|
||||||
extnetwork:
|
extnetwork:
|
||||||
ipv4_address: "${APP_IPPR}.14"
|
ipv4_address: "${APP_IPPR}.14"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user