Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pay
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
pay
Commits
cba5d6ac
Commit
cba5d6ac
authored
Jul 04, 2021
by
cuiweifeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update : add daemon config
parent
a963c378
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
147 additions
and
0 deletions
+147
-0
crontab-daemon.conf
deploy/crontab/crontab-daemon.conf
+1
-0
deploy-daemon-config.sh
deploy/deploy_configs/deploy-daemon-config.sh
+41
-0
assemble-daemon-config.sh
deploy/dockerfile/assemble-daemon-config.sh
+28
-0
logrotate-daemon.conf
deploy/logrotate/logrotate-daemon.conf
+8
-0
start_daemon.sh
deploy/start_env/start_daemon.sh
+69
-0
No files found.
deploy/crontab/crontab-daemon.conf
0 → 100644
View file @
cba5d6ac
59
23
* * * /
usr
/
sbin
/
logrotate
/
etc
/
logrotate
.
conf
deploy/deploy_configs/deploy-daemon-config.sh
0 → 100644
View file @
cba5d6ac
#!/usr/bin/env bash
# Start commands for each container, one cmd a line
START_CMDS
=
"
sysctl -w net.core.somaxconn=65535 && cd /home/services &&
${
start_cmd
}
"
QA_PRE_START_CMD
=
'
'
# Container names for each container, one name a line, same order with $start_cmds
CONTAINER_NAMES
=
"
bp-order-daemon-
${
env
}
-
${
task_name
}
"
# Port maps for each container, one map a line, same order with $start_cmds
DOCKER_PORT_MAPS
=
"
"
# This is for changing container name, remove old containers when deploy new one
OLD_CONTAINER_NAMES
=
"
bp-order-daemon-
${
env
}
-
${
task_name
}
"
# Volumn maps for each container, one map a line, same order with $start_cmds
DOCKER_VOLUMN_MAPS
=
"
/home/worker/_logs/bp-order-daemon-
${
env
}
-
${
task_name
}
:/home/services/api.go2yd.com/logs
"
# Other docker run options
DOCKER_RUN_OPTIONS
=
"--cap-add SYS_PTRACE --restart=always --privileged"
# Image name
IMAGE_NAME
=
"docker2.yidian.com:5000/publish/
${
COMMIT_JOB
}
-
${
COMMIT_NUMBER
}
-image"
# This is for stopping container, kill specify process inside the container before 'docker stop' and 'docker rm'
DOCKER_PRESTOP_CMD
=
''
# Service port for apitest
SERVICE_PORT
=
""
# Service port inside container
ORIGIN_SERVICE_PORT
=
""
# This service don't listen on any port
DONT_CHECK_PORT
=
"true"
deploy/dockerfile/assemble-daemon-config.sh
0 → 100644
View file @
cba5d6ac
#!/usr/bin/env bash
DIST_FILE_NAME
=
"*.tar.gz"
PROJECT_DIR
=
"api.go2yd.com"
START_SCRIPT
=
"./start_env/start_daemon.sh"
SYNC_DATA_OPERATIONS
=
"
tar zxf *.tar.gz -C start_env/api.go2yd.com/htdocs/Website
"
DEST_FILE_NAME
=
""
DEST_FILE_PATH
=
""
BASE_IMAGE
=
"docker2.yidian.com:5000/centos7/php72_without_nginx:20210621"
MAINTAINER
=
"cuiweifeng
\"
cuiweifeng@yidian-inc.com
\"
"
HOME_DIR
=
"/home/services"
LOG_DIRS
=
"
${
HOME_DIR
}
/
${
PROJECT_DIR
}
/logs
"
DATA_DIRS
=
"
"
deploy/logrotate/logrotate-daemon.conf
0 → 100644
View file @
cba5d6ac
/
home
/
services
/
api
.
go2yd
.
com
/
logs
/*.
log
{
daily
dateext
rotate
30
missingok
notifempty
create
666
root
root
}
deploy/start_env/start_daemon.sh
0 → 100644
View file @
cba5d6ac
# 运行环境env
if
[[
X
"
$1
"
==
X
""
]]
;
then
echo
"env cannot be empty"
exit
1
fi
# 任务名称
if
[[
X
"
$2
"
==
X
""
]]
;
then
echo
"task_name cannot be empty"
exit
1
fi
# 进程数
if
[[
X
"
$3
"
==
X
""
]]
;
then
echo
"worker number cannot be empty"
exit
1
fi
start_done_file
=
"/home/services/api.go2yd.com/logs/start_script.done"
rm
-f
${
start_done_file
}
environment
=
${
1
}
#php.ini要根据环境去修改
if
[[
X
"
${
environment
}
"
==
X
"prod"
||
X
"
${
environment
}
"
==
X
"prod_internal"
]]
;
then
sed
-i
"s#yaf.environ=dev#yaf.environ=prod#g"
ini/php.ini
elif
[[
X
"
${
environment
}
"
==
X
"perf"
||
X
"
${
environment
}
"
==
X
"perf_internal"
]]
;
then
sed
-i
"s#yaf.environ=dev#yaf.environ=perf#g"
ini/php.ini
elif
[[
X
"
${
environment
}
"
==
X
"test"
||
X
"
${
environment
}
"
==
X
"test_internal"
]]
;
then
sed
-i
"s#yaf.environ=dev#yaf.environ=test#g"
ini/php.ini
fi
\c
p
-f
ini/php.ini /etc/php.ini
rsyslogd
>
/dev/null 2>&1
#logrotate
cp
-f
/home/services/logrotate/logrotate-daemon.conf /etc/logrotate.d/order-daemon.conf
#crontab
nohup
/usr/sbin/crond
>
crond.nohup &
crontab /home/services/crontab/crontab-daemon.conf
# ls | grep -v 'tuiyitui.*\|ini\|recipe\|unify_start_script.sh' | xargs rm -rf
if
[[
-e
"/usr/share/zoneinfo/Asia/Shanghai"
]]
;
then
ln
-sf
/usr/share/zoneinfo/Asia/Shanghai /etc/localtime
fi
# fix dir permissions
chmod
-R
755 /home/services/api.go2yd.com/logs
sysctl
-w
net.core.somaxconn
=
65535
php api.go2yd.com/htdocs/Website/public/cli.php Daemon run
"t=
$2
&n=
$3
&j=
$2
"
while
true
;
do
is_master_on
=
$(
pgrep
-fc
"
$2
$1
master process"
)
if
[[
${
is_master_on
}
-gt
0
]]
;
then
if
[[
!
-f
"
$start_done_file
"
]]
;
then
touch
${
start_done_file
}
fi
sleep
10
continue
else
exit
1
fi
done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment