Promoting docker web app to production on Heroku pipeline gives me an error - docker

I've created a web app (ASP.NET Core API project, if it matters) and deployed it to Heroku as a docker container (using heroku.yml). That worked fine (with some obstacles that I solved).
Then I created the Heroku pipeline to have app in different environments (dev, stage, prod). I connected Heroku pipeline with the GitHub repo where my project is stored. So that gave me the staging environment of my app which works fine and opens in browser.
However, when I try to Promote to production from the staging environment I get the error:
Pipeline promotions are not supported on apps pushed via Heroku Container Registry
I am newbie to Heroku and also not expert on Docker. But why do I get this error? Why is not possible to use promotion from staging to production in a Heroku pipeline when app is deployed via docker?
Are there other options to create environments on Heroku when deploying apps via docker containers?

Related

How to add staging and production environment using gitlab and digitalocean's server

I'm setting production environment for a project and i need to create two environments, one for staging(testing) and one for production.
How can I do this using gitlab's CI and digitalocean's server.
DigitalOcean's server will the environment target or that's will be gitlab-runner hosts?
First you need to install at least one gitlab-runner (or use shared runners).
Use "only" to define the build (and deploy source branch) and use tags in assign build job to specified gitlab-runners

Deploying Different Images for Staging and Production Environment using Kubernetes and Gitlab

I want to have two separate deployments for Staging and Production branches. I am using Kubernetes cluster in AWS. I have integrated the kubernetes cluster with gitlab. Right now I have setup only one environment which works fine by setting the -only parameter to staging in the .gilab-ci.yml file. Now I want to setup the production environment which will build from the master branch.
Will setting the -only parameter to master work or do I need to make additional changes as well in gitlab?
Also will separate images be created for the two branches or do I need to explicitly create two separate images for the master and staging branch. and if so what are the steps?

Elastic Beanstalk: Deploy branch to env

I'm considering migration for custom hosted Rails app to Elastic Beanstalk.
I've create a simple Rails app and manage to deploy it to on Elastic beanstalk. There are still a few thing I still didn't manage to get:
How can I deploy a branch or a specific code to my app?
Is the deployed version is from last commit or my current workspace?
What are the best practices when handling deployment on Beanstalk?
Amazon have this document (link) but it seems to be deprecated and I can't figure how to do it on current version
elad:...$ eb --version
EB CLI 3.7 (Python 2.7.1)
I'm not sure my solution is the best practices or not, I just show here, welcome all comments on this.
How can I deploy a branch or a specific code to my app?
Beanstalk support deploy the last commit in current branch (which was actually uploaded to S3 firstly) by using EB command line
Deploy from a zipped file which was also actually updated to S3 after that
Here is what in in your environment settings in Beanstalk console
Is the deployed version is from last commit or my current workspace?
From last commit
3.What are the best practices when handling deployment on Beanstalk?
My solution #1: Define which branch will be deployed to a specific environment
In .elasticbeanstalk/config.yml
# .....
branch-defaults:
develop:
environment: mercury-dev-staging
master:
environment: mercury-dev
# .....
Relying on this config, I always switch to develop branch to deploy to mercury-dev-staging env, and master one for mercury-dev. This will avoid some mistakes like deploying develop branch to production env
My solution #2: Define some alias commands for quick deployment:
In ~/.bash_profile (I'm using MacOS)
alias deploy_production="eb deploy mercury-dev;"
alias deploy_staging="eb deploy mercury-dev-staging;"
Now I just type deploy_staging for staging deployment, this is convenient but risky, because you may deploy your developing feature to production.
Someone considering their options could take a look at AWS Code Pipeline. You define the specific GitHub repo branch. If you push a change to that branch, Code Pipeline detects it and starts a pipeline process.
This is relevant to Elastic Beanstalk because on Step 4 of Code Pipeline, you can deploy to AWS Elastic Beanstalk (among others).

Continuous Deployment

I am trying to setup continuous deployment for my Rails project. So far I have done following steps:
My app is on Github.
I have setup Travis CI.
I have created staging environment. (www.staging.myappname.com)
I have created prod environment. (www.myappname.com)
I have integrated Travis CI and Github.
What I am trying to achieve.
Someone creates a pull request.
Travis CI runs the build against pull request. (this part is done)
Once Pull request is merged into master branch then Travis CI run the test again. (this part is done)
If test is green then deploy master branch to staging environment. ( I can do this by adding deploy section to .travis.yml file.
Run test against staging environment, if test passes then deploy master branch to Production environment. ( I don't know how to achieve this part )
I am not sure if this is a right way to do it or not. I read couple of blog post and I noticed people creating different git branch for staging and production. Is this approach needed?
Also I can easily push my code to staging environment using Travis CI but I don't know how to run test again on staging environment and push code to production. What type of test shall I run against staging environment? Shall I only focus on selenium test for staging environment?
I can used tool like codeship but they offer only 100 build/month for free plan where as in Travis I can get unlimited build for free plan. This is the main reason for choosing Travis over codeship.
So my question:
Am I on right track?
What type of test shall I run against staging server?
how to deploy from staging to production using Travis CI?
Do I need staging.rb file in my rails app? If yes then how will it differ from production.rb file?
Do I need to create different git branch for staging and production? Currently I have only master branch which I am trying to deploy to both staging and production.
Usually people have 2 branches, one for staging/development which deploys on the staging server and one for production which deploys to the production branch
once your staging branch is tested and ready for deployment on production, you could create a pull request from staging to master (or just merge it locally and push it) and then the CI server should detect a new version on the master branch and then deploys it to the production server.

Deploy Multiple branch on Heroku

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.

Resources