cool, I got that running so I will play with it. I guess as long as the
camping server stays up there's no issues, but if it goes down, and apache
sees that then I have to restart apache to recover.

No biggie, at least reloader is seeing the code changes and recovering from
errors.

Thanks again.

Now to figure out how to use camping and play with some code.

I need to figure out the proper way to setup a activerecord connection and
use it in my code.

I was able to make a db.rb which does a require 'active_record' and
establishes a connection.

I then have a Test class that inherits from ActiveRecord::Base.

I wasn't really sure the best way forward from there.

Because I wanted static content available and saw a post about using
Rack::Static I just setup my module with a Test.find(1) query to pull a
record from my DB

module Test
  $test = Test.find(1)
  use Rack::Static, :urls => ['/static']
end

Now in my views I have a line like:

p "Pg query: #{$test.text}"


It prints data from my db/

I'm just not sure if using a global is the right way to go about it.

I tried a instance variable (@test.text) but that didn't seem to work.
Still getting a handle on ruby OO.



Thanks

On Wed, Jan 2, 2013 at 1:07 PM, David C gurugeek <1...@1.ai> wrote:

> I understand! To achieve exactly that just use thin on your remote
> webserver (and apache or nginx as proxy..if you need the setting I can try
> to help but you can certainly find it on google too) then you can just drop
> your script via FTP and it will auto reload remotely too. Even on the days
> where I had 1000+ daily visitors thin did work very well so I would use
> that vs. passenger (I do use passenger for the multi users hosting as it
> does have some benefits e.g. we also run PHP and Perl in parallel and give
> more choices to developers to run scrips in several languages in parallel).
>
> Another simple solution would be this: whenever you upload your script
> just upload restart.txt too and it will work. Sorry if this is not ideal
> but I don't think that there are other options with passenger + apache.
> Best Regards and Happy 2013
> David
>
>
>
> On Jan 2, 2013, at 8:53 PM, Koaps Freeman <koapsfree...@gmail.com> wrote:
>
> Thanks for the reply David,
>
> I thought about trying that also.
>
> Right now this is just for home devel stuff so it doesn't need to be
> robust or anything, I just develop on my laptop which is separate from the
> webserver so I was hoping I could just upload stuff and the server reloads
> without me having to actually be logged into it.
>
> The restart.txt seems to be hit or miss which is why I didn't want to use
> it.
>
> Thanks
>
> On Wed, Jan 2, 2013 at 10:26 AM, David C gurugeek <1...@1.ai> wrote:
>
>> Hello!
>> I am running apache with passenger too and I couldn't find a way to have
>> a reloader feature as of now..this said you might want to use apache proxy
>> to run directly camping (e.g. when you test code) using the default
>> webserver (e.g. thin). I am using that to avoid the continuous reload even
>> on a live website  (http://1.ai) and it works very well.
>>
>> Oddly sometimes things do not work between thin and apache + passenger
>> (it is rare but...) so I think you could use thin + apache proxy when you
>> test your code live and apache + passenger for the code that you do not
>> need to re-load several times ?
>>
>> Others might have better ideas for config.ru so just take my workaround
>> as such !
>> Best Regards
>> David
>>
>>
>> On Jan 2, 2013, at 7:02 PM, Koaps Freeman <koapsfree...@gmail.com> wrote:
>>
>> Hi Guys,
>>
>> I just started playing with camping and so far it's pretty awesomo.
>>
>> After much messing around I was finally able to get Apache Passenger,
>> Camping and ActiveRecord to PostgreSQL working.
>>
>> One thing I was wondering about, can I use reloader with Apache Passenger?
>>
>> Always having to touch/rm a tmp/restart.txt to see changes or reloading
>> apache altogether is kinda a pain and I was hoping I can use reloader to
>> just detect changes to make recovering from errors faster as I type code.
>>
>> I saw some previous post about using reloader:
>>
>> http://rubyforge.org/pipermail/camping-list/2010-August/001378.html
>>
>> Which used on_reload which doesn't seem to exist anymore.
>>
>> I'm still learning rack/rails stuff so not really sure how to setup my
>> config.ru to use reloader.
>>
>> In the reference it says:
>>
>>  require 'camping/reloader'
>>   reloader = Camping::Reloader.new('/path/to/yourapp.rb')
>>   blog = reloader.apps[:Blog]
>>
>> The blog object will behave exactly like your
>> Blog and Wiki, but they will update themselves if yourapp.rb changes.
>> I'm not sure how I get passenger to then run the blog from the config.ru
>>
>> Thanks
>>
>>
>> _______________________________________________
>> Camping-list mailing list
>> Camping-list@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/camping-list
>>
>>
>>
>> _______________________________________________
>> Camping-list mailing list
>> Camping-list@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/camping-list
>>
>
> _______________________________________________
> Camping-list mailing list
> Camping-list@rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
>
>
>
> _______________________________________________
> Camping-list mailing list
> Camping-list@rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
>
_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to