I'm trying to test some changes out on production without having to commit and push the changes because I only want to commit what actually works. The project I'm working on was created with Rails (3.0.2), and deploys with Capistrano (3.1). I've tried making changes in the root folder of my app and redeploying, and the changes are not reflected on the website. I've tried making changes in the root/current directory and redeploying and that didn't work.
Is there any way I can redeploy changes to the server without having to push it to Github first?
Is there any way I can redeploy changes to the server without having
to push it to Github first?
No this isn't possible since one of the first things that Capistrano will do is git clone the latest from whatever branch you've specified in your deploy config.
I'm not sure what your familiarity with Rails is but the proper way to do this would be to create a new staging environment and deploy to that. The staging environment would have similar settings to your production environment with a separate database so that you don't affect production data.
Capistrano 3 supports this flow out of the box so that once you've set everything up you can simply call
cap staging deploy
to deploy to the staging environment, and
cap production deploy
to deploy to the production environment.
Related
I have a Rails application which I deployed to a remote server with git and Capistrano 3. It works fine.
Sometimes after I change some files (in app/views, for example), I want to upload those changes to the current release without running the full cycle of deploy process.
I need one command to upload changed files (files in the last commit in git) to the current release directory on the remote server.
What is the best way to do it?
Improve Performance with Remote Cache
The way Capistrano works, it will create a new clone/export of your repository on every deploy. That can be slow, so there’s an option to add some extra commands to our deploy.rb recipe to speed things up. Add the following to the section of your deploy.rb where you describe your scm settings: set :deploy_via, :remote_cache
This command makes Capistrano do a single clone/checkout of your repository on your server the first time, then do an svn up or git pull on every deploy instead of doing an entire clone/export. If you deploy often, you’ll notice that this speeds up your deployments significantly.
Hope this help you what you are looking for!!!
For more detail check out this link. deploy-with-capistrano
How is a test site created with Rails 4?
I'm building a Rails 4 app. I develop locally, have a github repo, and have a live production Heroku site.
Now I want a 'test' or 'dev' site that is on the web, so all the employees working with the app can see features even before they are rolled out.
It sounds like a standard enough issue that I suspect Rails has some built in approach, making use of the "dev", "test, and "production" environment variables.
Heroku has a methodology for this --
https://devcenter.heroku.com/articles/multiple-environments
I prefer to use standard git mechanics to control the flow. On a web application we develop this really helps us. We have a reasonable sized team and what we do is:
Create a feature branch (tools like git-flow can help with keeping standards in your team)
When done we push up to our git remote, create a pull request and someone reviews the contribution. Once the changes are good they get merged into master.
As part of continuous integration (after our specs are run successfully) we have a simple Jenkins job that clean rebases into the appropriate branch and pushes to the remote.
Everyone has their own flow, but you can use your master branch as development then when you're ready merge/rebase into your other environment branches.
On your destination Rails platform (in my case Ninefold, because it's really easy), pick the branch and deploy. On Ninefold as soon as you push to your branch your app is redeployed via a Post-receive hook.
We configure up the application's environment by passing RAILS_ENV=staging / RAILS_ENV=production, and ensure you have an appropriate (environment).rb file with all the relevant settings for your environment.
We have a Rails app that's deployed on two servers. One server uses the master branch while the other uses the staging branch. We use staging internally to test the application, and then we merge with master and deploy.
The staging branch has different email settings in config/production.rb than the master branch. How can I maintain different production.rb/email settings for each branch while still merging everything else?
Adding the file to .gitignore would pull it from the repo, so that's not an option.
Make another environment called staging.
Other option is to put the environment file in shared folder on server and link to it while deploying.
Dont put these settings into production.rb. Use an initializer file in config/initializers/email.rb (or something like that) to set these initial settings based on Rails.env
I want to setup Elastic Beanstalk for my existing rails application.
I was successful in doing the sample foo app.
These are the questions I have
I need the deployment to happen from my git repository and not from my local path where I am deploying. How do I do that for the sample foo app.
I need to have a before_symlink deploy hook. How can I do this ?
I have addressed these issues.
git aws.push takes all the commited things to git and then deploys it. Local changes are not impacted.
Created a config file under .ebextensions
More here - http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/customize-containers.html
Is it possible to get Capistrano to update a currently deployed app with a migration (that's all that has been committed as a change since last deployment), update the deployed app with just this code (without running a new full deployment) and just run the migration?
A deployment is what it is, a deployment.
You are asking to deploy without deploying (!?)
IMHO, your issue is more related to SCM (svn, git, etc...) than to capistrano.
You probably want to deploy part of your code (one migration) but not everything that is committed to trunk/master. What you have to do is to branch/tag for deployment, and deploy from that branch/tag.
For example, if I'm using svn I always add these lines to my deploy.rb:
set(:tag) { Capistrano::CLI.ui.ask("Tag to deploy: ") }
set(:repository) { "#{repository_root}/tags/#{tag}" }
this way I can deploy a particular tag and my SVN has clearly defined my production code.
In your case, the procedure would be:
branch your last production revision
apply any changes to this branch (your desired migration)
tag it (for example, prod-with_my_desired_migration)
deploy that tag including cap deploy:migrate
Every tool has its purpose and we have to leverage the power of each of them.