I am new to Heroku, as I understand heroku uses git to deploy our applications. i.e. I can push my changes to the heroku repository for deployment.
Can i use heroku as a test environment and private git repository at the same time? Is it possible?
Yes. You can push branches that are not master (which will not be deployed then). It might be a little slow at times.
Related
According to what I have figured out..
Create local repo => add remote origin and PUSH to bitbucket =>create heroku =>push to heroku from master, from local repo and not from bitbucket
Please verify this flow.
You don't need this step - add remote origin and PUSH to bitbucket.
You add heroku as remote url to your git. You can read more about deployment process and what's going in official heroku doc - Deploying with Git.
Deploy a rails app to heroku is ideal. Just go through heroku official document here.
Hear I add some essential command, you need to run sequential, after push new changes to git repository.
> heroku login
> heroku create
> git push heroku master
> heroku run rake db:migrate
If you use Github then you can easily link your Heroku app with Github repo and all your Heroku code automatically pushed to Heroku.
This option is not available for BitBucket now.
I have a production application on master branch running all fine on heroku. I would like to run a second Heroku application but 'fed' from a local staging branch. These are the commands that i've run in my failed attempt to do this:
git checkout -b develop
heroku create --remote staging
git push staging develop
But because i'm pushing from a 'non master' branch it doesn't build the app;
remote: Pushed to non-master branch, skipping build.
I have read the managing multiple environments doc here; https://devcenter.heroku.com/articles/multiple-environments but it does not seem to address what I'm trying to achieve, rather merging develop branch into master first then pushing master to remote staging. I want to push my develop branch to a staging app and have it running live in RAILS_ENV=production mode, iteratively push to this live 'staging/testing' app then when i'm really comfy with what i'm going i'll merge the develop branch code into the master branch and push to the primary mast app.
Can anyone help me with how to achieve this?
as per heroku doc
git push staging develop:master
as per Git documentaion
git push <REMOTENAME> <LOCALBRANCHNAME>:<REMOTEBRANCHNAME>
so
git push heroku staging:master
means
push my staging local branch to master remote heroku branch
Its not as close to the most direct command line - but my DevOps pipeline using Codeship makes this much easier for commits on different branches.
I have Codeship automatically deploy anything to the dev branch to one Heroku app, anything in the staging branch to another, and anything to master to the live branch.
Not the direct solution you were probably looking for - but something that shows the benefits of a good CI setup!
I have a Heroku application that already deploy on Heroku (master-branch) in that I created new branch staging. The staging branch code are totally different with master. Now I want to deploy staging on Heroku but that will not affect on master. How can I do that?
You have to created separate applications on Heroku for each environment that you need. I typically create dev and staging using the free tier.
Here is blog post that walks you through the process:
http://agilewarrior.wordpress.com/2014/05/16/how-to-create-a-staging-environment-heroku/
You can run heroku buildpacks:clear -a yourAppName and redeploy the app.
I have an instance at heroku where I push the different branches of the same project for testing. Since the branches are different (although they are created off the main, develop branch) and it's only for testing, whenever I push to it I'd like that new "push" completely rewrite code there without any merging, conflicts, etc. In other worlds, I'd like kind of truncate (or recreate) my repository at heroku each time before pushing.
Is it possible?
You can try git push heroku master --force or if you would like to deploy a specific branch, then git push heroku <branchname>:master --force
Rails/Heroku/Git newbie - here is my question. I have an app deployed with Heroku and am using the git repository hosted there as the only remote copy of my local work. I start making changes locally on a new branch and want to make this branch available on Heroku so that I can continue work on it from another computer. Heroku ignores branches other than master and I don't want to merge my changes yet (or push them as master). Is there a way to store/access my new branch via my Heroku git repository, or is it better to have another remote git repository for my work in progress.
Thanks!
You can push a local branch to the remote git server with:
git push origin branch_name
That way, you can pull it down again elsewhere with:
git checkout -b branch_name origin/branch_name
http://gitready.com/beginner/2009/02/02/push-and-delete-branches.html
http://gitready.com/intermediate/2009/01/09/checkout-remote-tracked-branch.html
I would go with a separate git repository as suggested - github.com or similar. Store your code there and deploy to Heroku's master repo - Heroku is a hosting platform afterall not a home for your repos.
ALTERNATIVELY Make use of dropbox and create your local workspace in a dropbox folder that is synced across multiple computers - I employ this method as well as git - plus you get the advantage that Dropbox is versioned so if you delete/change a file that you haven't committed yet you can get it back.