Announcement

Collapse
No announcement yet.

Self-Hosted nginx server - upgrading MivaVM from 5.33 to 5.34

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Self-Hosted nginx server - upgrading MivaVM from 5.33 to 5.34

    I've been having trouble upgrading our self-hosted nginx/centOS7/FastCGI site from mivavm 5.33 to 5.34. I followed the same process that usually works for me when doing a vm update, but I'm getting the error "Configuration Error: Error loading configuration library: Unable to locate/load libmivaconfig.so: Please contact the server administrator: [email protected]"

    I also tried loading diagtool.mvc and a simple hello world mvc, and both give the same error. The libmivacofig.so file is copied from the 5.34 tar.gz file that I downloaded from Miva: https://www.miva.com/support/downloads

    My upgrade process is:
    1. get the CentOS 7 FastCGI file: https://www.miva.com/miva-software/e...os7_x64.tar.gz
    2. unpack in cgi-bin
    3. copy the new mivavm to cgi-bin (do not overwrite current file yet):
      • cp ./mivavm-v5.34/bin/mivavm_fastcgi-v5.34 ./mivavm-v5.34.vm
    4. copy the 3x.so file to cgi-bin as the new libmivaconfig.so (do not overwrite current file yet):
      • cp ./mivavm-v5.34/lib/config/3x.so ./libmivaconfig.so-v5.34
    5. make a copy of the current mivavm.conf file (we'll edit this copy so it reflects the new vm):
      • cp mivavm.conf mivavm.conf.v5.34
      • now edit mivavm.conf.v5.34 so all the references to 5.33 are changed to 5.34
    6. copy permissions from current files/folders to new ones:
      • chmod -R --reference=mivavm-v5.33 mivavm-v5.34
      • chmod --reference=mivavm mivavm-v5.34.vm
      • chmod --reference=./libmivaconfig.so ./libmivaconfig.so-v5.34
      • chmod --reference=./mivavm.conf ./mivavm.conf.v5.34
    7. backup all current files
    8. replace current files with new ones:
      • mv mivavm.conf.v5.34 mivavm.conf
      • mv libmivaconfig.so-v5.34 libmivaconfig.so
      • mv mivavm-v5.34.vm mivavm
    9. kill the current mivavm process and restart it:
      • sudo kill -9 $(pidof mivavm)
      • sudo /sbin/runuser -l content -c '/usr/bin/spawn-fcgi -p 8005 -n -- /var/www/sites/example.com/cgi-bin/mivavm &'
    I opened a ticket with Miva and they pointed out that I needed to add a couple of newer libraries to the 5.34 mivavm.conf, which I did, but I still have the same configuration error when trying to switch.

    FWIW, here is my old thread on getting this server set up a while ago, on engine 5.31 at the time: https://www.miva.com/forums/forum/on...iguration-file

    Anyone have any idea what the trouble might be?

    #2
    Your kill should come before the mv commands, as the files may be in-use when you try to rename the new versions into place.

    Is the mivavm binary and the libmivaconfig.so in the same directory? If not the same, MvCONFIG_LIBRARY must be set to define the location.
    David Hubbard
    CIO
    Miva
    [email protected]
    http://www.miva.com

    Comment


      #3
      Thanks, actually yea, I found out the hard way about the kill command yesterday after posting this thread. I did some more testing and encountered the problem you mentioned - the mivavm file was in use and the copy failed.

      Anyway, both mivavm and libmivaconfig.so are in the same folder (cgi-bin). Here's my mivavm.conf, I don't see anything mentioning MvCONFIG_LIBRARY:



      Code:
      mivaroot=/var/www/sites/example.com/html
      stdmodedatadir=/var/www/sites/example.com/mivadata
      
      openssl=/usr/lib64/libssl.so.1.0.2k
      openssl_crypto=/usr/lib64/libcrypto.so.1.0.2k
      
      cafile=/etc/ssl/certs/ca-bundle.crt
      
      builtindir=/var/www/sites/example.com/cgi-bin/mivavm-v5.34/lib/builtins
      
      securityoptions=15
      
      <DATABASE-LIB METHOD="MivaSQL" LIBRARY="/var/www/sites/example.com/cgi-bin/mivavm-v5.34/lib/databases/mivasql.so">
      <DATABASE-LIB METHOD="MySQL" LIBRARY="/var/www/sites/example.com/cgi-bin/mivavm-v5.34/lib/databases/mysql.so">
      
      <SYSTEM-LIB CODE="GD" LIBRARY="/usr/lib64/libgd.so.2">
      <SYSTEM-LIB CODE="BZ2" LIBRARY="/usr/lib64/libbz2.so.1">
      <SYSTEM-LIB CODE="MYSQLCLIENT" LIBRARY="/usr/lib64/libmysqlclient.so.18">
      
      globaltimeout=0
      Also, here's how the mvc configuration is set up in our nginx sites-available config:

      Code:
      location ~ \.mvc$ {
        fastcgi_read_timeout 300;
        fastcgi_pass www.example.com:8005;
        fastcgi_param MvCONFIG_LIBRARY /var/www/sites/www.example.com/cgi-bin/libmivaconfig.so;
        include fastcgi_params;
      }

      Comment


        #4
        I would expect this setup to work if the binary and shared library are in the same directory. However, in 5.34 we did change how the MvCONFIG_LIBRARY variable worked. You need to set it before you spawn the FastCGI process now instead of when handling the incoming request (as seen with your fastcgi_param definition).
        David Carver
        Miva, Inc. | Software Developer

        Comment


          #5
          hmm, well just for testing, how would I go about setting MvCONFIG_LIBRARY manually beforehand? Maybe I'll give that a shot, and comment out this line in nginx config:
          Code:
          fastcgi_param MvCONFIG_LIBRARY /var/www/sites/www.example.com/cgi-bin/libmivaconfig.so;

          Comment


            #6
            You could spawn a separate version of Empresa on a different port and have a unique web server config for a diagtool-holding directory, dev site, etc that points to the other running copy.
            David Hubbard
            CIO
            Miva
            [email protected]
            http://www.miva.com

            Comment


              #7
              You'd set it prior to running the FastCGI process.

              Code:
              export MvCONFIG_LIBRARY=/path/to/libmivaconfig.so
              sudo /sbin/runuser -l content -c '/usr/bin/spawn-fcgi -p 8005 -n -- /var/www/sites/example.com/cgi-bin/mivavm &'
              David Carver
              Miva, Inc. | Software Developer

              Comment


                #8
                ok I set up a separate mivavm running on a dev site so I can test at will. I got mivavm 5.33 running perfectly there on a different port / process. Then I killed mivavm, commented out the nginx config line that referenced the mv config library, exported the variable and re-ran mivavm. Unfortunately the result is the same though..

                Configuration Error: Error loading configuration library: Unable to locate/load libmivaconfig.so: Please contact the server administrator: [email protected]
                Here's the latest code:

                nginx config:
                Code:
                fastcgi_read_timeout 300;
                fastcgi_pass dev.example.com:8004;
                #fastcgi_param MvCONFIG_LIBRARY /var/www/sites/dev.example.com/cgi-bin/libmivaconfig.so;
                include fastcgi_params;
                linux commands:
                Code:
                export MvCONFIG_LIBRARY=/var/www/sites/dev.example.com/cgi-bin/libmivaconfig.so
                sudo /sbin/runuser -l content -c '/usr/bin/spawn-fcgi -p 8004 -n -- /var/www/sites/dev.example.com/cgi-bin/mivavm &'

                Comment


                  #9
                  Looking at the the runuser man page, you may want to pass the -m flag which will preserve the environment variables. Otherwise you may need to run something like
                  Code:
                  sudo /sbin/runuser -l content -c '
                  MvCONFIG_LIBRARY=/var/www/sites/dev.example.com/cgi-bin/libmivaconfig.so /usr/bin/spawn-fcgi -p 8004 -n -- /var/www/sites/dev.example.com/cgi-bin/mivavm &'
                  You could test this by running the original export command and then running
                  Code:
                  sudo /sbin/runuser -l content -c 'echo $MvCONFIG_LIBRARY'
                  and see if that path is still output. You could try that test command with the -m flag too to see if that flag works as expected.
                  David Carver
                  Miva, Inc. | Software Developer

                  Comment


                    #10
                    That did it, thank you!!

                    Running
                    Code:
                    sudo /sbin/runuser -l content -c 'echo $MvCONFIG_LIBRARY'
                    gave me blank output, so it looks like the variable was not being set. Adding -m to the runuser / spawn command gave me a message "runuser: ignore --preserve-environment, it's mutually exclusive to --login." and diagtool failed to load. Last, I tried your other suggestion, to define mvconfig library with the runuser / spawn command:

                    Code:
                    sudo /sbin/runuser -l content -c ' MvCONFIG_LIBRARY=/var/www/sites/dev.example.com/cgi-bin/libmivaconfig.so /usr/bin/spawn-fcgi -p 8004 -n -- /var/www/sites/dev.example.com/cgi-bin/mivavm &'
                    And that seems to have done it - diagtool.mvc is loading correctly and showing 5.34 as the engine. Thank you!

                    Comment

                    Working...
                    X