Should my production Rails project use GIT? it will be easy for me to update the
servers and to push hot fixes, but what if I'll have a conflict during a pull?
and if I'll accidentally pull something wrong it make cause some downtime.
What is your advice on how to synch between the GIT repository & production?
Thanks
How about using a dedicated deployment system like Capistrano? It solves many of the issues you are trying to avoid.
Don't leave local changes on your production machines, and there is no risk of conflicts.
Production installs should pull from a dedicated branch/tag (e.g. use gitflow, production machines pull from the latest tag or simply master) - not the branch you regularly push to (develop, if you use git-flow).
Related
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!
I have built a Rails application in a Linux environment but spent the last 2-3 weeks converting the application to work in a Windows environment for production (not my idea, I assure you).
I am using git and now have two branches of the same application, one that is configured to use jRuby on Windows with IIS8 and a MSSQL Server backend and the other which uses Ruby, a WEBrick app server and sqlite3 database for development/test.
I would like to continue using the linux environment for dev and test but will need to then combine my findings into my Windows branch.
I am hoping there is a way to create a branch using my linux environment, make changes to my app/ folder (which contains the brunt of the application) and then merge only those changes into my Windows branch. The issue here being if I merge normally, I will overwrite my files configured for Windows.
There are only a few main files I do NOT want merged with my Windows branch:
Gemfile
config/applciation.rb
config/initializers/assets.rb
config/database.yml
to name a few.
Does anyone have any idea how I might do this?
One approach would be to cherry-pick relevant commits. Another solution would be to have a core-repo and a repo for each plattform that you support and use git submodules to incoperate core.
But I agree with #mudasobwa, using configuration to switch implementation is much simpler and cleaner.
I'm trying to deploy my application to production on my laptop but i keep getting a
No application found matching remotes:
git#github.com:this_is_the_old_github_remote/Application.git
so this used to be the old remote but it was recently changed
so this makes sense but how do I fix this issue and tell it to go to the new one
There are a couple of ways to work around this issue.
Update the repository's config to have the proper URL for your remote branch.
Tell the ey cli tool which application and environment you are trying to deploy to.
The first method is probably better so you do not have to worry about this in the future.
To update your repository configuration you simply need to run git remote set-url origin https://url.to/new/repo/Applicatoin.git
Once the repository in your git configuration and the Engine Yard dashboard match, you should be able to deploy normally.
To work around this issue via the Engine Yard CLI utility, you will need to run ey deploy --app=<Application Name> --environment=<Environment Name>.
Please keep in mind, regardless of which method above you use to work around this issue, Engine Yard's automation will pull the application from the repository you configured via the dashboard.
Updating the remote on your git configuration does not update Engine Yard's configuration.
If your local copy of the repository has changes that have not been pushed to the remote repository configured at Engine Yard, the changes will not propagate to your instances.
If you continue to run into any issues deploying, please feel free to contact us via http://support.cloud.engineyard.com or in IRC on irc.freenode.net in #EngineYard.
I am developing a ruby on rails website using heroku and git.
What tools and features should I use to set up the following simple development process?
CODE > CHECK-IN > AUTO TEST > AUTO DEPLOY
I check my code into my repository (preferred option, hosted git like github)
Tests are automatically run AND website is deployed in my staging heroku app
If tests pass, the website is automatically deployed on my production heroku app
If tests fail, I want to be notified somehow.
How would you do this?
CircleCi offers exactly what you need. We'll run your tests on every push, deploy them if they pass (to Heroku or using Capistrano/Fabric/anything really), and send you notifications if they fail.
to preface I am one of the founders of Codeship (https://codeship.io), which is a service that supports exactly this.
But more on topic, basically there are 2 different ways I think this could be implemented (please keep in mind that all branch names I use are arbitrary and can be named totally different):
staging/production in one go
Whenever you push to your master or a specific deploy branch you run your tests and if all of them pass you first deploy to your staging app, run separate tests (Selenium or sauce labs is great for that) and if that works out including migrations you push to your production app.
This is great as the latest version is always available in production and we use this cycle for a long time now. Works great for us. The downside is that pushing to a staging heroku app takes some time. If you want to run the migrations against a copy of your production data this takes even more time. It's not an eternity, but it takes a couple of minutes.
staging/production as separate steps
You could have separate staging/production branches which are deployed to the respective heroku applications. This has the advantage of being faster and you can control when to release certain parts. Especially for applications where you want external feedback before deploying to production this works great.
We support all of that at Railsonfire, but we are currently working on a new version of our service which is way better. We integrate really well with Heroku so you don't have to think about that (but still have the option to do it yourself in any way you want)
We use Integrity. It is a pretty simple solution - it won't do everything under the sun, but it's quite easy to set up and handles the most common use cases/features. It's also pretty easy to hack on, if you want it to do more.
Integrity states:
Heroku is the easiest and fastest way to deploy Integrity.
However:
NOTE
It isn’t possible to access repositories over SSH on Heroku
This is because your Integrity app will need an SSH key. It's not impossible, but definitely a few hoops to jump through. You'll need to give Integrity a private key and put it in the app, and then hack Integrity to use that ssh key when it initiates the git clone.
Of the things you listed, the automatic deploy is probably the thing most people would not expect their CI server to do (and Integrity does not provide out of the box). You'll need to configure git to use that ssh key and initiate a git push from the proper location (the checked out repository).
Unfortunately I don't know the details of how to do this--we actually run Integrity on a VPS.
There are many tools in the market that do this. SnapCI offers deployment pipelines that let you push every commit through tests and then subsequently into staging and production as different stages of a deployment pipeline. We also have full support for test parallelization, building branches and pull-requests.
Well, there is Hudson which provides a git plugin as well as scripting support. The rest is configuration, I would guess.
Hudson: http://hudson.dev.java.net
Try Heroku-Bartender. A write-up here.
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.