I'm trying to profile a web application written on top of HTML::Mason, I managed to set the profiler but it doesn't seem to pick-up the code inside the components. Is there a way to profile Mason applications using NYTProf?
I realize you're deploying this app under mod_perl, but one way to handle this would be to deploy under Plack and then use Plack::Middleware::Debug::Profiler::NYTProf. I haven't done this for Mason apps, but it was almost trivial to get some CGI::Application code running under Plack. Once you are able to deploy under Plack you get access to lots of great middleware components for debugging. If you can do this with little or no changes to the app itself, you could still continue to deploy to production under mod_perl but use Plack in development for stuff like NYTProf.
EDIT: I see now that I should have pointed you at Devel::NYTProf::Apache.
Related
I'm building a web app with Backbone.js (I'm not tied to Backbone yet though). I need a back-end framework only for persistence to a database via a RESTful API. However, I also need to able to deploy it as a 'desktop' app for off-line use, i.e. running a local server and launching a browser window, but I don't want users to have to start a server from the command line to run the application.
I can use SQLite as a database since it's only a single user application, it's just the framework that I'm stuck on. I have looked at the following:
Rails and Django: Default web servers are too flimsy, requires Ruby/Python and runs from the command line. I'm aware of the Bitnami stacks but at 99mb it's too big of a dependency and not exactly hidden from the user.
Sproutcore: Run from command line, also too bulky.
Pyjamas Desktop - Depends on MSHTML which I suspect limits my ability to use HTML5 features.
I'm leaning towards creating a Java app that starts a Scala/Lift server instance and opens a web browser, then sits in the system tray (kind of like WAMP). Is anyone familiar with a tool or framework built for user-friendly deployment as a standalone desktop app?
I do not know if PHP is an option for you? Then I would recommend phpdock.
web2py has a standalone deploy-to-desktop feature with no dependency on Python: http://web2py.com/books/default/chapter/29/14#How-to-distribute-your-applications-as-binaries
As Eydun said, phpdock is an option but it's commercially licensed .
I settled on using Java/Spring/H2/Hibernate/Jetty. I find that Jetty serves requests VERY quickly so the application looks real-time when launched in a browser. There is a tutorial on embedding the Jetty server here. I imagine it's quite trivial to build a GUI that launches the server and a browser.
Another Java option is to use the Play Framework, which may be more at home to those coming from a Django/Rails background. However, the documentation for "creating a standalone version of your application" for Play 2.0+ indicates that they have ditched using Java EE containers (Tomcat/Jetty) and WAR files in favor of running the JARs with the bundled copy of JBoss Netty, so it may take a bit of work to get it running the way you want it.
I would recommend the Play Framework approach if you're OK with using/learning Scala.
I know this is probably a stupid question. But I created a .rb file with Sinatra framework and I am not sure how to "deploy" it. When I posted the file on the server I just get a simple text file that reads back my code. It works great when I run it with Sinatra.
Thanks in advance!
It looks like your web server (Apache?) is just serving you with your Ruby script (that is a text, ASCII file) instead of running it (that is: instead of passing it through the Ruby interpreter).
Hence:
Is the Ruby interpreter installed on your server?
Is your web server configured to run Ruby scripts (files terminating with ".rb")
through the Ruby interpreter?
And, is Sinatra itself installed on your web server?
Anyway, Ruby applications (Rails, Sinatra, Padrino) are usually deployed to a server using GIT. Have a look at Heroku and Engine Yard.
Also, there are tools specifically designed to help the developer in deploying Ruby applications. Have a look at Capistrano or Vlad and/or Google for "how to deploy a sinatra application".
For Sinatra/Rails/etc, most people use a Webserver (ie Apache, Nginx, etc) AND an Application Server (Thin, Passenger, Unicorn). For a simple app these can live on the same host. The webserver manages the incoming traffic and the application server executes the ruby code and passes results to the webserver.
When you execute ruby app.rb to run your Sinatra application, you're actually loading up WEBrick which is an application server. Since your development machine is local, you can access it directly at localhost:3000 or some similar address.
Look into tutorial on setting up your webserver with Thin, it's one of the easier ones to work with. When/if you outgrow it, then look into Unicorn.
I'm looking for something analogous to Capistrano for Rails - https://github.com/capistrano/capistrano/wiki/
I'd like to be able to run a single command from my workstation that will update the code on my server(s) from a GitHub project and handle all necessary process restarting for the application. I need to be able to control specifically when this happens, not use a hook in GitHub's checkin event.
Are Node.js developers also using Capistrano, or is there a tool that works better for Node.js?
You could use fabric, it's a python lib. Nodejs already uses python for some build operations for extensions, no reason you couldn't also use python to do what you're asking.
http://docs.fabfile.org/en/1.2.2/index.html
I don't know of a javascript lib that does this, not to say there isn't one though. Fabric sounds very much like what capistrano is, but maybe a tiny bit different in some aspects.
Capistrano seems to be the most popular choice.
I have some Mojolicious-based apps which happily run under Apache2 with mod_cgi and mod_fastcgi.
The urls are for example:
http://example.org/oneapp/path/info?foo=bar
http://example.org/oneapp?foo=bar
http://example.org/secondapp/path/info?foo=bar
http://example.org/thirdapp/path/info?baz=heh
#etc...
I had relative success configuring the apps as subdomains using proxy_pass
but I would like to keep the old urls(just switch from apache2 to nginx).
I would like to keep the same urls but run the apps using nginx.
What should my configuration look like and how should I run the apps.
Thanks in advance!
Since you haven’t got an answer, I’ll give a correct, but entirely half-baked and code-free, solution. Check the Mojolicious::Guides::Cookbook for nginx and Plack deployment. Mix this with Plack::Builder for deploying multiple applications on the same server. I’d go with Starman as the server engine probably but that is up to you and your specific needs.
That’s basically it. Sorry I don’t have code for you but that should do exactly what you want once you get through each step; the docs are good and can be supplemented with blog posts from various Perl devs.
see also the Mount Plugin which allows you to add one mojolicious app within another
I want to host a mod_perl application on a shared RHEL server where I do not have access to a root account. mod_perl is available on the server as are all Perl modules required (my app runs fine with CGI).
Here are two problems I anticipate: Apache restarts would be required whenever I update my code the first time and subsequently on periodic updates. Second, I would have to use some <Perl> directives in .htaccess. I would be happy to hear experiences, gotchas, hints from others who might have done this successfully. Thank you!
This might not be useful in your case, but you can always run an
Apache instance in your home directory, and have the frontend proxy
incoming requests to that instance. That way, you have full control
over the configuration, Apache modules, Perl modules, and Perl itself.
It also uses system resources better (slow clients don't tie up the
heavy perl app, only the lean frontend instance), and is actually the generally
recommended way of deploying mod_perl applications.
Another option, and one that will involve less screwing around, would
be to get a $20/month VPS and use that. Then you can do whatever you
want, as you'll have full root access.
You can't do it without the ability to restart Apache httpd.
Perhaps the admin will give you sudo powers so you can do that at least.
Try Perl under FCGI instead.
You aren't gonna be able to use mod_perl without root on a shared hosting account. The "run my own instance" sounds okay, but you will need a way to start up apache if the server reboots.
FCGI is your best bet. That or get something where you can get root access to your own apache process. The added benefit of such an account would be you could install CPAN modules without going through the extra hassle of setting up a non-root library and messing with $PERL5LIB.