update screenshots, add container steps for DO
@@ -75,12 +75,13 @@ Chapter 4, "A Complete CI/CD Pipeline", is a step-by-step guide to implementing
|
||||
A few changes were introduced in this second edition:
|
||||
|
||||
- Moved to Kubernetes version v1.20. All commands and actions were tested with this version.
|
||||
- Added note about accessing services in local development Kubernetes clusters.
|
||||
- Added mentions of new CI/CD features: parametrized pipelines, test results, code change detection.
|
||||
- DigitalOcean deployment now uses their Private Container Registry service instead of GitHub.
|
||||
- Added comments about accessing services in local development Kubernetes clusters.
|
||||
- Added mention of new CI/CD features in Semaphore: parametrized pipelines, test results, code change detection.
|
||||
- DigitalOcean deployment now uses their Private Container Registry service instead of Docker Hub.
|
||||
- Updated setup steps for DigitalOcean, Google Cloud, and AWS.
|
||||
- Updated UI screenshots using higher resolution.
|
||||
- Minor fixes.
|
||||
- Modified deployment tutorial to use parametrized promotions.
|
||||
- Other minor fixes.
|
||||
|
||||
## How to Contact Us
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ docker run --net=host -it \
|
||||
|
||||
This last test runs the code in `src/database.test.js`, which checks if the application can write and delete rows in the database.
|
||||
|
||||
{ width=95% }
|
||||
{ width=80% }
|
||||
|
||||
Create the third block in the pipeline and call it “Push”. This last job will tag the current Docker image as `latest`. Type these commands in the job:
|
||||
|
||||
@@ -236,7 +236,7 @@ This completes the setup of the CI pipeline.
|
||||
|
||||
We’ve covered a lot of things in a few pages; here, we have the chance to pause for a little bit and try the CI pipeline. Click on the *Run the workflow* button on the top-right corner and then click on *Start*.
|
||||
|
||||
{ width=95% }
|
||||
{ width=80% }
|
||||
|
||||
After a few seconds the pipeline will start building and testing the container.
|
||||
|
||||
|
||||
@@ -8,12 +8,7 @@ We’ll deploy the application in a three-node Kubernetes cluster. You can pick
|
||||
|
||||
#### 4.5.1 DigitalOcean Cluster
|
||||
|
||||
**DigitalOcean provides a managed Kubernetes service but lacks a private Docker registry[^do-private-reg], so we’ll use Docker Hub for the images.**
|
||||
|
||||
[^do-private-reg]: At the time of writing, DigitalOcean announced a beta for a private registry offering. For more information, consult the available documentation: _<https://www.digitalocean.com/docs/kubernetes/how-to/set-up-registry>_
|
||||
|
||||
- **Sign up for a free account on [hub.docker.com](https://hub.docker.com).**
|
||||
- **Create a public repository called “semaphore-demo-cicd-kubernetes”.**
|
||||
DigitalOcean provides everything needed to deploy the application: a managed Kubernetes, a Container Registry, and Postgres databases.
|
||||
|
||||
To create the Kubernetes cluster:
|
||||
|
||||
@@ -23,6 +18,13 @@ To create the Kubernetes cluster:
|
||||
- While DigitalOcean is working on the cluster, go to *API* menu and generate a *Personal Access Token* with Read & Write permissions.
|
||||
- To finalize, go to *Container Registry* and create a starter repository. Set the repository name, which is globally unique, and remember it for the next chapter.
|
||||
|
||||
Next, create a Container Registry with the following actions:
|
||||
|
||||
- Go to *Container Registry*.
|
||||
- Click *Create*.
|
||||
- Set the registry name. Names are unique across all DigitalOcean customers.
|
||||
- Select the *Starter* free plan.
|
||||
|
||||
On Semaphore, store the DigitalOcean Access Token as a secret:
|
||||
|
||||
1. Log in to your organization on [id.semaphoreci.com](https://id.semaphoreci.com).
|
||||
@@ -31,11 +33,6 @@ On Semaphore, store the DigitalOcean Access Token as a secret:
|
||||
4. Add the `DO_ACCESS_TOKEN` variable and set its value with your personal token.
|
||||
5. Click on *Save Secret*.
|
||||
|
||||
**Repeat the last steps to add the second secret, call it “dockerhub” and add the following variables:**
|
||||
|
||||
- **`DOCKER_USERNAME` for your DockerHub user name.**
|
||||
- **`DOCKER_PASSWORD` with the corresponding password.**
|
||||
|
||||
#### 4.5.2 Google Cloud Cluster
|
||||
|
||||
Google Cloud calls its service *Kubernetes Engine*. To create the services:
|
||||
|
||||
@@ -20,6 +20,7 @@ Check the *Enable automatic promotion* box. Now we can define the following auto
|
||||
result = 'passed' and (branch = 'master' or tag =~ '^hotfix*')
|
||||
```
|
||||
|
||||
|
||||
{ width=95% }
|
||||
|
||||
Below the promotion options, click on *+ Add Environment Variables* to create a parameter for a pipeline. Parametrization let us set runtime values and reuse a pipeline for similar tasks.
|
||||
@@ -166,14 +167,13 @@ Here is the moment of truth. Will the canary work? Click on *Run the workflow* a
|
||||
Wait until the CI pipeline is done an click on *Promote* to start the canary pipeline[^no-autopromotion]. As you can see on the screenshot below, manually starting a promotion lets you customize the parameters.
|
||||
|
||||
|
||||
|
||||
[^no-autopromotion]: You might be wondering why the automatic promotion hasn’t kicked in for the canary pipeline. The reason is that we set it to trigger only for the master branch, and the Workflow Builder by default saves all its changes on a separate branch called `setup-semaphore`.
|
||||
|
||||
{ width=60% }
|
||||
{ width=95% }
|
||||
|
||||
Press *Start Promotion* to run the canary pipeline.
|
||||
|
||||
{ width=60% }
|
||||
{ width=95% }
|
||||
|
||||
Once it completes, we can check how the canary is doing.
|
||||
|
||||
@@ -194,7 +194,7 @@ Let’s say we decide to go ahead. So go on and hit the *Promote* button, you ca
|
||||
|
||||
The stable pipeline should be done in a few seconds.
|
||||
|
||||
{ width=60% }
|
||||
{ width=95% }
|
||||
|
||||
If you're fast enough, while the block runs you can see both the existing canary and a new “addressbook-stable” deployment.
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 230 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 67 KiB |