galaxyproject / cloudman

Easily create and manage compute clusters on any Cloud.
https://galaxyproject.org/cloudman/
37 stars 23 forks source link

More direct method for locating the Nginx configuration directory #34

Closed MatthewRalston closed 8 years ago

MatthewRalston commented 9 years ago

In the CentOS, Nginx configuration is not located in /etc/nginx. A more direct solution is provided. Running the test command twice is required for the purpose of the exit status for the run command. For example:

>/usr/bin/foo bar
-bash: /usr/bin/foo: No such file or directory
>echo $?
127
>/usr/bin/foo bar 2>&1
-bash: /usr/bin/foo: No such file or directory
>echo $?
0
>/usr/bin/foo bar && /usr/bin/foo bar 2>&1 | head -n1 | cut -d' ' -f5
-bash: /usr/bin/foo: No such file or directory
>echo $?
127

Working command in shell:

>test=$(/usr/nginx/sbin/nginx -t && /usr/nginx/sbin/nginx -t 2>&1 | head -n1 | cut -d' ' -f5)
nginx: the configuration file /usr/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/nginx/conf/nginx.conf test is successful
>echo $?
0
>echo $test
/usr/nginx/conf/nginx.conf
afgane commented 9 years ago

So I finally got to testing this and it turns out there's a typo on the current image in nginx.conf (see 8cef34a2942528dfbf8d9e62ac62602379bee9f6). This hasn't been discovered thus far because nginx.conf gets rewritten as CloudMan starts up. However, with this modification, nginx -t command is run before the file is rewritten and it consequently fails, resulting in nginx never starting up. I built a new image with this fixed but the way CloudLaunch works, starting clusters that were based on the old image and have been shut down will complicate the launch process for users (i.e., they're have explicitly select the older image). Yet, there's no real change in the behavior of the system. So I'm a bit unclear on how best to handle this to minimize disruption... Hence, leaving this open for the time being.

afgane commented 8 years ago

I tried a this out a few times now and it seems be ok with a newly built AMI so will merge it in and keep an eye on it.