Ruby on Rails - Capistrano and SVN on Windows. Setup help - ruby-on-rails

I have Subversion setup and running on my local network with windows and svnserve. I'd like to use Capistrano to deploy to a remote ubuntu server but am a bit on unsure on what I need to do to get the client end to work on windows. My understanding is that the remote server needs to be able to tunnel into my subversion server. I've read over a few tutorials but either they or I get all turned around about when they are talking about my local system, my svn server, or my remote system and of course almost none of them talk about capistrano and windows together.
Do I need to setup Apache to serve my subversion repository? I'd rather not but if I must what are the steps?
I found this tutorial but I have no idea if it will enable ssh access to the repository

You could try having capistrano checkout your code locally, zip and send it to the server. This isn't as efficient has having the server access svn because it has to send the entire codebase every time, but it will save you the trouble of exposing your repository to the outside.
From this page on the capistrano website, under Deployment Strategies:
set :deploy_via, :copy
set :copy_strategy, :export
set :copy_compression, :zip
You will need a command line zip utility available to make this work. The Info-Zip FTP site has one available.

I'm not a Windows person, but my understanding is that in Capistrano's normal state, it executes all of its commands on the server. That is why it needs to be able to pull the code via SVN from your machine.
Looking at that tutorial, it appears as though it is using Apache as the mechanism to allow a client(in this case Capistrano) to pull source code from your Windows machine. This will work for what you want to do.
You don't have to setup Apache in order to accomplish this, you could probably setup an SSH server on your Windows machine, though that is out of my realm of knowledge. :-)

Related

Setup Redmine & plugins on local machine then deploy to Linux server, possible?

I am new to Ruby on Rails. My questions is:
Is it possible to setup Redmine and install the plugins on my local machine (macOS Sierra), test the Redmine application on localhost, once everything has been done successfully, then only deploy it on a Linux server?
If it is possible, which part of the code should I modify in order to deploy it on Linux server successfully? (Both of my local machine and Linux server are running MySQL database)
Yes it is possible and you don't need to change any part of the Redmine code to do so. Deployment of Rails apps is often done with a tool called Capistrano (http://capistranorb.com/), which executes through ssh on your server, checks out the code and does any additional installation steps necessary. This approach requires you to have your app (Redmine and plugins in your case) in a git repository (or subversion etc). In the simplest case, fork redmine on github and add any plugins as git submodules.
As you're unfamiliar with the platform I'd suggest to start with a simple rails app that you create locally. once you have worked out deployment of that to a remote server, tackle Redmine.
Sounds like a lot of upfront effort but it's worth it since it enables you to work on your local machine, make changes and then deploy the changed code with a single command.
If the Redmine installation on your local host has the same installation path as on the production server, then you can just copy the installation files to the production server. You will also have to copy the database to the production server.
If the installation path is different on your local host and production server, then you will have to install the Redmine and plugin on your production server

Using capistrano to deploy same project from different machines

We have a team of 2 people writing Rails application. We use DigitalOcean as of VPS and capistrano to deploy it.
But the capistrano deployment scripts are only on one of our two machines.
Is it possible to set up capistrano on the second machine to deploy same project also from it? If yes, how this looks like?
P.S. This might be very easy like adding some SSH keys and running cap production deploy from second machine as the remote VPS has whole infrastructure set up. But we can't take the risk on production system.
There are a couple ways of doing this:
Commit your Cap scripts to the repository alongside your code (this is how I tend to do it; it works well with Ruby on Rails, the config structure matches). Anyone who wants to deploy just needs their SSH key set up on the server.
Create another repository with the deploy scripts; similarly to above, you need SSH keys.
Use a CI server to deploy.
Come up with something else more esoteric. Capistrano is pretty flexible.
Where I work, we generally just add Capistrano to a Rails app's Gemfile, and anyone who checks it out can deploy it to any server to which they have access. Developer SSH keys are added to the servers for this purpose.
Good luck!

does RoR develpment need shell access?

let's say that RoR development environment is set up and working
does the developer need shell access to develop the RoR application?
would ftp be good enough?
why? I don't want to give my future developers ssh access to my linux box. Or can I set up their file permission so they can read only their project directory?
UPDATE
the whole idea is to have below running on my VPS linux hosting
code repository
production environment
test environment
maybe development environment
for
few projects
that are looked after by different people
so I want the developers to be able to do their job and only be able to access their project files and maybe only I would be able do to deployment into production from test environment
As Tom mentioned, it makes life a lot easier on Rails developers if they have ssh access to the machine so they can migrate the database, run bundle install, check the logs, or just jump into console.
There are ways to segregate users though, through file/directory permissions, chroot, or but making your linux machine a bunch of virtual machines and giving them their own
You can take a look at how Heroku's client works for possible ideas, since Rails developers are able to deploy, migrate, check logs, and even get into the console without direct shell access. Deployment is all done via git hooks and then their client gives access to particular commands. This is not trivial to set up/get working, though.
Well it does not REQUIRE shell access, but it sure makes it easier.
Without it how can you migrate a db? You would have to manually create controllers, models, etc.
Short answer, you CAN develop without shell access, it is just awkward and more tedious.
This is a common situation - for instance, Network Solutions allows you to do the basic RoR install but only gives ssh access if you step up and pay extra for a VM hosting package. My suggestion is to create the app on a local machine, of course using shell commands, then FTP mirror the files up, then use mysqldump to export the local database. NSI allows you a database console whereby you can then import your database dump file. You will probably have to edit config/database.yml since the host database server is unlikely to be localhost. If the necessary gems aren't present, you will have to plead with your hosting customer service.

How do you deploy your Rails application?

Do you upload your rail application to your host via FTP first?
I'm currently using Passenger and Capistrano. If I do "cap deploy" in my local machine then I think Capistrano should upload my rail application to my host, right?
Someone from my host is saying that I need to run "cap deploy" in server. I think it doesn't make sense.
You should be able to run cap deloy on your local machine and that should get the current version of your software to the server. However, you need to set up first how this is supposed to happen. I for example use Git to manage my code and also use it to get my software on the server. However, you could also use SVN or FTP if you prefer that. If you google for Capistrano together with the Software youbeant to transfer the code with and maybe even your hosting providers name, you probably will find a decent step by step explanation. For me John Numemaker's post on deploying with Capistrano and Git on Dreamhost really helped: http://railstips.org/blog/archives/2008/12/14/deploying-rails-on-dreamhost-with-passenger/
As an alternative you also might want to check out heroku.com. Their smallest offer is free and enough for most projects. The deployment process is so easy a monkey could deploy a Rails app on their platform. I generally can only recommend heroku.

Version Control and Deploy Rails Project with cPanel

In my server, what option i got is a basic unlimited server can host unlimited rails project
possible to manage gem because it is using cpanel latest version with a ssh
now my confuse is ,
how can i use the no ssh feature in the cpanel and ease my deployment ?
i don't know is that possible to use the capistrano and git with it
any guidance for this ? to make it possible to update with git push feature
i never deploy anything before ,
i tried to use heroku but i don't know why many user can make their file fit the 5mb space...
my project is now 30% at progress but the space used was 14mb...
so, i bought a cheap standard web server with cpanel . any one could help me in this case ?
usually how you guy deploy and where you deploy ?
recently one guy gave me a link for the github deployment, is that possible to make github use in the cpanel server ?
i mean like host and push the file into github and then link to the personal server ?
anyway, thx for person who reply me recently ^.^
i just develop for hobby...any cheap rails server suggest ?
Thx a lot for reply~
You could also try heroku (www.heroku.com) as a hosting platform. It has a simple deployment workflow that uses git.
Unelss you've done it already, you'll need to install git on your local machine.
Here's a bit about capistrano too.
Capistrano is basically a series of scripts (that you run from your local machine) that get your code and put it on your web server(s). You can configure capistrano to either check out your code from git on the production server, or to copy your code from your local machine.

Resources