VVV
VVV copied to clipboard
Default Nginx config, #2279
Should fix https://github.com/Varying-Vagrant-Vagrants/VVV/issues/2279
Checks
- [ ] I've updated the changelog.
- [ ] I've tested this PR
- [x] This PR is for the
developbranch not thestablebranch. - [ ] This PR is complete and ready for review.
Thanks for opening this pull request! Make sure CHANGELOG.md gets updated with this change, additionally any docs that need updated can be found at https://github.com/Varying-Vagrant-Vagrants/varyingvagrantvagrants.org
GitHub
The VVV docs and website. Contribute to Varying-Vagrant-Vagrants/varyingvagrantvagrants.org development by creating an account on GitHub.
@Mte90 is some of it missing? I see it reverted a portion in the last commit
@Mte90 is some of it missing? I see it reverted a portion in the last commit
I changed the if as you suggested.
@Mte90 vvv_provision_site_nginx_config still needs calling with the fallback config in the other function
I misunderstood your request, now should be right (I hope).
I think this needs the main develop branch merging into it so that the CI actions pass
Seems that GitHub doesn't find any conflicts.
@Mte90 more so that it pulls in fixes in develop for CI so that it can pass
@Mte90 can you resolve the conflicts and update this for the latest develop branch?
Conflicts fixed.
@Mte90 I tested this PR and ran into a failed provision with Nginx configs failing due to syntax errors:
vagrant@vvv:~$ sudo nginx -t
nginx: [emerg] directive "server_name" is not terminated by ";" in /etc/nginx/custom-sites/fallback.conf:4
nginx: configuration file /etc/nginx/nginx.conf test failed
vagrant@vvv:~$
fallback.conf should not have been included based on my understanding, it's just a template that's used to generate the sites actual Nginx config if the site provides no config of its own ( either because there is no provisioner or none was provided ).
To test this I did these steps:
- I created a
www/wordpress-three/public_htmlfolder and put anindex.phpinside it with a generic "It works!" type message - I then added a
wordpress-threesite toconfig.ymlthat did not have arepoparameter, so no site provisioner was present - I then reprovisioned with
vagrant up --provision
I suspect part of the problem is the location of the fallback config is in a place where it's automatically included, which is not how it should work. fallback.conf is a template file, much like how we have template files in the site provisioner.
I moved the file one folder up so it wasn't copied into place, and renamed it to site-fallback.conf, adjusted provision-site.sh accordingly, and re-ran the provision, and got this:
==> default: Running provisioner: site-wordpress-three (shell)...
default: Running: /var/folders/dw/wdtnsdn154db04ymxv90t9tm0000gn/T/vagrant-shell20221113-84039-12bycqx.sh
default: ▷ Running the 'site-wordpress-three' provisioner...
default: * The site: 'wordpress-three' does not have a site template, assuming custom provision/vvv-init.sh and provision/vvv-nginx.conf
default: * Warning: A site provisioner was not found at .vvv/vvv-init.sh provision/vvv-init.sh or vvv-init.sh, searching 3 folders down, please be patient...
default: * Warning: No site provisioner was found, VVV could not perform any scripted setup that might install software for this site
default: ! Warning: An nginx config was not found!! VVV needs an Nginx config for the site or it will not know how to serve it.
default: * VVV searched for an Nginx config in these locations:
default: - /srv/www/wordpress-three/.vvv/vvv-nginx.conf
default: - /srv/www/wordpress-three/provision/vvv-nginx.conf
default: - /srv/www/wordpress-three/vvv-nginx.conf
default: * VVV will search 3 folders down to find an Nginx config, please be patient...
default: ! Error: No nginx config was found, VVV will not know how to serve this site
default: ! The 'site-wordpress-three' provisioner ran into problems, the full log is available at '/var/log/provisioners/2022.11.13_16-28-19/provisioner-site-wordpress-three.log'. It completed in 0 seconds.
Pushed up fixes