Nginx service checks for the string "(nginx-upload-progress-module)" in "nginx -V" output, but my output doesn't contain it. I suppose it's because barracuda/octopus setup uses special configure parameters.
We can't use it - this is supposed to work for everyone and not just barracuda/octopus users.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

crea’s picture

I'm testing a patch that tests upload progress capability using sample config.

crea’s picture

Status: Active » Needs review
FileSize
1.49 KB

For some reason this still doesn't work...have no idea why

crea’s picture

Looks like save_server() doesn't run at all, even if I save server node. Is it by design ? Seems strange...So I must manually run "drush provision-save blahblah" from the command line.
If "save" works only from command line, wouldn't it be more logical to test server capabilities during verify ? It's confusing

crea’s picture

Nevermind. The alias file seems to be updated (last modified time changes) but it has "'nginx_has_upload_progress' => 0" anyway

crea’s picture

I tried "$this->server->nginx_has_upload_progress = 1;" in save_server() and it still doesn't work. In the alias file it's 0

crea’s picture

I found the root of the problem: when I was upgrading provision, I left backup of the old provision directory. It was involved.
Ok, that means the patch is almost ready...

crea’s picture

I've changed logic to check for presence of "syntax is correct" line in the output rather than absence of "unknown directive" error cause absence of the error doesn't mean the syntax check passed.

I've also found bug with nginx execution: we can't assume it's in PATH for aegir user so we must provide full path. I've added some primitive path detection - I suppose there's a way to fail gracefully if full path is unknown in the end.

crea’s picture

Forgot the conf file in the last version of patch.

crea’s picture

Title: Nginx uploadprogress detection is not reliable » Nginx capabilities detection is not reliable
memtkmcc’s picture

Status: Needs review » Needs work

I'm aware of this, but I stopped to work on a fix because of this issue #962188: Nginx version check works for server.tpl.php but doesn't work for/in vhost.tpl.php since even if all tests results are correct and stored in server_master.alias.drushrc.php as bellow:

  'nginx_has_gzip' => 1,
  'nginx_has_upload_progress' => 1,

you still can't use them in vhost.tpl.php for some unknown reason (at least I have no idea yet why it doesn't work) so it will use nginx_simple_include.conf, no matter what. It will work only in server.tpl.php, which is not enough.

Correct me if I'm wrong.

crea’s picture

Yes these issues are connected. Actually I'm troubleshooting #962188: Nginx version check works for server.tpl.php but doesn't work for/in vhost.tpl.php too

crea’s picture

Added ->status() call after exists(). Changed path checks order so /usr/local takes precedence over /usr as it usually works.

omega8cc’s picture

Status: Needs work » Reviewed & tested by the community

I believe it is fine now, after you fixed the issue #962188: Nginx version check works for server.tpl.php but doesn't work for/in vhost.tpl.php.

Thanks again.

anarcat’s picture

Status: Reviewed & tested by the community » Needs work
+++ http/nginx/nginx_service.incundefined
@@ -18,13 +18,28 @@ class provisionService_http_nginx extends provisionService_http_public {
+      return;

do we invariably want to fail if we don't find it here? and is "return" a proper way to fail? I feel an error should be raised with drush_set_error() here....

+++ http/nginx/nginx_service.incundefined
@@ -18,13 +18,28 @@ class provisionService_http_nginx extends provisionService_http_public {
+    }
+    ¶
     // Check if some nginx features are supported and save them for later.

again extra whitespace here, and below...

+++ http/nginx/nginx_service.incundefined
@@ -18,13 +18,28 @@ class provisionService_http_nginx extends provisionService_http_public {
-    $this->server->nginx_has_upload_progress = preg_match("/(nginx-upload-progress-module)/", implode('', drush_shell_exec_output()), $match);
     $this->server->nginx_has_new_version = preg_match("/(Barracuda\/0\.9\.)/", implode('', drush_shell_exec_output()), $match);
     $this->server->provision_db_cloaking = FALSE;
     $this->server->nginx_web_server = 1;
+    ¶
+    // Check upload progress capability. Because configure parameters may vary,
+    // test sample config.
+    $this->server->shell_exec($path . ' -t -c ' . dirname(__FILE__) . '/upload_progress_test.conf');
+    $this->server->nginx_has_upload_progress = preg_match("/upload_progress_test\.conf syntax is ok/", implode('', drush_shell_exec_output()), $match);

i don't understand why this is better than checking the actual output here... We're assuming the configuration for the upload_progress module is going to be a certain name, why not detect the right module directly?

is there *anything* in your output that says the module is configured?

Powered by Dreditor.

crea’s picture

i don't understand why this is better than checking the actual output here

It is because the output is not reliable. Since this is a third-party module, it's not present in "--with-http_stub_status_module" way but in "--add-module=path_to_module" one, with module path being random. We can't assume that module path contains any keywords.
I don't know of any other way to detect the module.

omega8cc’s picture

That is (almost) correct, because in fact current regex checks for module *name* (and not any arbitral path), which is nginx-upload-progress-module, unless you renamed it - see the original here: https://github.com/masterzen/nginx-upload-progress-module

But I agree that it is better to use the config check trick instead of relying on module name regex, because it is too easy to have the module name/directory renamed on git clone, etc.

omega8cc’s picture

Version: 6.x-1.1 » 6.x-1.x-dev
Status: Needs work » Fixed

We no longer use any extra file, because it caused already too many issues for too many people, on upgrades, for remote heads etc. We check the output for "upload" keyword, which should be enough unique to make sure it is an upload progress module compiled in. If you are using some unrelated name for module with official name "nginx-upload-progress-module", then it is a FAQ/docs candidate and we should be able to assume that "upload" keyword is present, like we assume that you didn't rename "nginx" to something else.

Changes committed to 6.x-1.x and 6.x-2.x:

http://drupalcode.org/project/provision.git/commit/009294bca51396c890423...
http://drupalcode.org/project/provision.git/commit/569d5489b7e40bb55981d...

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.