Repositório base p/ tema12 da trilha de DevOps.

tema12--Jenkins

Informações

  • Repositório base: https://github.com/brazdore/ilegra-devops-tema12.git

Requisitos

  • Jenkins
  • Docker
  • Packer
  • JDK 11 ou maior

Preparação

Configuração:

Jenkins: Primeiro acesso

  • Rode o Jenkins
  • Acesse localhost:8080 e crie as credenciais
  • Instale os plugins recomendados

Docker Daemon Socket

  • No terminal, execute o comando sudo chmod 666 /var/run/docker.sock
  • Este evita os problemas descritos neste post e é necessário para o job02

Jenkins: job01-Bake

  • Na Dashboard do Jenkins clique em New Item
  • Nomeie de job01-bake e selecione Pipeline
  • Selecione Advanced Project Options
  • Na seção de Pipeline selecione Definition como Pipeline script from SCM
  • Em SCM selecione Git e passe como Repository URL https://github.com/brazdore/ilegra-devops-tema12.git
  • Em Branch Specifier certifique-se que esteja */master
  • Em Script Path passe bake/Jenkinsfile
  • De volta ao Dashboard, rode a pipeline criada
  • Se tudo deu certo nosso Docker deve ter pelo menos duas imagens: golang e go-calc-3891:1.0

Jenkins: job02-Launch

  • Mesmos passos do job01, mas o valor do Script Path será launch/Jenkinsfile
  • Rode a pipeline criada
  • Se tudo deu certo nosso Docker deve ter pelo menos um container rodando: gontainer74
  • É necessário que a porta 8088 esteja livre

Endpoints

GET

  • http://localhost:8088/calc/<op>/<x>/<y>
    • Retorna o resultado da operação entre X e Y
  • http://localhost:8088/calc/history
    • Retorna o histórico de operações
  • http://localhost:8088/calc/clear
    • Limpa o histórico de operações
  • http://localhost:8088/headers
    • Retorna os headers da requisição

Exemplos:

  • http://localhost:8088/calc/sum/2/3
    • 2 + 3
  • http://localhost:8088/calc/sub/10/2
    • 10 - 2
  • http://localhost:8088/calc/mul/8/8
    • 8 * 8
  • http://localhost:8088/calc/div/5/2.5
    • 5 / 2.5
  • http://localhost:8088/calc/exp/2/8
    • 2 ^ 8

Testes

  • É possível testar os endpoints executando o comando scripts/smoke-test-all.sh a partir da pasta raíz do projeto
  • O script deve criar uma nova pasta test-output com os resultados dos testes

Parando o container

  • Para parar o container Docker, execute o comando scripts/docker.sh stop a partir da pasta raíz do projeto
  • É possível checar o status do container com o comando scripts/docker.sh status

Removendo container & imagem

  • A partir da pasta raíz do projeto, execute o comando scripts/docker.sh clear
  • O script deve remover o container e a imagem criada

Notas

  • O Jenkins pode ser gerenciado através dos comandos service jenkins ${command} ou systemctl ${command} jenkins

  • Alguns dos comandos disponíveis: start; stop; status; restart ; force-reload

  • O comando sudo chmod 666 /var/run/docker.sock parece ser necessário em toda nova inicialização do Docker.

Similar Resources

DevOps With Kubernetes exercise

