Running Lua scripts using FastCGI - lua

I am currently trying to figure out ways to run Lua scripts using FastCGI with either lighttpd or Nginx. The only thing I was able to dig up yet was WSAPI of the Kepler project. But I wonder if there are other possibilities. Important for me is:
should be as lightweight as possible
should be stable enough to use in a production environment
Many thanks in advance.

I would recommend taking a look at this project:
http://github.com/STPeters/luafcgid
There are instructions on how to use it with nginx.

Related

Setting up PHP-FPM in PHP 5.4

My configuration is like this:
Centos 6.3
Plesk 11.5
PHP 5.4.18
Apache 2.2.15
PHP API: 20100412
Server API: CGI/FastCGI  
I use php as fastcgi. But I want to use APC or XCache. And it seems like FastCGI doesn't work well with opcache. So I read that it is better to use PHP-FPM. So how can I enable or install PHP-FPM ?
I read some tutorials and they offer to compile apache with fpm but it seems like a big risk for me. I'm not well-informed in servers.
I'm not sure whether I use mod_fastcgi or mod_fcgid. In my /etc/httpd/conf.d/ folder I have fcgid.conf file. So I think I use fcgid. Is it correct?
My Plesk has this setting: http://s11.postimg.org/pgqxwmmr7/fast.jpg
I'm curious if I install php-fpm can it brak my webserver or will any other problem occur ?
When dealing with Apache and FPM you should be using mod_fastcgi and not mod_fcgid.
I created this documentation a while ago and it seems to have helped quite a few people in the past, so perhaps it will also help you -> https://gist.github.com/diemuzi/3849349
As for breaking the web server... That's an iffy question. Since FPM is a standalone and does not need Apache to run, it possible that your current Apache setup might need some additional "tweaking" to make it work the right way again. Furthermore, since you are running Plesk and as it does not currently offer FPM support, there is also a good chance that you could possibly break your Plesk setup.
If you were not using some proprietary control panel software to manage your server and did things the old fashioned way by manually installing (or even using packages from your distro) then all of this would be a very simple solution for you.

How to install Ruby script on server?

I apologize in advance for the fairly simple question.
I am familiar with PHP, but am trying to install this Ruby script on my server for the first time. It's an open source script that I've forked from github, but unfortunately does not have any instructions. I have Ruby on Rails, and MongoDB installed already.
Does anyone know what the beginner steps are to get started? Should I upload everything via FTP to the public directory, or is there something else to this?
Most Rails projects are much better served by having a proper deployment strategy. Typically this involves making your own repository, easily done by forking that existing application, and cloning that on to your server using git. To make changes in the future, do your work on a development copy, push that into the repository, and pull down the changes on the server.
Unlike PHP where many parts of the application can function independently, Rails applications tend to be far more integrated and uploading it piece by piece is not going to work in the long run.
Rails applications can run stand-alone using the provided rails server tool but this is really only intended for light-duty testing or development work. A more permanent solution is to use something like Passenger to do the hosting for you.
Passenger will take care of launching your application when calls are made to the site you've configured in Apache or nginx, depending on which you end up using. Passenger is popular because it's quite easy to get running.
There are other approaches like unicorn if you're feeling more adventurous.
When you make changes to your Rails application in production mode you will have to create a tmp/restart.txt file in the main application directory to tell your web server to restart the process. This is not a requirement in development mode.
Due to the relative complexity of this process once you include all the various steps, you will probably want to use a deployment automation tool like capistrano.

Monitoring ROR server (thin or mongrel) for resources and availability in WINDOWS and re-spawn

First thing I would like to say is, i know deploying ror applications in windows is not recommended, but in this case i have no choice due to some client restrictions.
I am looking for a tool like Upstart for windows which will moniter my instance of Thin or Mongrel and will 're-spawn' in case of crashes or availability.
Now I looked around quite a bit and most solutions like UpStart, or Passenger server are only available for Unix environments.
Any known tools for windows? and how to use them?
I am also open to any alternative ror servers for windows that can do this automatically like passenger does.
Thanks
Shaunak
Maybe a bat script as a scheduled task to run wmic process, scan to find Mongrel, and if it's not found to run it?
Sorry, I'd do it in bash, or I'd have a code example for you.
This would also make a good python script, in my opinion.

How can i run a ruby on rails project on apache server?

I have project, personal blog with ruby on rails 3.
I use linux.
I want to run this project on apache server, not in webbrick.
How can i do this?
It will be very helpful if someone can answer.
Thanks
You can take a look at Passenger*:
http://www.modrails.com/
This is a module for Apache that works like mod_php. It's very easy to setup and you can also use the Ruby Enterprise Edition to use "33% less memory on average":
http://www.rubyenterpriseedition.com/

Running multiple web frameworks on one machine?

I want to start experimenting with all these different web frameworks that are available. I was wondering if they could all run in one machine at the same time?
I know that all my database services can all run at the same time, along with the Javascript frameworks, but what about something like Rails and Java applications? Can those play along with each other? Will Apache handle all of this for me?
Yes, since almost any language framework runs as normal code for the language, simply providing structure for applications you write, they can coexist well with other frameworks for the same or other languages. You can certainly run Rails and a Java framework on the same machine - you could even run Rails on JRuby and a Java application server
It sounds like you're just getting started programming. I would recommend learning some of the basics first. For instance, if you want to learn Ruby, try the Pickaxe book, write some simple scripts, then move on to a ruby web framework like Sinatra or Rails. You'll have a better understanding of the difference between a language and framework, how each is installed and run on your machine, etc.
The easiest way to begin experimenting is to use the development server that is included with the various frameworks and run the server on a different port (not 80). For Rails, this is done via:
ruby script\server
which will start a server on port 3000.
Other frameworks use other approaches. Most tutorials for Ruby and Python frameworks (with which I am most familiar) will include instructions on how to start a development server like this.
I don't see why not. It really depends on how the frameworks are deployed and in what containers. If they use separate containers (e.g. tomcat vs apache) you'll need to make sure that the containers are configured to use different ports since many web containers use 80 or 8080.
If you plan on running them all in the same container (e.g. Apache) then I would think they'd be fine, since each one can be treated as a separate web application and deployed to a different location in your document root.
For the most part, it'll probably be trial and error. I don't know much about how Rails interacts with Java, but I've run Grails and Java applications together easily myself with few problems.
I run Rails, PHP, and Java with one Apache server. Except for what felt like a ton of apache config munging when I set it all up, it's been fine. I'm not much of a sysadmin, so it took me a few days to get everything running right.
PHP, Java and Rails all have environments that let you run independent servers and save complex configuration.
Java you can use Tomcat or Jetty.
Rails comes with Webrick, which is fine for development.
PHP has XAMPP (or MAMP if your on the Mac) gives you a complete stack.
I run Rails and ASP.NET MVC on the same Machine and I just set my local servers to run on different ports. But usually the default setup (e.g. Rails on port 3000) will not conflictwith each other, plus each framework usually has its own way to run (LAMP, Webrick, Montgrel...) so you should be fine.

Resources