7 Replies Latest reply on Jun 20, 2012 2:46 AM by 25c49980-cb2e-4113-a5a7-2f0078c85330

    RhoConnect 3.2.0 - Deployment Issue/Question

    25c49980-cb2e-4113-a5a7-2f0078c85330

      Folks,

       

      We're looking at a first proof of concept install of RhoConnect under a Red Hat Enterprise Linux environment.

       

      I'm having an issue whereby I'm getting a an error message when trying to sync a demo rhomobile app to a demo rhoconnect application.

       

      The RhoConnect application was created by :

       

      1.  File, New, Project - RhoConnect application

      2.  Adding a source adapter via the Right-Click, New, RhoConnect Source adapter called "attr_dom_values"

      3.  Edit the source adapter attr_dom_values.rb to change the query method to:

       

      @result = {

             "1"=>{"domain"=>"test", "low_value"=>"A", "short_desc"=>"A", "full_desc"=>"Ay", "display_order"=>"1", "parent_domain"=>"", "parent_low_value"=>"", "default_value"=>"" },

             "2"=>{"domain"=>"test", "low_value"=>"B", "short_desc"=>"B", "full_desc"=>"Bee", "display_order"=>"2", "parent_domain"=>"", "parent_low_value"=>"", "default_value"=>"" }

           }

       

      4. Sftp the files and folders to the Linux box under /var/www/rhoconnect.

       

       

      The RhoMobile application was created by :

       

      1.  File, New, Project - RhoMobile application

      2.  Adding a source adapter via the Right-Click, New, RhoMobile model called "attr_dom_values" with fields:

           domain,test,low_value,short_desc,full_desc,display_order,parent_domain,parent_low_value,default_value

      3.  Edit the rhoconfig.txt to specify the syncserver  - syncserver = 'http://??.??.??.??/application'

      4. Edit attr_dom_values.rb to uncomment the enable: sync line

       

      Running the rhoconnect server on the PC and the client in the simulator works as expected - log in and synch to retrieve the dummy rows.

       

      Running against the copied version on the Linux server fails synch with :

       

      [08:32:13 AM 2012-06-13] Failure to create adapter from class AttrDomValues: #<Exception: Please provide a :token or set it in uri>

      [08:32:13 AM 2012-06-13] Please provide a :token or set it in uri/opt/rhoconnect/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/lib/rhoconnect/dynamic_adapter.rb:23:in `initialize'

       

      The log in works and the rhoconnect console shows the user and the model (without data).

       

      I'd be grateful if anyone could help out a novice and set me straight!  I've looked in the online forums and this error seems to be more common with the rails server plugin, or suggested a clean install - as this was already a clean install it's something I hope there's a better answer for.

       

      I've included below a list of the changes I made to the configuration, in case that helps shed any light on things.

       

      Thanks

       

      John

       

       

      Steps to change the configuration to run as a user other than root.

       

      1. Create a rhoconnect user

       

                sudo useradd -r -s /bin/bash -d /opt/rhoconnect/home rhoconnect

       

                mkdir /opt/rhoconnect/home

                chown rhoconnect:rhoconnect /opt/rhoconnect/home

                chmod go-rwx /opt/rhoconnect/home

       

      2. Create directories for REDIS pid and log files

       

                mkdir /var/run/redis /var/log/redis

                chmod 750 /var/log/redis

                chown rhoconnect /var/run/redis /var/log/redis

       

      Edit /opt/rhoconnect/etc/redis.conf to set:

       

                pidfile /var/run/redis/redis.pid

                logfile /var/log/redis/redis.log

       

      3. Make REDIS start as rhoconnect user

       

      Edit /etc/init.d/redis

       

      Comment out user="${user:-root}"

      Uncomment #user="${user:-redis}"

      Change to user="${user:-rhoconnect}"

         

      4. Make THIN start aws rhoconnect

       

        Edit  /etc/thin/rhoapp.yml

        Add :

        user: rhoconnect

        group: rhoconnect

       

      5. Create a home for our rhoconnect application

       

      mkdir /var/www/rhoconnect

      chown rhoconnect:rhoconnect /var/www/rhoconnect

      chmod o-rx /var/www/rhoconnect

        • Re: RhoConnect 3.2.0 - Deployment Issue/Question

          Did you comment the exception in the query method?

          • Re: RhoConnect 3.2.0 - Deployment Issue/Question

            Have you installed on your RH box RhoConnect software by running rhoconnect rpm package?

            http://edgedocs.rhomobile.com/rhoconnect/deploying#deploying-packaged-rhoconnect-software-on-linux-servers

             

            In that case,  I can assume you have ruby, redis, nginx, and rhoconnect gems. Can you run example application, installed in /opt/nginx/html/rhoapp?

            To run your app, you should move it to /opt/nginx/html directory and edit /opt/nginx/conf/conf.d/rhoconnect.conf file.

            Replace root directive to point out to 'public' folder of your application.

              • Re: RhoConnect 3.2.0 - Deployment Issue/Question
                25c49980-cb2e-4113-a5a7-2f0078c85330

                Alexander - thank you too (and same apologies for the delay in my reply).

                 

                I believe we did install from the package, but not via yumming in the normal way.  Like many enterprises, our servers are cannot reach out to the internet and so yumming and gem installing are pretty useless in their natural form.

                 

                I hadn't edited the /opt/nginx/conf/conf.d/rhoconnect.conf file to point to the public folder, but have now, stopped and started thin and nginx but get the same error.

                 

                I'm going to shuffle things around and get the demo application in there and see what I can do with that - I'll update when I have.

                 

                I've included some 'evidence' below which may help you cure my idiocy.

                 

                Thanks again

                 

                John

                 

                [root@RhoConnect1 rhoconnect]# pwd

                /var/www/rhoconnect

                [root@RhoConnect1 rhoconnect]# ls -l

                total 36

                -rw-r--r-- 1 rhoconnect rhoconnect 1234 Jun 12 09:11 application.rb

                -rw-r--r-- 1 rhoconnect rhoconnect 1314 Jun 12 09:11 config.ru

                -rw-r--r-- 1 rhoconnect rhoconnect 1043 Jun 12 09:11 Gemfile

                -rw-r--r-- 1 rhoconnect rhoconnect 2253 Jun 12 11:03 Gemfile.lock

                drwxr-xr-x 2 rhoconnect rhoconnect 4096 Jun 13 07:28 public

                -rw-r--r-- 1 rhoconnect rhoconnect  177 Jun 12 09:11 Rakefile

                drwxr-xr-x 2 rhoconnect rhoconnect 4096 Jun 13 10:24 settings

                drwxr-xr-x 2 rhoconnect rhoconnect 4096 Jun 13 07:28 sources

                drwxr-xr-x 3 rhoconnect rhoconnect 4096 Jun 13 07:28 spec

                 

                [root@RhoConnect1 www]# cat /opt/nginx/conf/conf.d/rhoconnect.conf

                upstream thin_cluster {

                  ip_hash;

                  server unix:/tmp/thin.0.sock;

                  server unix:/tmp/thin.1.sock;

                #  server unix:/tmp/thin.2.sock;

                #  server unix:/tmp/thin.3.sock;

                }

                 

                 

                server {

                  listen      80;

                  root  /var/www/rhoconnect/public; # <-- be sure to point to 'public' folder of your application!

                  # root  /opt/nginx/html/rhoapp/public; # <-- be sure to point to 'public' folder of your application!

                  #  access_log off;                           # <-- disable access logging

                  #  error_log /dev/null crit;                 # <-- disable error logging, but critical errors only

                 

                 

                  location / {

                    proxy_set_header X-Real-IP $remote_addr;

                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

                    proxy_set_header Host $http_host;

                    proxy_redirect off;

                 

                 

                    proxy_pass http://thin_cluster;

                  }

                 

                 

                  error_page 500 502 503 504 /50x.html;

                  location = /50x.html {

                    root html;

                  }

                }