Closed jonpugh closed 8 years ago
After poking around using "sed" to alter the NGINX config file at RUNtime, I am unable to make it work.
I'm starting to think we should just map the volume at /source
and then create a symlink from /source/$DOCROOT
to /usr/share/nginx/html
This would be a simpler solution i the end...
Found a blog post where they discovered you can use the variables directly in the conf file if you have certain NGINX modules installed.
https://docs.apitools.com/blog/2014/07/02/using-environment-variables-in-nginx-conf.html
Unfortunately it seems we would have to compile NGINX ourselves...
Going to look more into it.
I would prefer the sed approach for a simple reason: in the future, terra should not be dictating the source code layout of the developer's project. If we use the sed approach, then the door is open to allowing developers using terra with various source code directory layouts. How do you feel about that?
That's the goal either way.
It works now by mapping a volume to whatever the "document_root" is set to in your app's .terra.yml
. The problem is that there might be code above the document_root in the source code repo that is needed, which is not available inside the container.
The path to web code will be set as an environment variable per project, so we just need to figure out a way to get that environment variable into the server:location section of the nginx config.
Ahh symlinks!
To solve this I:
/var/www
(/usr/share/nginx/html was unable to be removed. not sure why)/app
in the container./app/$DOCUMENT_ROOT
and it works!
We can't host symfony apps right now that require files outside of the docroot.
Symfony normally uses a "web" docroot and puts minimal files in there, like https://github.com/jonpugh/aegir4/tree/master/web
The problem with this is that those files in web need to load code from the directory above.
Currently terra maps only the docroot directory to the container volume.
The other problem is that we can't dynamically change the NGINX file path from
/usr/share/nginx//html
.This needs to change.