...
The first goal is to build our image. In the case of the Natours repository, we don’t need any additional compile steps. All we need to do is run docker build with the appropriate commands
Creating
...
The first thing we need to do is create a Registry Account in FlexDeploy. This account contains the necessary information for pushing our image. Navigate to Topology->Integrations->Containers and click the Plus button.
...
Be sure to select the Provider as DockerRegistry and populate the information as necessary. In the above account it is configured to push to the joelwenzel account on dockerhub.com
Setting up the Project
Next, create a new Project in FlexDeploy. Give it a name that closely resembles your Git repository name and select Container as the Classification.
...
Done Offscreen
Create your SCM Instance and configure your Project to use it
After creating the Project, click on the Container Configuration tab. It is here where we specify the image tag information and build behavior.
Add the following configuration:
...
We will come back to image scanning, but for now lets continue on.
Creating the Build Workflow
...
the Build Workflow
The build workflow is only going to need two steps: clone the source code and build the image. The buildProjectImage step is going to use the configuration directly in the project. As such, the default configuration is is fine for both steps, simply drag and drop.
...
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Creating a Registry Account
If we are going to be pushing our image anywhere, we will need a Registry Account in FlexDeploy. Navigate to Topology->Integrations->Containers and click the Plus button.
...
Be sure to select the Provider as DockerRegistry and populate the information as necessary. In the above account it is configured to push to the joelwenzel account on dockerhub.com
Creating Additional Build Topology
LastlyWhile still on the Topology screen, we need to can create the topology remaining items for the build process.
Done Offscreen
Create an endpoint where Docker is installed
If docker is installed on the FlexDeploy server, the localhost endpoint can be used.
Create a Docker instance
Add the Build Environment to the Instance
...
Done Offscreen
Add the Docker Endpoint to your Docker-Build EnvInst in Topology Overview
Create the SCM Instance for the Git repository
Setting up the Project
Lastly, create a new Project in FlexDeploy. Give it a name that closely resembles your Git repository name and select Container as the Classification.
...
Done Offscreen
Update the Project Configuration tab to include the Build Workflow and , Build Instance and SCM Configuration.
After creating the Project, click on the
...
Container Configuration tab
...
Run a build
Now the Project is ready to start creating images. . It is here where we specify the image tag information and build behavior.
Add the following configuration:
...
Naturally your image name and account could be different compared to what’s shown above. With this configuration, FlexDeploy will build an image with an incrementing Project Versionevery time we run a build. In addition to tagging the image with the ProjectVersion it will tag with latest and push the image to the Docker Hub registry that was set up earlier.
We will come back to image scanning, but for now lets finally build the image.
Run a build
Click the Build button on the Project Activity screen and if everything goes well we should have a new version of the natours image.
...
Notice that both version 1.0.1 and the latest tag were both pushed to the registry.
...
Deploying the Containerized App
A reminder that before deployment, you should have kubectl and helm installed on the local FlexDeploy server and have a valid context configured. Similar to the build process, we will first configure the project.
Project Helm Configuration
...
Creating the Deploy Workflow
The only step our deploy workflow needs to do is run Helm, which we will do through the deploy operation on the FlexDeployHelmPlugin. The only input specified is the K8s Context which should be the kubectl context as it shows when running
Code Block | ||
---|---|---|
| ||
kubectl config current-context |
...
Expand | |||||
---|---|---|---|---|---|
| |||||
|
Creating the Deploy Topology
More of the same as what we did on the Build side of things.
Done Offscreen
Create a Helm Instance
Associate the DeployHelm workflow
Set the Localhost endpoint on the Development Environment for the Helm Instance.
...
Finalizing the Project
Done Offscreen
Associate the Deploy Workflow and Deploy Instance on the Project Configuration tab.
Almost there, the final piece of the puzzle is to update the Helm configuration on the project.
Release Name - "natours-"+FD_ENVIRONMENT_CODE.toLowerCase()
Chart Path - https://github.com/joel-wenzel/charts/raw/develop/generic-0.1.0.tgz
This chart will create a single pod deployment with a load balancer service.