EB: Automatically deploy new Docker image build from Docker Hub - amazon-elastic-beanstalk

Is it possible to setup a web hook to automatically deploy a new version of an application from a Docker Hub repository to Elastic Beanstalk?
I currently have the following setup:
Bitbucket Repo -----> Docker Hub -----> Elastic Beanstalk
When I push to the master branch on the git repository, it triggers a build on the Docker repository through a POST request. However, once the image is built, I have to manually deploy it on EB.
Docker Hub has the option for making a POST request whenever a build is successfully completed. Is there some API or URL that I could point Docker to call so that EB redeploys the application?
Note: Eventually I would like to include an automated testing server into this workflow.

AWS does not seem to have a HTTP API, but you can use the aws command-line tool to trigger the update: https://stackoverflow.com/a/41715702/5879759

Related

How can I specify Dockerfile build in buildConfig for OpenShift Online?

Openshfit details:
Paid Professional version.
Version Information:
Been trying to create a build from a Dockerfile in Openshift.
Its tough going.
So I tried to use the existing templates in the Cluster Console.
One of which is the Docker one. When i press "Try it" it generates a sample BuildConfig, when I try to then Create it, it gives me the error:
(i have now raised the above in the Origin upstream issue tracker)
Anyhoo...anyone know how to specify a buildConfig an image from a Dockerfile in a git repo? I would be grateful to know.
You can see the build strategies allowed for OpenShift Online on the product website: https://www.openshift.com/products/online. Dockerfile build isn't deprecated, it's just explicitly disallowed in OpenShift Online. You can build your Dockerfile locally and push it directly to the OpenShift internal registry (commands for docker login and docker push are on your cluster's About page).
However, in other environments (not OpenShift Online), you can specify a Dockerfile build as follows and providing a Git Repo with a Dockerfile contained within (located at BuildConfig.spec.source.contextDir)
strategy:
type: Docker
There are additional options that can be configured for a Dockerfile build as well, outlined in https://docs.okd.io/latest/dev_guide/builds/build_strategies.html#docker-strategy-options.

Can I deploy automatically by AWS Elastic beanstalk and Code Commit?

I use Elastic Beanstalk. And it was connected with Code Commit.
I want that if I push to Code Commit repository, EB CLI or Code Commit automatically deploy this version to elasticbeanstalk
Can I do this?
You can create a script that periodically polls CodeCommit for new changes. When there is a new change, the script can trigger:
git clone <codecommit repository>
eb init -p <platform name>
eb create/eb deploy
of course, you probably don't need to clone every time, but this is basically how Jenkins works. In fact, you can just use Jenkins to poll CodeCommit. Any time there is a new commit detected, Jenkins will build it using the EBCLI.
CodePipeline
AWS CodePipeline is a continuous delivery service you can use to model, visualize, and automate the steps required to release your software. You can quickly model and configure the different stages of a software release process. AWS CodePipeline automates the steps required to release your software changes continuously.
https://docs.aws.amazon.com/codepipeline/latest/userguide/welcome.html
Configure a pipeline with CodePipeline. When GitHub or CodeCommit is configured as the source stage, every single commit will trigger your pipeline to execute. When Beanstalk is configured as a deploy stage, it will automatically deploy whatever new code is going through the pipeline.

Redeploy Openshift Application when Docker Hub Image Changes?

Is there a way to trigger a re-deploy when I push an image to docker hub? I used S2I to build an image, put it up on docker hub, and did a deployment from there. How can I trigger a new deployment when I push a new image to docker hub?
Perhaps there is a better way? I created a wildfly image with the changes to the standalone.xml I needed. Then I used S2I to build my local source into a runnable wildfly application image, which is what I pushed and deployed. I'm trying to get around having to go through a github repository.
I'm thinking I could create an application with the customer wildfly image that I created and use the direct from IDE option to the application, but what if I want to use the command line?
You can set a scheduled flag on the image stream to have a remote registry periodically polled. This will only work though if the OpenShift cluster has been configured globally to allow that. If using OpenShift Online I don't believe that feature is enabled.
https://docs.openshift.com/container-platform/latest/dev_guide/managing_images.html#importing-tag-and-image-metadata
If you want to avoid using a Git repository, you can use a binary input build instead. This allows you to push files direct from your local computer. This means you can compile binary artifacts locally and push them into the S2I build done by OpenShift.
https://docs.openshift.com/container-platform/latest/dev_guide/builds/build_inputs.html#binary-source

Git, Node.js and NPM on public server

I have install Git, Node.js and NPM on my machine and have successfully been able to run a progressive web app on Chrome through the LocalHost. Now what about when I want to run this web app on a public server? Will I have to install Git, Node.js and NPM on my web hosting account? Or are these components already installed on web hosting servers in general (like would be an app like cPanel)?
By the way, would you be able to recommend any good FTP application for Mac that can upload zillions of files easily (not 1 by 1)?
You will need Node on the host server, but not NPM or Git (although NPM will be there by default when you install Node).
Typically what you want is to setup a "Continuous Integration / Continuous Delivery" platform. You can use free options like Travis or Jenkins or you can just use a shell script and run it through AWS Lambda or something like that.
Very simplified version:
You push code to Git
CI/CD detects the code check-in (polls) and pulls latest from Git on an Agent
CI/CD runs a "build" on the Agent, which for Node is at least npm install but can include Grunt, Gulp, Webpack, or a host of other useful steps.
CI/CD publishes the result of the build to a target server.
Here you have five machines involved:
Git server
Your local dev box
CI/CD server
CI/CD agent
production server
Hope this helps you get started in the right direction.

Deploying a node.js application with Bluemix

I am trying to deploy a simple node.js application with the new Kubernetes support in Bluemix. When I run the container I made, I get a ImagePullBackOff error, which means it can't pull down the image.
NAME READY STATUS RESTARTS AGE
hello-node-2399519400-6m8dz 0/1 ImagePullBackOff 0 13m
My Docker image uses the node.js base image.
FROM node:6.9.2
EXPOSE 8080
COPY server.js .
CMD node server.js
I deployed using:
docker build -t hello-node:v1 .
kubectl run hello-node --image=hello-node:v1 --port=8080
I am thinking that Bluemix can't pull down the node.js image, but I am not certain.
I see the docker build of the image, and I'm presuming that you're using the kubectl with the exported cluster config (bx cs cluster-config ...), so that it's targetting your cluster.
Did you tag and push that image from your local docker into the bluemix registry, or to another remote registry that would be accessible from the container service? (My apologies if this is obvious - just didn't see the step there to tag and push it to a registry that would be available).
I had to first push the image to Bluemix with:
docker build -t registry.ng.bluemix.net/namespace/hello-node:1
docker push registry.ng.bluemix.net/namespace/hello-node:1
kubectl run hello-node-deployment --image=registry.ng.bluemix.net/namespace/hello-node:1