docksal / service-vhost-proxy

Virtual host proxy service image for Docksal
http://docksal.io
MIT License
7 stars 14 forks source link

A single bad project can break vhost-proxy configuration #61

Closed lmakarov closed 4 years ago

lmakarov commented 4 years ago

A single bad project can break the nginx configuration and thus resulting in either q locked vhost-proxy config (if a valid config is already running) or a broken config (if vhost-proxy is started fresh/reset).

We need to adjust the config template to prevent such issues.

Details

$ fin docker logs docksal-vhost-proxy
...
2020/02/05 18:58:52 Error running notify command: proxyctl notify, exit status 1
2020/02/05 18:58:52 [proxyctl notify]: 2020/02/05 18:58:52 [emerg] 1060#1060: no servers are inside upstream in /etc/nginx/conf.d/vhosts.conf:224
2020/02/05 18:58:52 [proxyctl notify]: nginx: [emerg] no servers are inside upstream in /etc/nginx/conf.d/vhosts.conf:224
2020/02/05 18:58:52 [proxyctl notify]: nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed
...
$ fin docker exec docksal-vhost-proxy cat /etc/nginx/conf.d/vhosts.conf
...
# -------------------------------------------------- #
# Reachable via "project-website-feature-w20-105_default" network
upstream project-website-feature-w20-105-cli {
}
## HTTPS
server {
    listen 80;
    listen 443 ssl http2;
    server_name cli-feature-w20-105-fmybyt--project-website.sandbox.web.dev.organization.com;
    ssl_certificate /etc/certs/custom/sandbox.web.dev.organization.com.crt;
    ssl_certificate_key /etc/certs/custom/sandbox.web.dev.organization.com.key;
    ssl_session_cache builtin:1000 shared:SSL:10m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;
    location / {
        proxy_pass http://project-website-feature-w20-105-cli;
    }
}
# -------------------------------------------------- #
...
$ fin pl -a | grep feature-w20-105
project-website-feature-w20-105                  Created                     cms-feature-w20-105-fmybyt--project-website.sandbox.web.dev.organization.com     /home/build-agent/builds/project-website-feature-w20-105

$ fin @project-website-feature-w20-105 ps
                  Name                                Command                  State                 Ports
---------------------------------------------------------------------------------------------------------------------
project-website-feature-w20-105_api_1        /opt/startup.sh bash -lc npm     Exit 0
project-website-feature-w20-105_cli_1        /opt/startup.sh supervisord      Up (healthy)   22/tcp, 3000/tcp, 9000/tcp
project-website-feature-w20-105_db_1         docker-entrypoint.sh mysqld      Exit 0
project-website-feature-w20-105_frontend_1   httpd-foreground                 Exit 0
project-website-feature-w20-105_preview_1    /opt/startup.sh bash -lc n ...   Exit 0
project-website-feature-w20-105_web_1        httpd-foreground                 Exit 0