I am trying to deploy the changes in the repo I made locally(merged master to local branch), but while the changes work on localhost, it does not update in the deployment, using bundle exec cap preproduction deploy.
I am new using capistrano.
Any idea what I am doing wrong?
Thanks
Related
I've setup an app on Heroku, and I've now also set up a pipeline for staging. I did this by creating a fork of my production app on Heroku, then adding this to the app pipeline under the "staging" stage.
Before this (when I only had the app in production), I pushed updates to heroku from the CLI with git push heroku master. I could then update the database for new features with heroku run rake db:migrate.
However, I'm not sure how you would do this with a staging app in a pipeline? I tried using the --remote appendage but it doesn't recognise the app (I think because the --remote was pre pipelines?)
I have auto updates from git setup so that my app-staging always mirrors my git master, and I've just added a new feature which includes a table. The view on the staging site is now returning an error as I haven't run heroku run rake db:migrate on the staging site.
I obviously don't want to push these changes to production without know this new feature works. So how do you do it? Any ideas how to rake db:migrate the pipeline staging database? I can't find any guidance in the heroku manual either :/
Run
git remote -v
to see your remote name.
Assuming your staging remote name is staging, then:
heroku run rake db:migrate --remote staging
Read more
I have a very small app that even uses sqlite3 in production because there are never going to be any issues with multiple writes, etc. I want to use capistrano to quickly and painlessly deploy updates to this app. But when I run cap production deploy it dumps the entire app into a release folder and symlinks it to current. I know I can include the production.sqlite3 file in the deploy.rb to keep the data but it still seems overkill to clone the entire repo every time I want to push an update.
I couldn't find anything in the capistrano documentation for updates.
Essentially all I need cap to do is
make sure my local git HEAD is the same as master
SSH into the prod server and do a git pull
Run rake db:migrate if necessary
Run rake assets:clean assets:precompile
Restart Phusion Passenger
How would I accomplish that?
Just write your own bash or ruby script that does this. I think you are missing the point of Capistrano. Cloning the whole repo allows you to do deploy rollbacks, leaving the previous version as is. It takes into account deploys that fail, and will not mess with your production site during the deploy process.
I'm not familiar with Capistrano at all, I've just read some basic posts about configuring it. But my question is why bother with Capistrano if you can deploy your Rails application files using a git post-receive hook?
What does Capistrano offer that the hook doesn't?
I was looking into automated ways of deploying my Rails apps without using FTP and came across both git hooks and Capistrano.
Or am I missing something?
Thanks.
Git hooks allow you to execute script related to the git repository on a given action.
Capistrano allows you to administer your production deploys.
A single call to 'cap deploy' will clone your master branch on your target machine, archive the previous release, precompile your assets, restart passenger. Capistrano can also migrate your database, or execute any number of arbitrary commands you want on any server configured in your deploy.rb file.
Go with Capistrano for deploying to app/db server environments, you will have no trouble finding help when you get a problem with a deploy.
I have a Rails 3.2.3 app that I host on github .Today I deployed it on Heroku.
During deployment, I made some changes to the Gemfile.
Run rake assets:precompile which generate a /public/assets folder.
I had to add and commit those change to local repository in order to
push to heroku by running git push heroku master
The deoployment was fine but now my development environment is like:
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
Those are the changes I made for deployment on heroku (run precompile and some other stuffs) that I don't want to exist on my github repo. How do I do to continue my development (be able to push on github) and keep updating the change on heroku) ?
Clarification: public/assets is generated and should be added to local repo in order to push to heroku. So I can't put it in .gitignore But I don't want it to be pushed on github. What is the best practice?
I'm not sure why you're running rake assets:precompile in development. Are you debugging something? In general, it's best not to commit compiled assets to your repo since they are generated content.
On Heroku, you have the option to precompile your assets during slug compilation. This makes for a cleaner repo albeit a slightly slower deploy. Just remove public/assets so Heroku knows what to do. Also, make sure you add the following line to config/application.rb:
config.assets.initialize_on_precompile = false
https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar
I have now my rails 3.2.1 app running on Heroku.
I've tried to upload the database to mongohq via the heroku mongo:push command, after installing the heroku mongo plugin.
https://github.com/pedro/heroku-mongo-sync
I get the message asking me to confirm if I want to push, but once the push is done, there is nothing my db.
I'm not sure if it is a problem with heroku or if i'm missing a step.
Could it be that i need to put my app in production mode and migrate the database to production?
I'm not sure how to do that either.
Cheers
does your local heroku connection conform to the plugins assumptions [in the readme's config section]? if not you'll have to set it via:
export MONGO_URL = mongodb://user:pass#localhost:1234/db
i'll also note, that even after doing this i had to uninstall the heroku plugin and reinstall it from this fork: http://github.com/fjg/heroku-mongo-sync.git
heroku plugins:install http://github.com/fjg/heroku-mongo-sync.git
Check out the MongoSync Ruby Gem
It's a gem I wrote for that very purpose when I had to constantly copy my Local MongoDB database to and from my Production DB for a Project (I know it's stupid). It's extremely easy to use. Once you've entered your DB details in the mongo_sync.yml file, you can push and pull DBs using these rake tasks:
$ rake mongo_sync:push # Push DB to Remote
$ rake mongo_sync:pull # Pull DB to Local
Note: It's also available as shell script for non-ruby apps: mongo-sync