7 Replies - 6348 Views - Last Post: 26 January 2012 - 02:51 AM Rate Topic: -----

#1 cornetto456  Icon User is offline

  • D.I.C Regular

Reputation: 21
  • View blog
  • Posts: 438
  • Joined: 03-January 11

Ruby server programming running as rails application

Posted 24 January 2012 - 11:47 AM

Hi, I recently got into ruby on rails, but now I need a sort of server for an application im building(Desktop). And buying a vpn isn't really a option(or let my pc on 24/7).

So I've seen i can run rails application's on my website.

But can't I just program a server and let it run on a specific port and then run the rails app on the port I set it to run on ?

And if that's not possible are there other ways ?

Thanks! :)

Is This A Good Question/Topic? 0
  • +

Replies To: Ruby server programming running as rails application

#2 Skaggles  Icon User is offline

  • THE PEN IS MIGHTIER
  • member icon





Reputation: 251
  • View blog
  • Posts: 640
  • Joined: 01-March 09

Re: Ruby server programming running as rails application

Posted 24 January 2012 - 04:01 PM

If all you're doing is development testing, or running a small web application, you can look into using services such as Heroku. They offer free hosting for Ruby web applications, with some limitations.
Was This Post Helpful? 0
  • +
  • -

#3 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Ruby server programming running as rails application

Posted 24 January 2012 - 07:07 PM

View Postcornetto456, on 24 January 2012 - 11:47 AM, said:

So I've seen i can run rails application's on my website.

But can't I just program a server and let it run on a specific port and then run the rails app on the port I set it to run on ?

And if that's not possible are there other ways ?


When you say "run rails application's on my website" are you meaning to say that you're currently a subscriber to a webhost, and they claim to offer rails as a part of their service? (So I'm assuming you have flat .html files running, or possibly some .php going on, and you'd like a rails app running in addition to this...)

I'm not 100% sure I'm parsing that right, but on my current shared web host, I'm given tons of control over ports and stuff. I can so much as type rails s and sure enough, when I navigate to mywebsite.com:3000 I will actually see my rails application being served in development mode using webbrick. This isn't recommended for several reasons (I'm on a shared host, so port 3000 leads to EVERYONE's port 3000, so right there is kind of an iffy thing), but I read somewhere in my host's literature that I can contact them if I'd like to have a special port reserved for something (they're really nice at my current place).

An alternative way to have your website hosting your rails app is to create a subdomain, like railsapp.myWebsite.com. I think that's the most common way to do it (and it's easier than mucking around with alternative ports), but I'm actually a little foggy on the procedure of how to do it, so you should contact your webhost and ask the for literature regarding how to deploy a rail application with them (it's probably going to be somewhat out of date, rails moves a little too fast for most web hosting solutions).

This post has been edited by NotarySojac: 24 January 2012 - 07:08 PM

Was This Post Helpful? 0
  • +
  • -

#4 cornetto456  Icon User is offline

  • D.I.C Regular

Reputation: 21
  • View blog
  • Posts: 438
  • Joined: 03-January 11

Re: Ruby server programming running as rails application

Posted 25 January 2012 - 04:59 AM

Hi, thanks for the info.

But i think you misunderstood me.

So what i have is an account at www.hosting24.com

I got ssh/shell acces and ruby on rails support.

But I want to ask you.

Im developing an application that needs a simple server. and i heard ruby on rails was a framework of the ruby language so i could use that to develop my server and let it then connect or isn't that possible?


Thanks!
Was This Post Helpful? 0
  • +
  • -

#5 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Ruby server programming running as rails application

Posted 25 January 2012 - 10:10 AM

View Postcornetto456, on 25 January 2012 - 04:59 AM, said:

Im developing an application that needs a simple server. and i heard ruby on rails was a framework of the ruby language so i could use that to develop my server and let it then connect or isn't that possible?


Yeah, rails can be used for that, but it's somewhat overkill (rails is a huge framework, and you could probably get away with a .php script to be your server if it's that simple). You would see some advantages if you need your server to store persistent data in a database, since that stuff is so absolutely clean in rails compared to PHP (a personal opinion).


I spoke with support at your webhost and the chat was somewhat unproductive:

Quote

