17 Replies Latest reply on Oct 17, 2012 1:25 PM by Lars Burgess

    How to build a demo system for syncing using Plugins?

    Rafal Firlejczyk

      I am building a small syncing system as a demo. It consist of:

      1. Rho-Aplication runing on the device - ex. list of product, invetory, etc.

      2. Rhoconnect server  runing locally on my PC on port 9292

      3. Back-end server runing rails server locally on port 3000.

       

       

      The syncing should be done using Rhoconnect server and plugins on the rails server side (without source adapter).

      I followed the webinar on the same subject.

      All three elements separately are working but syncing does not.

      Could you please send me the instruction and code for this simple syncing example

      thanks

      Rafal

        • Re: How to build a demo system for syncing using Plugins?

          I have the same environment and problem.

          RhoConnect adapter sends only "/rhoconnect/authenticate" request to Rails app. I have query and other actions fired on RhoConnect side but don't see it's relevant request at Rails app log. I think there should be "/rhoconnect/query" sent by dynamic adapter.

          I'm doing everything that need to be done that is specified in documentation.

          I figured out that you have to specify :api_token: at settings.yml (which is actually not described in documentation).

          I'd also appreciate debugging ideas as I'm kinda stuck with this.

          • Re: How to build a demo system for syncing using Plugins?

            Here's the steps I go through:

             

            1. Clone the three repos:
            2. Start the rhoconnect app eventtracker-rhoconnect with a specific token:
              • cd eventtracker-rhoconnect
              • bundle install
              • rhoconnect redis-start
              • API_TOKEN=secrettoken rhoconnect start
            3. Start the rails app with the same token:
              • cd eventtracker
              • bundle install
              • RHOCONNECT_URL=http://secrettoken@localhost:9292 rails s
              • Open http://localhost:9292 and check the backend app url, it should be set to "http://localhost:3000".  If not then the token is not correct.
              • Note that you can also put the config.uri in the rhoconnect.rb rails initializer, I just do it this way so the same codebase can be deployed easily elsewhere like heroku.
            4. Start the mobile app:
              • Setup rhodes if you haven't already (comes with RhoMobileSuite)
              • cd eventtracker-client
              • rake run:iphone
              • Login and sync
            5. Try adding a record to the rails app, when you sync again in the iphone simulator you should see the new record.
            1 of 1 people found this helpful
              • Re: How to build a demo system for syncing using Plugins?
                Rafal Firlejczyk

                I was trying to follow your steps.

                 

                1. I copied all three repositories from your github into project  folders
                2. and started according to your points
                • cd eventtracker-rhoconnect   - OK
                • bundle install - OK
                • rhoconnect redis-start - Probably NOT-OK.

                          In the command line I have:


                          C:\Users\BRM738\workspace\eventtracker-rhoconnect>rhoconnect redis_start

                          Starting redis in a new window...


                          but No new window is popping up and probably redis is not starting.

                • API_TOKEN=secrettoken rhoconnect start - In not working.

                          In Command line I have:


                          C:\Users\BRM738\workspace\eventtracker-rhoconnect>API_TOKEN=secrettoken rhoconnect start

                          'API_TOKEN' is not recognized as an internal or external command,

                          operable program or batch file.


                     3. Start the rails app with the same token:

                  • cd eventtracker - OK
                  • bundle install - NOT-OK Eventmachine not installed. CM line:

                 

                              Installing eventmachine (0.12.10) with native extensions

                              Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

                 

                               I am attaching the log file (gem_make.out) for investigation

                 

                • RHOCONNECT_URL=http://secrettoken@localhost:9292 rails s - NOT Working
                  • Open http://localhost:9292 and check the backend app url, it should be set to "http://localhost:3000".  If not then the token is not correct. - the filed is empty
                  • Note that you can also put the config.uri in the rhoconnect.rb rails initializer, I just do it this way so the same codebase can be deployed easily elsewhere like heroku.

                 

                     4. Client Application is working.

                 

                ===============================================

                I tried as well to run the old rake commands instead. Rake was trying to start redis version 2.4.10 from the c:\redis-2.4.10  folder which is not existing. Rhomobilesuite itself is installing redis 2.4.0 (not 2.4.10) in the folder C:/MotorolaRhoMobileSuite2.1.1.7/redis-2.4.0. I found however the config file (redis.rake) located in Rhosuite :


                C:\MotorolaRhoMobileSuite2.1.1.7\ruby\lib\ruby\gems\1.9.1\gems\rhoconnect-3.3.6\tasks\redis.rake

                 

                and changed there the definition to the existing redis location and existing redis version and then redis started OK.

                I think RhoMobileSuite should know where it installs the redis and which version it installs.

                Bug? But if Rake will be deprecated soon then maybe it does not make a sense to talk about it.

                 

                However the "token" commands still do not work. Neither the whole system.


                 

                 

                  • Re: How to build a demo system for syncing using Plugins?

                    Since you're on windows the steps may be different, I'm testing all of this on OSX only.

                     

                      C:\Users\BRM738\workspace\eventtracker-rhoconnect>rhoconnect redis_start

                              Starting redis in a new window...


                              but No new window is popping up and probably redis is not starting.

                    Ok, using the rake task should be no different so if that works for you that's fine.

                     

                                  Installing eventmachine (0.12.10) with native extensions

                                  Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

                     

                                   I am attaching the log file (gem_make.out) for investigation

                     

                    Try setting eventmachine in your Gemfile to 1.0.0.  You may have to delete the Gemfile.lock to make it install afterwards.

                     

                    RHOCONNECT_URL=http://secrettoken@localhost:9292 rails s - NOT Working

                    Yes this is expected because the rails app isn't starting up due to eventmachine bundle install failure.  If the rails app starts up this should work.

                    1 of 1 people found this helpful
                      • Re: How to build a demo system for syncing using Plugins?
                        Rafal Firlejczyk

                        Anybody tried this demo on Windows?

                        I tried it on Windows7/64 - not working.

                        Today I tried it on old Windows XP as well. I could go one step further - The Redis server for Rhoconnect is starting!

                        However the command to start rhoconnect with API_TOKEN:

                         

                        API_TOKEN=secrettoken rhoconnect start


                        is not working.

                        I could start it however with the normal command:


                        rhoconnect start


                        Not working on XP nor on Windows7 is the rails application. I changed the event machine version to 1.0.0. in gemlock and ran the bundle install again. It goes one step further, but it stops on installing libv8 gem:


                        Installing libv8 (3.3.10.4) with native extensions

                        Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

                         

                        What to do?

                        Should I buy a Mac, or does somebody have a running system on Windows as well?

                          • Re: How to build a demo system for syncing using Plugins?

                            API_TOKEN=secrettoken rhoconnect start

                            Since your'e on Windows, the syntax of setting an environment variable is a little different:

                             

                            $ set API_TOKEN=secrettoken

                            $ rhoconnect start

                             

                            The same applies for the rails app:

                             

                            $ set RHOCONNECT_URL=http://secrettoken@localhost:9292

                            $ rails s

                             

                            Please do an update of the eventtracker repo, I pushed up some small changes to make bundle install work on windows.

                              • Re: How to build a demo system for syncing using Plugins?
                                Rafal Firlejczyk

                                I updated the eventtracker repo.

                                 

                                1. Rhoconnect server is working already. API_TOKEN is set (secrettoken) in the Rhoconnect console!

                                Before that a Redis server had to be started. On my Win7/64 machine it can only be only with the command:

                                >Rake redis:start         (the command rhoconnect redis-start - does not work)

                                 

                                2. Rails server is also starting. Before that however I had to run the db migrate command:

                                >rake db:migrate

                                But the webpage of the rails server:

                                localhost:3000

                                produces failures. Maybe for Windows the rails code has to be modified as well?

                                 

                                ==================================================================================================================

                                LoadError in Events#index

                                Showing C:/Users/BRM738/RHO/eventtracker/app/views/layouts/application.html.erb where line #14 raised:

                                cannot load such file -- less (in C:/Users/BRM738/RHO/eventtracker/app/assets/stylesheets/bootstrap_and_overrides.css.less)

                                 

                                Extracted source (around line #14):

                                11:       <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script> 12:     <![endif]--> 13: 14:     <%= stylesheet_link_tag "application", :media => "all" %> 15: 16:     <link href="favicon.ico" rel="shortcut icon"> 17:     <link href="images/apple-touch-icon.png" rel="apple-touch-icon"> 

                                 

                                 

                                Rails.root: C:/Users/BRM738/RHO/eventtracker

                                Application Trace | Framework Trace | Full Trace

                                app/views/layouts/application.html.erb:14:in `_app_views_layouts_application_html_erb__240508308_37783548' app/controllers/events_controller.rb:7:in `index'

                                 

                                Request

                                Parameters:

                                None

                                 

                                Show session dump

                                Show env dump

                                Response

                                Headers:

                                None

                                 

                                ============================================================================================

                        • Re: How to build a demo system for syncing using Plugins?
                          Alexey Victorov

                          Lars, thanks! I found that my problem was - I should have not create empty adapter in RhoConnect app.