commenting out the legacy code instead of deleting it · pipeline flow with docker compose ......
TRANSCRIPT
![Page 1: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/1.jpg)
![Page 2: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/2.jpg)
Redesigning a pipeline flow with Docker Compose@AlmBrand
Loke Norlin Johannessen
Senior System Specialist
![Page 3: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/3.jpg)
Commenting out the legacy code instead of deleting it
![Page 4: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/4.jpg)
Old setup
Jenkins
• Single instance
• Pinged by Gitlab pipeline
Gitlab
• Build pipeline
Docker Enterprise
• Called by custom script
![Page 5: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/5.jpg)
Old deploy method- custom script -
![Page 6: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/6.jpg)
Old “deploy” pipeline
![Page 7: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/7.jpg)
Jenkins pipeline
![Page 8: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/8.jpg)
New setup
![Page 9: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/9.jpg)
Base systemsUbuntu
• Minimal/Cloud
• Small iso – under 300mb
vSphere
• On-Prem virtualizasion provider
Gitlab
• CI/CD system
Docker Enterprise
• UCP – Access control
• DTR – Image repository
• Engine – Container engine
![Page 10: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/10.jpg)
Ansible• Configuration management• Used during template generation• Used during deploy of infrastructure
Packer• VMware iso/template generation
Terraform• Infrastructure provisioner
Automation tools
![Page 11: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/11.jpg)
Gitlab repo
![Page 12: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/12.jpg)
![Page 13: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/13.jpg)
Dockerfile
• TIP: Comment the different stages
• TIP: Specify base image tag ( Do not use latest )
![Page 14: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/14.jpg)
Basic layout
![Page 15: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/15.jpg)
Basic layout
![Page 16: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/16.jpg)
Single job pipeline
![Page 17: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/17.jpg)
![Page 18: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/18.jpg)
Compose
![Page 19: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/19.jpg)
![Page 20: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/20.jpg)
Use variables
• TIP: Gitlab CI/CD has a LOT of environmental variables
![Page 21: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/21.jpg)
Lint a Dockerfile
• TIP: Hadolint is an excellent linting tool
![Page 22: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/22.jpg)
Hadolint
![Page 23: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/23.jpg)
ADD
![Page 24: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/24.jpg)
TIP: Use COPY instead of ADD
![Page 25: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/25.jpg)
COPY
![Page 26: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/26.jpg)
TIP: Environment variables can be defined in a file
![Page 27: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/27.jpg)
• TIP: Define multiple compose files in .env• TIP: Order of precedence matters• TIP: Use docker-compose config > combined_config.yml
![Page 28: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/28.jpg)
Tip: Set defaults Tip: Mandatory variables
![Page 29: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/29.jpg)
TIP: Set defaults if ENVs are not definedTIP: Allows you to build/deploy on workstationTIP: Requires docker-engine 18.09
![Page 30: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/30.jpg)
![Page 31: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/31.jpg)
• TIP: When installing packages, ensure you specify the version
• TIP: WORKDIR is recommended to use if you need to CD
![Page 32: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/32.jpg)
![Page 33: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/33.jpg)
• TIP: scratch is a perfect image to use with golang ( “zero” attack surface )
• TIP: Use “COPY --from” to import ca-certs/trusted-certs into scratch images
![Page 34: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/34.jpg)
TIP: Use commit-SHA as tags
![Page 35: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/35.jpg)
• TIP: Add environmentals in compose-files
![Page 36: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/36.jpg)
• TIP: Environmentals are great in a multistage pipeline ( Dev -> Test -> Prod )
![Page 37: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/37.jpg)
• TIP: Pushing to a Gitlab or DTR is easy ( We impersonate users and do the push on their behalf with ucp-bundles )
![Page 38: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/38.jpg)
![Page 39: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/39.jpg)
![Page 40: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/40.jpg)
• TIP: Use dive to rate quality of image ( size, wasted space )
![Page 41: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/41.jpg)
![Page 42: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/42.jpg)
![Page 43: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/43.jpg)
Tip:Include
pipelines
• TIP: Include/Use centralized gitlab configs for pipelines
![Page 44: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/44.jpg)
Tip:local storage
driver
• TIP: The local storage driver is powerful – NFS mount without any plugins
![Page 45: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/45.jpg)
![Page 46: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/46.jpg)
![Page 47: Commenting out the legacy code instead of deleting it · pipeline flow with Docker Compose ... Senior System Specialist. Commenting out the legacy code instead of deleting it. Old](https://reader035.vdocument.in/reader035/viewer/2022081405/5f0a934b7e708231d42c4ea9/html5/thumbnails/47.jpg)