small medium large xlarge

Generic-user-small
07 Apr 2011, 16:20
Kasper Timm Hansen (2 posts)

Hi

I’m trying to work my way through the chapter on deployment, but I’m finding it very hard. It seems that the authors assumes a bunch of stuff about me and my skill level with setting up a server on my Mac. I have never tried anything like that, this is some of my first exposure to Rails. Anyway my problem is getting the MySQL database to work. I have added the database to my Gemfile (group :production do gem ‘mysql’ end).

“Install the gem using bundle install. You may need to locate and install the MySQL database development files for your operating system first. On Ubuntu, for example, you will need to install libmysqlclient-dev. You can use the mysql command-line client to create your database, or if you’re more comfortable with tools such as phpmyadmin or CocoaMySQL, go for it.”

Especially this paragraph is hard for me to understand: what are you supposed to do? Do you type: “bundle install” and no parameters or nothing in terminal? (That’s what I did.) So I tried using “mysql -u root” but the system said command not found. I don’t know what to do. Now I’m thinking I need to find those development files as mentioned above, but where are those?

Well… I’m all up in arms. I’d greatly appreciate it if someone knew what to do, or had any suggestions.

Thank you in advance, Timm.

Nho-250x375_pragsmall
08 Apr 2011, 14:15
Niels Holst (7 posts)

I have not come as far as you but I do foresee the exact same kind of problem (hence my post to this forum yesterday). Task K leaves me as bewildered as you. What? Am I supposed to be running my own Internet server? Surely for some of the intended audience this is the case. But what about the rest of us, hobbyist or professionals, not supported by a hot IT unit?

What I would really like to see is a description how to deploy the depot app to a few commercial companies providing Rails. Or, as not to point out specific companies, a description of the typical steps involved.

Generic-user-small
10 Apr 2011, 15:44
Kasper Timm Hansen (2 posts)

Indeed, it would be a most welcome change, Niels.

Well anyway… It turns out my server is running fine. It’s MySQL that I just can’t seem to get up and running. This is the best I’ve got so far: http://everydayrails.com/2010/06/28/rvm-gemsets-rails3.html

In this guide it says that I should run: export ARCHFLAGS=”-arch x86_64” ; gem install mysql – –with-mysql-config=/usr/local/mysql/bin/mysql_config

But whenever I do this, this is what I get: ERROR: While executing gem … (Errno::EACCES) Permission denied - /Users/kasperhansen/.rvm/gems/ruby-1.9.2-p0/gems/mysql-2.8.1/COPYING

I simply can’t this to work, and there’s nowhere to find help… I hate this.

Generic-user-small
10 Apr 2011, 17:36
Scott White (6 posts)

Kasper,

As someone who has worked with Macs as servers, Apple’s implementation of various server technologies can be very frustrating. Mac as a desktop platform is great, but their philosophy of minimal configuration just doesn’t lend itself to server applications. They dropped the Xserve RAID in 2008, then came the end of the Xserve in January of this year. In Lion, there will no longer be a separate server edition of OS X. Whether it’s MySQL, Java, Tomcat, LDAP, or some other service, I have found that they all have their quirks on the Mac.

I use a Mac at work and at home for my primary desktop, and for project development I find virtualization to work wonderfully. The major benefits of virtual machines are portability, being able to move the VM from one host to the other, and snapshots which allow you to save the entire state of a VM and roll back to it later if something goes wrong.

For the Mac, you can use VMWare ($80), Parallels ($80), or VirtualBox (free!). I’m personally going through the Agile Rails book using an Ubuntu 10.10 virtual machine hosted by VirtualBox with my Mac as the host. Either Fedora or Ubuntu are easy to use as Rails servers, as all the things you need are easily installed via the official repositories.

Just a suggestion, good luck!

-Scott

Nho-250x375_pragsmall
11 Apr 2011, 07:58
Niels Holst (7 posts)

Scott, Thanks for the insight. So, if I deploy a Rails app to a virtual machine on my desktop computer, how can I then later on port that to a real server on Internet? That step is still a black box to me. Am I being too naive here? Maybe there is no general answer to my question, and I just have to contact some Internet suppliers and follow whatever they have of guidelines. In that case, I would hope that someone reading this has already been through the effort and found a cheap and easily accessible host for our wonderful Rails apps. Anyone? -Niels

Nho-250x375_pragsmall
11 Apr 2011, 09:38
Niels Holst (7 posts)

Oh, the adventure begins here at “RailsHosting”http://www.railshosting.org – this will keep me busy quite a while. I better finish my depot thing before throwing myself into this. -Niels

Generic-user-small
12 Apr 2011, 21:51
Scott White (6 posts)

Niels,

I just read through the deployment steps in Iteration K, and although I haven’t gotten there yet I think it would actually be a good simulation to follow those steps and deploy what you have so far (or when you get to Iteration K) on your machine to a virtual Linux-based machine (like Ubuntu).

After installing the VM, you would first need to install and setup MySQL, Rails, and Phusion Passenger. From there, you would follow the steps in Iteration K using your VM’s IP address (or hostname) as the ServerName. Going through those steps would be nearly identical to what you would do on a hosted server that you could worry about later and is as simple as repeating the steps from the “fake” VM server to your new hosted one. Like the book states in K2, it is a very good idea to make sure you’ve got your code under version control (or at least backed up) before deployment.

Once your code resides on the VM, you can simply SSH into the VM to run your Rails commands from the Terminal application on your Mac. You can also use something like TextWrangler on the Mac to open the source code files on the VM via SFTP.

-Scott

Nho-250x375_pragsmall
13 Apr 2011, 12:47
Niels Holst (7 posts)

Thanks, Scott, I will report back here how it fares. In fact, I am so anxious about deployment that I will try deploying my depot in the completed Task A version. I bought a 5 USD per month account at railshosting. Their documentation looks impressive. -Niels.

You must be logged in to comment