Page MenuHomeDevCentral

Allow to use _default.conf for PaaS Docker nginx vhost
ClosedPublic

Authored by dereckson on Apr 2 2023, 13:11.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 12, 14:48
Unknown Object (File)
Tue, Nov 12, 08:27
Unknown Object (File)
Tue, Nov 12, 08:01
Unknown Object (File)
Tue, Nov 12, 05:52
Unknown Object (File)
Mon, Nov 11, 16:03
Unknown Object (File)
Mon, Nov 11, 09:31
Unknown Object (File)
Mon, Nov 11, 04:08
Unknown Object (File)
Sun, Nov 10, 14:29
Subscribers
None

Details

Summary

Current behavior
A _default.conf standard vhost is provided, but not directly useful
as it needs to be included to a specific <service>.conf file.

New behavior
This change detects if <service>.conf exists, and if not, fallback
to _default.conf, so services not needing a specific nginx configuration
can directly use the default one without any need to create a nginx file.

Test Plan
  • Deploy hound, check it's no-op
  • Deploy Penpot (D2597)

Diff Detail

Repository
rOPS Nasqueron Operations
Lint
Lint Passed
SeverityLocationCodeMessage
Advice_modules/paas_docker.py:102F821flake8 F821
Unit
No Test Coverage
Branch
docker-nginx-default
Build Status
Buildable 4684
Build 4964: arc lint + arc unit

Event Timeline

dereckson created this revision.

Works like a charm for Hound:

Complector
$ salt docker-002 state.sls_id /etc/nginx/vhosts/hound/hound.conf roles/paas-docker/nginx/config test=True
docker-002:
----------
          ID: /etc/nginx/vhosts/hound/hound.conf
    Function: file.managed
      Result: None
     Comment: The file /etc/nginx/vhosts/hound/hound.conf is set to be changed
              Note: No changes made, actual changes may
              be different due to other states.
     Started: 13:24:14.878532
    Duration: 60.22 ms
     Changes:
              ----------
              diff:
                  ---
                  +++
                  @@ -34,6 +34,7 @@

                       location / {
                           proxy_pass http://localhost:44080;
                  +
                           include includes/proxy_params;
                           proxy_redirect off;
                       }

Summary for docker-002
------------
Succeeded: 1 (unchanged=1, changed=1)
Failed:    0
------------
Total states run:     1
Total run time:  60.220 ms

It's well only there the default file is used:

Complector
$ salt docker-002 state.show_sls roles/paas-docker/nginx/config --out=yaml | grep -C 4 _default.conf
  /etc/nginx/vhosts/hound/hound.conf:
    __env__: base
    __sls__: roles/paas-docker/nginx/config
    file:
    - source: salt://roles/paas-docker/nginx/files/vhosts/_default.conf
    - mode: 644
    - makedirs: true
    - template: jinja
    - context:
This revision is now accepted and ready to land.Apr 2 2023, 13:25