10:37Alex F.: Hello and welcome to Hosting24.com, how may I help You?
10:37 NotarySojac: hi, do you have a link to some information that can get me started working on a rails app with you guys?
10:37 NotarySojac: also do you support rails 3?
10:40Alex F.: Ruby on rails is supported by our servers.
10:41Alex F.: What particular info do you need, as long as ruby on rails is concerned ?
10:42 NotarySojac: You've probably got a tutorial describing which ruby server to use (thin, passenger, etc.) and how to go about setting things up?
10:53 NotarySojac: You can find all the necessary information regarding ruby in the cPanel area for ruby on rails
10:54Alex F.: Additionally, you can refer to this resource: http://guides.rubyon...ng_started.html
10:55 NotarySojac: ty
10:55Alex F.: It has been my pleasure to assist You today. Feel free to come back if any more questions/requests arise.


So apparently everything you need to know you will find in your cPanel (I've never had much helpful information there, but every webhost does it differently with my experience). Usually they give you a hello world tutorial which you can follow to build your first rails app with them or a deployment procedure. It looks like this webhost might have tacked on rails 2.x support at the very last second though. It might actually be easier to go through Heroku like skaggles suggested. My first post was applicable to your issue, but was centered arround the logistics of deploying a project, not the specific client/server interactions you'd like to setup up.


I somewhat did a tutorial that details exchanging data between a rails app and a program in this blog entry if you'd like to see the technical details of such operations.

Quote

Imagine that you have data in a computer program you wrote, and you'd like to send that data up to your rails app. Well, this tutorial will illustrate exactly how to do that using C# as the language. In the process, you will learn more about that pesky respond_to do |format| syntax and what it does.


Let me know if you have trouble with that tutorial because I don't remember proof reading it =/
Was This Post Helpful? 1
  • +
  • -

#6 cornetto456  Icon User is offline

  • D.I.C Regular

Reputation: 21
  • View blog
  • Posts: 438
  • Joined: 03-January 11

Re: Ruby server programming running as rails application

Posted 25 January 2012 - 11:13 AM

You've been a good help, but its not that simple with xml.

So what I want to do is this:

So i have a couple of friends and we chat play minecraft online on my server. But we are using hamachi at the moment. Where there's really not anything to moderate over. So i thought let's create a simple application with login admin bot en chat.

So what I thought was to create a client/server over tcp app that listens for specific things (so a message broker kind).

But the problem is im not sure if i can use tcp on my server with ruby on rails. It wouldn't use alot, it just 10 friends, and the minecraft will be hosted by an admin(me or another guy).

Also your tutorial is good, but a bit hard for someone with not that much experience (ruby) :)


Thanks!
Was This Post Helpful? 0
  • +
  • -

#7 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Ruby server programming running as rails application

Posted 25 January 2012 - 12:29 PM

View Postcornetto456, on 25 January 2012 - 11:13 AM, said:

Also your tutorial is good, but a bit hard for someone with not that much experience (ruby) :)


Thanks. My apologies for the difficulties, I find rails to be one of the most difficult languages to explain. If you have a lot of time, or are quick with walk-throughs, I suggest http://ruby.railstut...s-tutorial-book to give you more background (I found it unpleasant to get through, but indispensably helpful none-the-less).

Regarding your immediate concerns, you can also communicate to your rails server with GET requests (like what you type into a browser).

For instance, you can program your rails site to... kill a running process (say, your mine craft server's process) by navigating to the url:
www.yourWebSite.com/MyCommands?cmd=No-Soup-For-You&user=admin&password=1234



Is that what you mean by TCP? You can place that link on an HTML web page in your rails app as well to give it a slick interface. I don't know much about mine craft servers so you'll have to explain how you normally would accomplish a desired task, and then maybe we can suggest how we can get a rails app to do it (It's ideal if the task can be carried out on the command line).
Was This Post Helpful? 1
  • +
  • -

#8 cornetto456  Icon User is offline

  • D.I.C Regular

Reputation: 21
  • View blog
  • Posts: 438
  • Joined: 03-January 11

Re: Ruby server programming running as rails application

Posted 26 January 2012 - 02:51 AM

So the case is I choose 2 admin's of my application and they have access to the "admin bot" (the server) and they can do command's like /server start and /not message to start the server remotely but they will host it as a normal mc server with their configuration automatic, So the rails application is only for getting messages and command's to the other online user's.

But i think i will cancel my subscription with hosting24.com and gona take a vps :).

Thanks for the help!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1