Benchmarked

2013-11-18 Thread Koaps Freeman
Hi guys,

I wanted to share my latest little project with you.

While it's not totally camping specific, it does use camping as it's main
test bed.

http://nullworks.wordpress.com/2013/11/17/benchmarked/

https://github.com/koaps/benmark


Basically it's my attempt at seeing what ruby server does a decent job on
JRuby as a camping server.

Take a look and feel free to let me know of any improvements that can be
done.

Thanks
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Camping Blog with Sequel, Thin and Rake

2013-11-14 Thread Koaps Freeman
Hi All,

I just wanted to pass along some code I did recently.

https://github.com/koaps/camping-thin-blog

It's basically the Camping example Blog modified to work with Sequel, Thin
Server and Rake migrations.

I mainly did this because I'm testing using Camping on JRuby and
Celluloid's Reel-Rack and since native extensions are problematic on
current JRuby, I needed an easy alternative to pg gem and Sequel
JDBC:Postgres isn't bad, though I could have used JDBC from AR.


As a side note, here's my Nginx/HAProxy setup I'm using to frontend the
Camping Apps with a backup server to host a static page if the app is down.

http://nullworks.wordpress.com/2013/11/09/nginx-and-haproxy-for-fun-and-profit/
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: Apache Passenger and Reloader

2013-01-03 Thread Koaps Freeman
Awesome

I'll give that a shot.

Thanks
On Jan 3, 2013 12:17 AM, Magnus Holm judo...@gmail.com wrote:

 On Wed, 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

 Something like this should work:

 # config.ru:
 require 'camping'
 require 'camping/reloader'

 class CampingRunner
   def initialize(path, name)
 @reloader = Camping::Reloader.new(path)
 @name = name
   end

   def call(env)
 @reloader.reload
 app = @reloader.apps[@name]
 raise Could not find app: #{@name} if app.nil?
 app.call(env)
   end
 end

 run CampingRunner.new('blog.rb', :Blog)
 ___
 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

Apache Passenger and Reloader

2013-01-02 Thread Koaps Freeman
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

Re: Apache Passenger and Reloader

2013-01-02 Thread Koaps Freeman
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

Re: Apache Passenger and Reloader

2013-01-02 Thread Koaps Freeman
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