TurnKey Linux Virtual Appliance Library

Remote Rails appliance workflow

Hey guys,

Great job on the Rails appliance. Worked flawlessly out of the chute on my ancient Thinkpad T23 (just a cheap development platform to learn Rails).

However, I am confused about something: there are some great development environments for Rails applications. I have been using Aptana's offering. However, I dont understand the process of working on an application remotely.

As of now I have been developing on my Thinkpad T400 and using the local webbrick server ( I think), to test things about.

But if I was running a server on my T23 and wanted to develop on my T400, how would I do that?

I know you guys don't support Aptana software, but I was hoping you had some resources that you could point me to (other than Aptana's site). This is why I haven't purchased a dedicated Rails webhost: I don't understand the workflow between server and developer...

Sorry for the ranting post, thanks in advance ;)

workflow between server and developer...

I don`t use rails everyday, instead i do stuff in Drupal, its php cms, so i will explain you on my scenario, but its generally similar situation, as i have understood your question.

i develop on ubuntu, where i have only text editors and gimp (+ photoshop but not very offten), no apache (webserwer component) or any database. Next to me in a corner is x31 with lamp appliance installed on it.

Because of that my desktop computer is light and i cane access websites on my local server via local network from any computer, also paths to files are relative to the _remote server_, and not to your file system. That scenario way better simulates real world situation, than apache running on your local system. (Of course you cane mount server`s file system into dir of your desktop machine.)

For extra security and comfort (egz. remote access) you might put the serwer ip into so called DMZ zone on your router.

cheers !

Great, so its just a matter

Great, so its just a matter of getting my IDE to see the content on the other server. I think I can just map the drive or something and see if that works. Thanks. If anyone else has anything to chime in, just add your comment, too.

IDE ?

What do you mean by IDE ?

Btw: Here is tutorial how to setup virtual machine so you might not need separate computer any more for server. http://www.turnkeylinux.org/docs/instalation-appliances-virtualbox

IDE

IDE stands for Integrated Developement Environment.  It is a type of software used for developing software and web applications.  Usually includes a code editor, database management features, integrated FTP, etc.

Liraz Siri's picture

Recommended you install appliances in a Virtual Machine

Software appliances are a relatively new concept so your confusion regarding workflow is unfortunately rather common. I've tried to explain that before the forums. For example, see "How do I use TurnKey appliances?"

Hope that helps.

Our appliances can easily be installed to an old laptop or PC box but its really much more convenient as szczym already pointed out to install them inside a virtual machine such as VirtualBox.

Thanks to szczym, there is now a great HOWTO on how to do that for those who are unfamiliar with the software. It's really very simple once you figure out the basics.

Well, I got the application

Well, I got the application to run fine, but it was more a matter of developing on the turnkey appliance. I mean, with content management systems like Joomla or Wordpress, merely having the appliance running is good enough because then you just surf to the appliance's IP address, login and you can start messing around by adding articles and such. With Rails, you really need to set up your IDE (integrated development environment) to see the remote filesystem, and treat it like you are editing the files locally. I think I have it figured out, though. Rather than having to start a webserver (see: webbrick) when developing locally, I can make the changes to the Ruby on Rails app, then just surf to the Appliance IP and see it working right away. Maybe if I thought about this a little more from the get-go it would have popped into my head that way.... thanks for all the support. These ISOs are really great and a fantastic way to get your feet wet in a multitude of different platforms.
Liraz Siri's picture

Details on Rails workflow and ideas for improvement

What you say about getting the IDE to "see" the remote filesystem is interesting. Could you share a bit more detail on that? Perhaps we could make changes to the appliance to make the kind of workflow you describe a bit easier to setup? We're always on the lookout for good ideas.

Let's say I have a host that

Let's say I have a host that supports Ruby on Rails and I have access to an FTP through them. With Aptana Studios' RadRails package (aptana.com), you would want to map the FTP to a drive letter (Z, for instance).

Then you need to create a new Ruby on Rails project. So in RadRails you can just do the normal File>New Project... kinda thing. You want to put the new project on the FTP you just mapped: "Z:/SomeProject".

Because you have a host that is serving your application, you dont NEED the project to include its own server to run locally. Therefore, while many tutorials (http://www.aptana.com/docs/index.php/Starting_a_new_RadRails_project) say you should tell RadRails to install a WebBrick server or Mongrel server, you don't need to.

Since you have the source files mapped to this drive (Z), you can just edit them as any local file. HOWEVER, you dont have things set up for correct editing on the database. This means that if you run Ruby commands that require updating the database (basically any comment, but especially like RAKE and such), it's not going to work.

What you want to do is go into your ~/SomeProject/config/database.yml file and edit some of the configuration to reflect what your host has setup for your service:
  • database
  • host
  • username
  • password


**NOTE: lots of times your host remains "localhost" (to your webhost) it IS their local server. This is what gets complicated. If you were editing LOCAL FILES but wanted to reference a REMOTE database, you might change this to something like myusername.bluehost.com.

I know this is really garbled and probably doesn't give you guys much to work on, but understanding how to work on REMOTE applications is something I dont think ANY RoR community discusses. Its always "oh, you just create an application on your local filesystem and run Mongrel locally". But that doesn't help new people understand how they might migrate to a real production setting (e.g. NOT their laptop, ;P )

SMB Solution

I use a variety of virtualization engines to run Rails appliances.  Traditionally I have used SMB to make the root of the development environment (/var/www/railsapp in this case) available for my development tool (TextMate on OS X).  Then I keep 1-2 ssh sessions open during development for migrations and interactive ruby shell tests and commands.  When it's time to deploy the app, I comment out the SMB shares, restart SMB and deploy.

Starting a project with Eclipse/Aptana

Hi there,

I´m a Rails (and also Ruby) beginner and I try to set up a new Rails Project with Eclipse/Aptana (Windows 7) on the TurnKey VM.

By the way, I think for the most Windows users who are not familiar with Linux and Samba etc. the easiest way to mount the project folder is to use a Freeware like "SFTP Net Drive".

By now, I tried serveral ways to set up a new Project. If I move the /var/www/railsapp folder and create a new project there, I got different errors if I browse to http://[ip of appliance]/railsapp

I copied /config/database.yml from the original railsapp folder to the new created one. The gem mysql2 is installed. I added the line "gem 'mysql2'" to the file /railsapp/gemfile.

The error I get is:

There was an error while trying to write to Gemfile.lock. It is likely that you need to allow write permissions for the file at path: /var/www/railsapp/Gemfile.lock (Bundler::InstallError)

After that, I set "chmod 777 railsapp" (ok, I know in general this is a realy bad idea, but I had to try^^).

Now I get this error:

/var/www/railsapp/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end ...sion_store :cookie_store, key: '_railsapp_session' ^

Because I´m realy new to this, I have no idea now what to try next. Maybe, my general understanding of the Rails concept is a little low (can I set up serveral apps in different folders in my www root and if this is possible, where do I have to config this?) Maybe this question is not at the right place here, but I would realy be happy to get the blank project I build from Eclipse starting without errors.

I also hope my diction is not to bad as I realize my english writing is.. lets say a little rusty. Sorry for that! ;)

Thanks for your answers in advance!

cheers

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)