todo-project [https://github.com/pasiol/todo-project/tree/1.05] Exercise 1.06 pasiol@lab:~$ k3d cluster delete INFO[0000] Deleting cluster 'k3s-defaul

Dec 8, 2021

Kubernetes operator for the Azure DevOps pipe-line agents

adoagent-operator Kubernetes operator for the Azure DevOps pipe-line agents init.sh #!/bin/bash # docker and github repo username export USERNAME='ba

Nov 11, 2021

This is a cloud-native application that focuses on the DevOps area.

KubeSphere DevOps integrates popular CI/CD tools, provides CI/CD Pipelines based on Jenkins, offers automation toolkits including Binary-to-Image (B2I

Jan 5, 2023

Kubernetes operator for the Azure DevOps self-hosted pipe-line agent.

Kubernetes operator for the Azure DevOps self-hosted pipe-line agent. The operator adds an extra layer of configuration on top of the default images like: proxy settings, pool settings and auth keys.

Sep 1, 2022

DevOps Roadmap 2022

Want to learn DevOps the right way in 2022 ? You have come to the right place I have created the complete DevOps roadmap that anyone can follow and be

Dec 28, 2022

Git-based DevOps PaaS: Project, Pipeline, Kubernetes, ServiceMesh, MutilCloud

gitctl 一体化 DevOps 平台 从代码到应用的一体化编排,应用全生命周期管理,多云托管。 gitctl 会有哪些功能? git 代码托管 projec

Oct 24, 2022

Fluxcdproj - The Ultimate Swiss Army knife for DevOps, Developers and Platform Engineers

Fluxcdproj -  The Ultimate Swiss Army knife for DevOps, Developers and Platform Engineers

Fluxcdproj - The Ultimate Swiss Army knife for DevOps, Developers and Platform Engineers

Feb 1, 2022

Isaac Gazimbe - DevOps Golang Tools

Isaac Gazimbe - DevOps Golang Tools git.io/go-tools DevOps Golang Tools All programs have --help to list the available options. See Also: DevOps Bash

Feb 10, 2022

Simple HPA base NGINX Ingress

Simple HPA Base Ingress Access Log Support NGINX Ingress How to Use Requirement Kubernetes NGINX Ingress Quick Start 1. Deploy Change deploy.yamlENV,

Dec 12, 2022
Repositório destinado para acompanhar meu aprendizado na linguagem Go, desde o básico "Hello, World!" até a elaboração de um projeto ainda não definido. 🙂

go-basics Repositório destinado para acompanhar meu aprendizado na linguagem Go, desde o básico "Hello, World!" até a elaboração de um projeto ainda n

Jan 7, 2022
Repositório do curso introdutório da linguagem Go

curso-go Repositório do curso introdutório da linguagem Go Inicializando o módulo cd curso-go/ go mod init github.com/eminetto/curso-go Executando go

Jul 20, 2022
Supporting your devops by shortening your strings using common abbreviations and clever guesswork

abbreviate Shorten your strings using common abbreviations. Supported by Tidelift Motivation This tool comes out of a frustration of the name of resou

Dec 14, 2022
k6 is a modern load testing tool for developers and testers in the DevOps era.
k6 is a modern load testing tool for developers and testers in the DevOps era.

k6 is a modern load testing tool, building on our years of experience in the load and performance testing industry. It provides a clean, approachable scripting API, local and cloud execution, and flexible configuration.

Jan 8, 2023
This is a cloud-native application that focuses on the DevOps area.

Get started Install KubeSphere via kk (or other ways). This is an optional step, basically we need a Kubernetes Cluster and the front-end of DevOps. I

Jan 5, 2023
Power-ups for the daily DevOps life

DevOps Loop Power-Ups Requirements Connected Kubernetes cluster. Some features need support for LoadBalancer services Permission to list, create and d

Nov 3, 2022
sail is an operation framework based on Ansible/Helm. sail follows the principles of Infrastructure as Code (IaC), Operation as Code (OaC), and Everything as Code. So it is a tool for DevOps.

sail 中文文档 sail is an operation framework based on Ansible/Helm. sail follows the principles of Infrastructure as Code (IaC), Operation as Code (OaC),a

Dec 16, 2021
A Kubernetes Operator, that helps DevOps team accelerate their journey into the cloud and K8s.
A Kubernetes Operator, that helps DevOps team accelerate their journey into the cloud and K8s.

A Kubernetes Operator, that helps DevOps team accelerate their journey into the cloud and K8s. OAM operator scaffolds all of the code required to create resources across various cloud provides, which includes both K8s and Non-K8s resources

Nov 30, 2021
Zeus - A Devops Automation Tool

With this tool we are trying generalize and minimize devops reperating task while trying to encourage shared responsibility model acorss devloper teams.

May 31, 2022
The Oracle Database Operator for Kubernetes (a.k.a. OraOperator) helps developers, DBAs, DevOps and GitOps teams reduce the time and complexity of deploying and managing Oracle Databases

The Oracle Database Operator for Kubernetes (a.k.a. OraOperator) helps developers, DBAs, DevOps and GitOps teams reduce the time and complexity of deploying and managing Oracle Databases. It eliminates the dependency on a human operator or administrator for the majority of database operations.

Dec 14, 2022