RhoConnect 3.2.0 - Deployment Issue/Question

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

Divyansh Madan
Did you comment the exception

Did you comment the exception in the query method?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


John Hadfield
Thanks for your response and

Thanks for your response and sorry for my slow reply - I've been away from work for a few days.

I've double checked and yes, it's definitely commented out.  The adapter itself (as simple as it is) seems to work without issue on my desktop pc, it's only when the adapter is copied to the Linux box that it fails.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Alexander Babichev
Have you installed on your RH

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.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


John Hadfield
Alexander - thank you too

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;

  }

}

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


John Hadfield
Okay so I've made progress

Okay so I've made progress and things seem to be working so far .

Thanks to Alexander Babichev for pointing me towards the /opt/nginx/conf/conf.d/rhoconnect.conf file.

I had to also modify the /etc/thin/rhoapp.yml file to change the chdir parameter to /var/www/rhoconnect.

I then also had to manually install a number of gems - finding each as I tried to start thin (in thin log). 

  • rack-test-0.6.1
  • rhomobile-debug-1.0.6
  • rspec-core-2.6.4
  • rspec-expectations-2.6.0
  • rspec-mocks-2.6.0
  • rspec-2.6.0

Process followed (for anyone who doesn't know) was:

1. On desktop PC set http_proxy and then install locally.  eg:

     gem install rspec -i repodir --no-rdoc --no-ri --version '=2.6.0'

2. scp the file to Linux box. eg:

     scp .\repodir\cache\rspec-2.6.0.gem user@host:/tmp/

3. On Linux box install the gem from the local file. eg:

     gem install --local /tmp/rspec-2*.gem

It would be better to get the README in line with the default configuration or enhance it to include more detail.  I chose the www path from it and I feel it helped cause some of my grief.

3) Setup rhoconnect application directory

    Put your application code in a directory called /var/www/rhoconnect

   (make sure this is the root of your application directory, i.e. /var/www/rhoconnect/config.ru should exist).

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Robin West
I gonna update README

I gonna update README generated by rhoconnect installer and make notes how to install and tweak user app in Linux production environment. Also I will update docs in deployment section on linux servers.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


John Hadfield
Nice one.Thanks again.John

Nice one.

Thanks again.

John

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments