Commit 5d1112df by Ivan

feat: update Traefik

parent 5d202282
...@@ -69,7 +69,7 @@ RUN groupadd --system --gid 1000 rails && \ ...@@ -69,7 +69,7 @@ RUN groupadd --system --gid 1000 rails && \
# Entrypoint pulls code, installs dependencies, and prepares the application # Entrypoint pulls code, installs dependencies, and prepares the application
ENTRYPOINT ["/rails/bin/docker-entrypoint"] ENTRYPOINT ["/rails/bin/docker-entrypoint"]
# Start server via Thruster by default, this can be overwritten at runtime # Start server via Rails default port 3000
EXPOSE 80 EXPOSE 3000
# 使用链接后的bin/rails路径,这样可以确保正确的环境变量和gem路径 # 使用正确的路径启动Rails服务器,并指定端口为3000
CMD ["/rails/code/bin/rails", "server"] CMD ["/rails/code/bin/rails", "server", "-p", "3000", "-b", "0.0.0.0"]
...@@ -10,21 +10,36 @@ servers: ...@@ -10,21 +10,36 @@ servers:
hosts: hosts:
- 45.78.59.154 - 45.78.59.154
labels: labels:
traefik.http.routers.app.rule: Host(`img-manager.mumumumushu.com`) # 使用域名隔离应用
traefik.http.routers.img_manager.rule: Host(`img-manager.mumumumushu.com`)
# 指定路由器名称,避免与其他应用冲突
traefik.http.routers.img_manager.entrypoints: websecure
# 启用TLS
traefik.http.routers.img_manager.tls: true
# 使用自定义端口而不是默认的80
traefik.http.services.img_manager.loadbalancer.server.port: 3000
# job: # job:
# hosts: # hosts:
# - 192.168.0.1 # - 192.168.0.1
# cmd: bin/jobs # cmd: bin/jobs
# Enable SSL auto certification via Let's Encrypt and allow for multiple apps on a single web server. # Enable SSL auto certification via Let's Encrypt and allow for multiple apps on a single web server.
# Remove this section when using multiple web servers and ensure you terminate SSL at your load balancer.
#
# Note: If using Cloudflare, set encryption mode in SSL/TLS setting to "Full" to enable CF-to-app encryption. # Note: If using Cloudflare, set encryption mode in SSL/TLS setting to "Full" to enable CF-to-app encryption.
proxy: proxy:
# ssl: true # 启用SSL自动证书
host: 45.78.59.154 ssl: true
# If you have a domain name, use it instead of the IP address # 使用域名而不是IP地址
# host: your-domain.com host: img-manager.mumumumushu.com
# 配置Traefik使用自定义端口
options:
# 定义多个入口点,包括非80端口
traefik.entryPoints.web.address: ":80"
traefik.entryPoints.websecure.address: ":443"
# 启用HTTP自动跳转到HTTPS
traefik.http.middlewares.redirect-to-https.redirectscheme.scheme: "https"
traefik.http.routers.redirs.rule: "hostregexp(`{host:.+}`)"
traefik.http.routers.redirs.entrypoints: "web"
traefik.http.routers.redirs.middlewares: "redirect-to-https"
# Credentials for your image host. # Credentials for your image host.
registry: registry:
...@@ -115,7 +130,7 @@ asset_path: false ...@@ -115,7 +130,7 @@ asset_path: false
# Deployment configuration for better reliability # Deployment configuration for better reliability
# Increase the time to wait for a container to become ready # Increase the time to wait for a container to become ready
deploy_timeout: 300 deploy_timeout: 60
# # Increase the time to wait for a container to drain # # Increase the time to wait for a container to drain
# drain_timeout: 60 # drain_timeout: 60
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment