Preparing an Installation and Installing on client machine - ruby-on-rails

As I have done my first project on Ruby on Rails.
I want to know what should I do to prepare installation from my machine the code i generated in a project and other thing is that what should I do to install that all on client machine the I prepare from my machine.

You should probably put your code in a repository - probably git via GitHub is best. If the setup is going to be different then perhaps gitignore the database.yml but include a .sample of it. Then to install on someone's machine just checkout the repo bundle install and run the relevant rake tasks (db:setup probably).
Updates can then be applied by pulling from the repo.
Other than that zip it up and unzip on there machine making sure to install everything required.

Related

Does it make a difference where Git is installed

I was reading a blog post about installing git, and it says it will be installed in /usr/bin/git
When I check my version using $ which git, terminal shows /usr/local/bin/git. Same result when I checked for Ruby. Does it make different where Git, Ruby or Rails are installed? Can I change that if it's possible?
Normally, it should not matter. But, usually, /usr/local/bin is ahead of /usr/bin in the PATH environment variable. So, in future, if another version of the same software, lets say git, is installed into /usr/local/bin, that will take precedence over the one installed in /usr/bin. You can of course manipulate your PATH environment variable to suite your needs.
run this command to see if multiple versions of git have been installed
which -a git
It does not matter as long as all of them are accessible in your PATH for commands.
Is your concern about where the actual repositories will be located - the place where GIT repositories are located is not necessarily the same place where GIT itself is installed.
You probably could change it. It might not be worth it.
It will probably be easier just to leave it and remember.
This is sorta like windows install path. Default will be "Program Files" but it often can be changed.
Note that different versions of Windows have differently named program files. This can be an example of such differences also.
Finally it could be that your ruby installed GIT, and that is the path that Ruby chose.
As long as /usr/local/bin/git is in your PATH you should not notice any differences.

How do I run my own bower server

I'd like to run my own bower server to start sharing a couple of internal modules across teams. I'm having a very hard time finding the information for running your own server. On the bower.io site there is this line
N.B. To run your own Bower Endpoint for custom packages that are
behind a firewall, you can use a simple implementation of the Bower
Server.
With a link to Bower Server
Do I simply clone that repo and 'run it'? I'm not a ruby guy at all so I'm not even sure what run it means.
That repo is a Sinatra app, so you need to git clone it, run bundle install in its directory, and run 'ruby application.rb`. Comment on this answer if you need more details.
There is also a node server, which I have never used and cannot comment on its quality - https://npmjs.org/package/bower-server
I guess there is a PHP one also - https://github.com/indieisaconcept/slim-bower-server
EDITS:
Some links for Ruby n00bs
http://bundler.io/
http://www.sinatrarb.com/intro.html

Can't push to git hub

I just completed Chapter One of the Ruby on Rails Tutorial by Hartl. Posted about one minor hitch previously. Now I started Chapter Two. I swear I did everything by the book, but now when I try:
git push -u origin master
I get the following messages after entering my passphrase:
ERROR: repository not found
fatal: could not read from remote repository
Please make sure you have the correct access rights and that the repository exists.
When I down loaded heroku tools I think it installed a second version of Ruby on my machine. In any case I now have two version listed under All Programs. Could this have screwed thing up? The two versions are Ruby 1.9.2-p290 and 1.9.3-p327. Also when I open the command prompt using 1.9.2 there is a weird thing at the top before I do anything:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
This is then followed by the normal prompt on the next line. I'm wondering if the use of my public keys have some how gotten screwed up.
Any help would be appreciated.
You should add a new git remote.
check https://help.github.com/articles/adding-a-remote
So i had problems with windows and multiple versions of ruby too. I would recommend deinstalling all versions and only installing one ruby version. But thats not related to your Github problem i guess.
Switch via the commandline to your app folder and checkout:
git remote -v
it shows you what is the remote location for you app. And 5 bucks that its screwd up. You can remove the path by:
git remote rm origin
or if its only on heroku:
git remote rm heroku
and after that add the correct remote path again. Example:
git remote add origin git#github.com:foo/bar.git
That hopefuly fix it.
And keep in mind if you want to push to heroku use:
git push heroku master

is symfony system wide?

i have a directory with some .php files in it...do i need to install symfony in that directory so that i can run symfony commands from that directory?? i tried: pear channel-discover pear.symfony-project.com
and got:
Channel "pear.symfony-project.com" is already initialized
the i tried: pear install symfony/symfony
and got:
WARNING: configuration download directory "/build/buildd/php5-5.3.2/pear-build-download" is not writeable. Change download_dir config variable to a writeable dir to avoid this warning
Cannot install, php_dir for channel "pear.symfony-project.com" is not writeable by the current user
how do i fix this please? must i run it as sudo??
thanks
If I remember well, Symfony is "system-wide" if installed through PEAR (like you are trying to do).
Now it is recommended by the manual to do a "standalone" install through SVN. See http://www.symfony-project.org/gentle-introduction/1_4/en/03-Running-Symfony
As well, the sandbox will bring a "standalone" installation of Symfony (you will have to be in the project root directory to be able to run the symfony commands)
EDIT
Example of quick install using SVN:
mkdir /path/to/symfony
cd /path/to/symfony
svn checkout http://svn.symfony-project.com/tags/RELEASE_1_4_0 .
but it should be better to follow the manual and configure the external SVN sources.
I run servers where I have applications that use different versions of symfony simultaneously. I found it much easier to deal with the SVN checkout than the PEAR insteall.
So what I've done is do an SVN checkout of each revision that I need
into it's own folder. In my case i check them out to
/usr/share/symfony/(version)
Then I configure the ProjectConfiguration.class.php to reference whatever version is needed, using the line:
require_once '/usr/share/symfony/1.x.x/lib/autoload/sfCoreAutoload.class.php';
If I need to switch to a different symfony version, I can just change that config.
That is, assuming all my code is compatible with that version

git clone problem

i have create clone of project on local machine with
git clone git#github.com:test/abc.git
Now i want to deploy my project on my ubuntu server .
so i have created a script which install git on my ubuntu server.
And now i want to deploy my rails project on server.
like git clone git#github.com:test/abc.git but i have not set ssh key on my server.
Is there any way i can create clone without set up ssh key on my server.
Is compulsotion that we have to create to ssh each on every server?
What if i have 20 server ? i need to set up ssh key for every server to clone?
Is there any way just ask the password than it will create a clone?
Or any other way?
You can use the read-only version. Next to the name of your repository you can select the http protocol. This url can be used without ssh key. If it is a private repository you'll need to add your username to the url.
$ git clone http://myname#github.com:test/abc.git
Initialized empty Git repository in /Users/myname/Projects/abc/.git/
password:
Then you type your password and a bit later you have your clone. A disadvantage is that you need to enter your password if you use a private repo.
Although I fail to see the problem of adding a few ssh-keys. If you really need to deploy to 20 servers you might consider thinking of using a packaging method with good OS support for automatic updating.
It is a mistake to try to use a configuration management tool in order to deploy an installation. Do you really intend to update the code from each of those 20 systems? Why then are you granting them write access to the code?
Create a tarball or use whatever package management systems are available in the language you are developing in (e.g. in Perl, you could use Dist::Zilla, Module::Install or ExtUtils::MakeMaker).
We created a php script which built RPMs (and Using Alien also built DEBs) for updating our 200+ machine fleet. As a url like "http://repo/fetch/rpm/" was called a script checked if there had been a new git tag inserted in package_name repository and if so use an RPM template we created on a per repo basis (typically put in .build/rpm.spec) to build the RPM, save it to a local cache directory and read the contents out as a file header.
I realize for your application that won't work since you're using GitHub - but it's just an idea for those who have their own remote repositories. A cron on the boxes would query once a day those URLs and run rpm -Uvh on the output.
For your instance it might be wise to tarball each release and either put that in a public accessible URL or create a script to rsync it to each server + exec
If you're deploying rails projects, you should check out Capistrano - http://www.capify.org/index.php/Getting_Started

Resources