diff --git a/Dockerfile b/Dockerfile index d777d42..2837ccb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,7 +69,7 @@ RUN groupadd --system --gid 1000 rails && \ # Entrypoint pulls code, installs dependencies, and prepares the application ENTRYPOINT ["/rails/bin/docker-entrypoint"] -# Start server via Thruster by default, this can be overwritten at runtime -EXPOSE 80 -# 使用链接后的bin/rails路径,这样可以确保正确的环境变量和gem路径 -CMD ["/rails/code/bin/rails", "server"] +# Start server via Rails default port 3000 +EXPOSE 3000 +# 使用正确的路径启动Rails服务器,并指定端口为3000 +CMD ["/rails/code/bin/rails", "server", "-p", "3000", "-b", "0.0.0.0"] diff --git a/config/deploy.yml b/config/deploy.yml index ca7229e..efbb6d4 100644 --- a/config/deploy.yml +++ b/config/deploy.yml @@ -10,21 +10,36 @@ servers: hosts: - 45.78.59.154 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: # hosts: # - 192.168.0.1 # cmd: bin/jobs # 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. proxy: - # ssl: true - host: 45.78.59.154 - # If you have a domain name, use it instead of the IP address - # host: your-domain.com + # 启用SSL自动证书 + ssl: true + # 使用域名而不是IP地址 + 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. registry: @@ -115,7 +130,7 @@ asset_path: false # Deployment configuration for better reliability # 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 # drain_timeout: 60