|
|
# Roteiro de trabalho
|
|
|
|
|
|
Ao final deste roteiro, o aluno terá construído uma pipeline de integração e entrega contínua básica utilizando o [GitLab Runner](https://docs.gitlab.com/runner/) em um container Docker rodando sobre uma [instância EC2 Spot](https://aws.amazon.com/ec2/spot/?nc1=h_ls&cards.sort-by=item.additionalFields.startDateTime&cards.sort-order=asc).
|
|
|
|
|
|
## Pré requisitos:
|
|
|
|
|
|
- O aluno deve possuir uma [conta na AWS](https://aws.amazon.com/pt/free/?trk=ps_a134p0000078Pq7AAE&trkCampaign=acq_paid_search_brand&sc_channel=ps&sc_campaign=acquisition_BR&sc_publisher=google&sc_category=core-main&sc_country=BR&sc_geo=LATAM&sc_outcome=acq&sc_detail=aws&sc_content=Brand%20Core%20AWS_p&sc_matchtype=p&sc_segment=507891927302&sc_medium=ACQ-P|PS-GO|Brand|Desktop|SU|Core-Main|Core|BR|EN|Text|xx|PH&s_kwcid=AL!4422!3!507891927302!p!!g!!aws&ef_id=Cj0KCQjw_8mHBhClARIsABfFgpjy82IrDkpFiF4rg2TmvSVPv9w1kh8VX6-v5vagE2pGyFEFq0qzV1waAjHBEALw_wcB:G:s&s_kwcid=AL!4422!3!507891927302!p!!g!!aws&all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all)
|
|
|
|
|
|
### Parte 1 - Criação de Amazon EC2 SPOT
|
|
|
|
|
|
```sh
|
|
|
# docker installation
|
|
|
yum update
|
|
|
amazon-linux-extras install docker
|
|
|
yum install docker -y
|
|
|
service docker start
|
|
|
usermod -a -G docker ec2-user
|
|
|
|
|
|
# gitlab runner container creation
|
|
|
docker run -d --name gitlab-runner --restart always \
|
|
|
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
|
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
|
gitlab/gitlab-runner:latest
|
|
|
|
|
|
# gitlab runner registration
|
|
|
docker run --rm -it -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register \
|
|
|
--non-interactive \
|
|
|
--url https://tools.ages.pucrs.br/ \
|
|
|
--registration-token <gitlab-token> \
|
|
|
--name gitlab-runner \
|
|
|
--locked \
|
|
|
--paused \
|
|
|
--executor docker \
|
|
|
--docker-image docker:dind
|
|
|
|
|
|
# gitlab runner configuration
|
|
|
cat > /srv/gitlab-runner/config/config.toml << EOF
|
|
|
concurrent = 1
|
|
|
check_interval = 0
|
|
|
[session_server]
|
|
|
session_timeout = 1800
|
|
|
[[runners]]
|
|
|
name = "id-care-runner"
|
|
|
url = "https://tools.ages.pucrs.br"
|
|
|
token = "7Hu-XErZW6f1W_zt21kg"
|
|
|
executor = "docker"
|
|
|
[runners.custom_build_dir]
|
|
|
[runners.cache]
|
|
|
[runners.cache.s3]
|
|
|
[runners.cache.gcs]
|
|
|
[runners.cache.azure]
|
|
|
[runners.docker]
|
|
|
tls_verify = false
|
|
|
image = "docker:dind"
|
|
|
privileged = true
|
|
|
disable_entrypoint_overwrite = false
|
|
|
oom_kill_disable = false
|
|
|
disable_cache = false
|
|
|
volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"]
|
|
|
shm_size = 0
|
|
|
EOF
|
|
|
```
|
|
|
|
|
|
### Parte 2 - Configuração do GitLab Runner
|
|
|
|
|
|
### Parte 3 - Criação da pipeline de CI/CD
|
|
|
|
|
|
|