Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
img-manager
Project
Overview
Details
Activity
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
Ivan Lan
img-manager
Commits
2b4a3ca3
Commit
2b4a3ca3
authored
Mar 11, 2025
by
Ivan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix; healthy check
parent
5d1112df
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
8 deletions
+38
-8
Dockerfile
Dockerfile
+6
-0
docker-entrypoint
bin/docker-entrypoint
+15
-0
deploy.yml
config/deploy.yml
+17
-8
No files found.
Dockerfile
View file @
2b4a3ca3
...
@@ -23,6 +23,7 @@ RUN apt-get update -qq && \
...
@@ -23,6 +23,7 @@ RUN apt-get update -qq && \
git
\
git
\
build-essential
\
build-essential
\
pkg-config
\
pkg-config
\
ca-certificates
\
&&
rm
-rf
/var/lib/apt/lists /var/cache/apt/archives
&&
rm
-rf
/var/lib/apt/lists /var/cache/apt/archives
# Set production environment and optimize memory usage
# Set production environment and optimize memory usage
...
@@ -71,5 +72,10 @@ ENTRYPOINT ["/rails/bin/docker-entrypoint"]
...
@@ -71,5 +72,10 @@ ENTRYPOINT ["/rails/bin/docker-entrypoint"]
# Start server via Rails default port 3000
# Start server via Rails default port 3000
EXPOSE
3000
EXPOSE
3000
# 添加健康检查,使用简单的curl请求检查应用是否响应
HEALTHCHECK
--interval=5s --timeout=3s --start-period=30s --retries=3 \
CMD curl -f http://localhost:3000/ || exit 1
# 使用正确的路径启动Rails服务器,并指定端口为3000
# 使用正确的路径启动Rails服务器,并指定端口为3000
CMD
["/rails/code/bin/rails", "server", "-p", "3000", "-b", "0.0.0.0"]
CMD
["/rails/code/bin/rails", "server", "-p", "3000", "-b", "0.0.0.0"]
bin/docker-entrypoint
View file @
2b4a3ca3
...
@@ -274,6 +274,21 @@ if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
...
@@ -274,6 +274,21 @@ if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
echo
"No package.json found in /rails, skipping npm install"
echo
"No package.json found in /rails, skipping npm install"
fi
fi
# 添加健康检查相关的调试信息
echo
"Setting up health check monitoring..."
# 创建一个后台进程来监控应用的健康状态
(
while
true
;
do
echo
"[Health Check] Checking application status..."
if
curl
-s
http://localhost:3000/
>
/dev/null 2>&1
;
then
echo
"[Health Check] Application is responding!"
else
echo
"[Health Check] Application is not responding yet."
fi
sleep
10
done
)
&
# Prepare database files with proper permissions
# Prepare database files with proper permissions
echo
"Ensuring database files exist with proper permissions..."
echo
"Ensuring database files exist with proper permissions..."
...
...
config/deploy.yml
View file @
2b4a3ca3
...
@@ -129,14 +129,23 @@ volumes:
...
@@ -129,14 +129,23 @@ volumes:
asset_path
:
false
asset_path
:
false
# Deployment configuration for better reliability
# Deployment configuration for better reliability
# Increase the time to wait for a container to become ready
# 增加部署超时时间,给应用更多时间启动
deploy_timeout
:
60
deploy_timeout
:
180
# # Increase the time to wait for a container to drain
# 增加容器排水超时时间
# drain_timeout: 60
drain_timeout
:
60
# # Increase the time to wait for a container to boot after it is running
# 增加容器启动后的就绪延迟
# readiness_delay: 30
readiness_delay
:
30
# 配置健康检查参数
health_check
:
# 健康检查超时时间
timeout
:
5
# 健康检查间隔
interval
:
5
# 健康检查重试次数
retries
:
12
# Note: Run the setup script manually before deployment:
# Note: Run the setup script manually before deployment:
# scp ./bin/setup_volumes.sh root@45.78.59.154:/root/setup_volumes.sh
# scp ./bin/setup_volumes.sh root@45.78.59.154:/root/setup_volumes.sh
...
...
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