How to deploy a rails application on Windows PC (windows 7 / windows 8)? - ruby-on-rails

I have built a rails app which is used as a standalone enterprise application. The application needs to run on Windows desktops (entire user base runs Windows machines). I am able to run it quite successfully on an Ubuntu machine but it's not something customers will prefer to run.
Since deploying on a windows machine is quite messy AFAIK. I would like deploy it on Windows using a virtual machine (VirtualBox).
Requirements would be -
Application installation on Windows 7 / Windows 8.
User should be able to access rails server by browser running on his/her system via localhost or any other IP address.
Application should auto-start when user reboots the machine.
Ideally user should be able to download and install the software on his/her machine by himself/herself.
I am working to make this work but would like to know the feasibility of this solution. Would like to if I am getting the concepts wrongs or if there is something which is simply not possible or is not making any sense.

Take a look at Vagrant, which is a highly scriptable VM host. You can then generate batch files to automatically start the VM on boot.
To deploy new code, you'll just want to provide them with a new VM image they can copy into your app directory.
That said, I agree with other comments that this might not be the right platform for your use case. The main reason for building web apps is so that many clients can use your app over the web using just one set of servers. Deploying a web server to each client seems like it's defeating that advantage.

Related

Distribution of containerized applications to end users

I have containerized an application which is comprised of a Node.js application, Nginx, and MongoDB. I'm currently using Docker Compose to start and stop the application on my development machine.
I'd like to distribute the application, along with the volume that contains the MongoDB database files, so that an end user can easily start the application on their computer and point their web browser to it.
Some factors I'm considering:
The end user is almost certainly not familiar with containerization and is probably not comfortable playing around in a terminal.
The end user is likely to be using macOS or Windows, but Linux should be supported.
Asking the user to install Docker is possible, but I don't like that it requires Hyper-V on Windows, which conflicts with other software such as VirtualBox.
I could write a cross-platform GUI application that manages Docker with simple "start" and "stop" buttons. However, I am not married to using Docker if there is an easier path forward. Should I look into something like Facebook's executable archives?

How to make a struts2 project an executable Application

I have developed a Struts2 Project using Apache server and MySQL database.
Is it possible to make this application an executable application so that i do not need to give JDK, Apache and MySQL separately to the user. The installer could install all these 3 itself.
Also can i make this so that only a single user can use this application. How Please Tell.
Usually a Web Application has a central server (with at least: a Java Virtual Machine, a Web Server / Application Server, a Database, and the Web Application contanining the Java code), and all the client computers use their browsers to connect to it.
The kind of application that seems to arise from your description is a monolitic one, like a GUI App made in Swing or in Visual Basic; you install it in the clients, and each one has a copy of each component. If you install it 20 times, you will have 20 database, 20 copies of the files, etc...
Even in client-server applications, with centralized database and distributed code, the problems were always client-related; you can't know if the system were you are automatically installing a database, an JDK etc... already has that software, maybe in other versions, or has the environment variables messed up etc. When you need to update the software, or to tune up the system, you need to be physically log to that pc, remotely or by person. This are some of the reasons that led to the choice of preferring Web Applications to distributed applications.
If you need to craft a "package" of your application to be installed in one click by a dumb user (let's say, a portable version of your application, to let your PM perform some Demo in remote locations, or to give it to the big boss to let him see it), you should really evaluate the possibility of creating a Virtual Machine.
A Virtual Machine is a big file (on a hard disk, or read by an USB key, etc) that, once mounted by a Virtualization Software (usually the same software that created the Virtual Machine), will run an entire new OS inside a window of your guest OS.
The leading software to do this is VMWare (the Player is free and cross-platform), alternatively you can use VirtualBox.
Then, you need to
download VMWare Player
download the ISO of your favourite Linux distribution (I hope you don't use Windows as server)
create a, let's say, 10GB partition for your Linux distribution with VMWare Player, and mount it
plug the ISO with something like (the free edition of) Daemon Tools
install the Linux distribution
install and configure all the software you need there (Apache, MySQL, your favourite browsers, etc; JVM usually is already there)
install your web application
Then you will have a physical file with a complete Linux OS inside, with all the needed software already tuned up: just distribute this file to Windows, Mac or Linux users, they will only need the VMWare Player installed to run your file and access (their copy of) your application inside the Linux OS.

Lightest way to run IIS on Mac?

I have an ASP.NET MVC 4 app that I would like to run on a Mac machine. I would hate to run a full blown Windows virtual machine when all I really need is IIS7 to run the MVC app. What is the lightest way to run this (VirtualBox, Parallels, IIS7 Express, etc)? Really my goal is to code the Javascript/client-side of the app on my Mac and I am trying really hard not to do my development on a Windows machine :)
BEWARE: The below answer is very old and I don't delete it just for historic purposes. These days I would recommend to install ASP.NET Core along with .NET6. After you have set that up, there are different ways to expose your web port in production, such as NGinx reverse proxy, or Kestrel or other things that I haven't researched much these days.
Follow this link (provided by #LexLi in a comment above) to know how to set up your MVC environment.
With regards to IIS, as far as I know it cannot be done. You should use the native web server of your operating system. IIS doesn't run on Mac, so I guess you should try Apache, and then install module "mod_mono".
Or if that gets too hairy, just use the standalone mono web server called XSP.
Or run FastCGI, or nginx.
It is all explained here: http://www.mono-project.com/ASP.NET
I use Parallels, and although their software was poor a few years back, it's now lightyears ahead of VMWare in stability and performance. Parallels Desktop 7 for mac is awesome.
My only computer is a MBP, yet I develop software for IIS. I run Parallels in Coherence mode, and I essentially have VisualStudio as just another mac app. And since I'm only running one app in the VM, it's way more stable than a normal PC install. I actually haven't rebooted it in 2 months so far!
Only caveat - you want to dedicate 2-4GB of ram to the VM to prevent paging, so you should try to get more than 8GB if you're a polyglot developer. Having multiple IDEs on multiple OSes can be heavy, and when you add the memory-hogging yet blazingly fast Chrome to the mix, you'll hit that ram limit often...
xsp is a alternative for IIS in Mac, that can run basic capabilities.
I recently used VirtualBox with a copy of windows home (free with "I don't have key") and installed visual studio on it (community version). And IIS Express works just fine, TFS repos work too.

How do I run Rails on Windows Server 2003 or 2008?

I developed a Rails application on Linux and it's about to launch, but my client's IT guys stopped it saying they want it to run on a Windows in-house server. I've never run a Rails application on Windows, but now I have to.
Questions:
They will set up a dedicated Windows machine. Which is better, Windows Server 2003 or 2008?
Do I use IIS web server? Is there any better option?
I use Paperclip plugin with ImageMagick. What's the equivalent on Windows?
Do you any advice for me?
Running on Windows might be far from ideal, specially if your application used components that lack working version on Windows.
If is an application for intranet usage, you can deal running Thin standalone instead of putting things behind IIS. You will need to make your app work as service. For Rails 2.3 you have mongrel_service. For Rails 3 there is no service solution right now.
If you require to use IIS, please ask the IT guy to look at Helicon Zoo
There is ImageMagick for Windows, and works with Paperclip.
The easiest way is installing the application inside a Linux Virtual Machine above Windows Server, and treat it like an independent server in your network.

How I turn an average desktop PC into server for hosting a website using Ruby on Rails?

What is the best way to turn an average desktop PC into server for hosting a website using Ruby on Rails?
I am open to changing operating systems, buying parts if I need to, using whatever Database People recommend and any software.
Here are the approximate details of the computer:
The computer is an HP Desktop with 1.86GHz Duo Core CPU. Intel chipset.
1GB Ram, 200GB Hard Drive
Runs on Windows XP
FYI, This is not a commercial project and this is not about saving money. I just want to pick up some new skills and I think it would be fun.
Thanks,
Jeremy
Just a suggestion, you could just use http://www.slicehost.com. You can buy a virtual machine with 256MB for $20/month but you build the machine from scratch after loading a base Linux distribution like Ubuntu. There are excellent instructions there on how set up your OS to do whatever you want to do.
If you really want to run a server on that machine you have though, thus saving $20/month, I would recommend installing some form of Linux. I would suggest Debian or Ubuntu. If you want to learn a bit more about some Linux fundamentals like building a kernel and tweaking .conf files (could be useful at some point) try a distribution like Gentoo. Basically download the ISO and boot it up.
If you just want to play with Ruby on Rails on that box, of course, just go to http://localhost. Furthermore, you don't even need to set up apache if you are just playing around... just use the web server built in to Rails. To be able to access that machine from anywhere in the world, if you have a static IP, get a domain name and point to that IP. If your IP is dynamic then use dyndns.org to get a dynamic host name. You can usually configure most routers to update sites like dyndns.org with your up-to-date dynamic IP.
While you can setup Rails on Windows, most people tend to use some flavor of Linux or BSD. The hardware you have should be more than enough for what you're asking it to do.
There are many tutorials on how to install the software you'll need. A typical stack would be Ruby, the Rails gem, MySQL (with ruby bindings and gem), Apache, and Passenger.
Slicehost, for example, has a good setup tutorial for Ubuntu. Depending on how much you want to learn about system administration, you can use a package manager to install (apt-get or aptitude on Ubuntu, for example), or compile from source.
Rails' default configuration is set up to use SQLite as the database, which requires basically no administration. If you make your site public and are getting more than a handful of users, MySQL or PostgreSQL is the next step.
Note that XP by design is limited to 10 concurrent open connections at once. This is so people need to buy the higher priced Server editions of Microsoft OSes for production servers. However, it should be fine if all you want to do is experiment.
First, you need an IP willing to give you a static IP (or get a dynamic DNS solution). DNS is what maps a URL to a IP address and a constantly changing IP address is going to give you a bunch of headaches.
Next, you need to purchase a domain and have it point to your IP. If your machine is behind a router, you need to go into the NAT settings in the router and have it forward port 80 to your machine.
Finally, you need to install some kind of web server on your local machine. If you want to work with rails, I recommend installing InstantRails which comes with the Apache web server and MySQL by default.
Once this is done, spin up InstantRails, load up a rails project and then visit your domain to see if it all works.
EngineYard, one of the bigger Rails-based hosts, offers a VMWare image of their deployment platform that you can download from http://express.engineyard.com/
It will work the the free VMWare Player http://www.vmware.com/products/player/ which runs on WinXP.
This arrangement, which I've done several times for small and internal projects, gives you a full-featured Rails server with prebuilt deployment recipes (using the engineyard-eycap gem).
Download VMWare player
Download EngineYard Express
Boot your new server in VMWare Player and go to town.
The only hardware suggestion I'd make is to add more memory -- the VMWare image used 640mb by default and performs better with more, though it doesn't sound like performance is your concern.
What's particularly nice about this solution is that you can move to a commercial option (EngineYard Solo on Amazon EC2 or the full EngineYard offering) or roll your own with Slicehost, etc once you're comfortable with Rails. But this solution puts you in charge of the development side of things without needing to waste time on the server side.
On windows, first install xampp.
http://www.apachefriends.org/en/xampp-windows.html (download and install: Installer 39 MB)
This will install apache, php and mysql database.
Then you need to install ruby: http://peri.me/?p=73
By the end, you be running ruby on your home pc.
If you want someone other than you to access the content on the server, you would need to somehow tweek your router or computer's setting to allow access.
I like Shalmanese's answer but I would add that you need a firewall. If you have no hardware one, you need to configure your iptables in linux, which is lots of fun by itself :) Especially if you have to rebuild kernel first to have it work.
you can find a lot of tutorials to setup "perfect servers" on various distros on how to forge Just search for "perfect server" on their site and you are good to go :)
Public IP Address and a sort of Linux with Apache (Passenger or mongrel).
You can run a Linux host in a virtual machine within your Windows desktop, using free software like Sun's VirtualBox or Microsoft's Virtual PC. I do this all the time to run development Linux servers for my environment, but it would work equally well for "quasi-production" hosts that you are just playing with.

Resources