The Ops Community ⚙️

jose luis pujol
jose luis pujol

Posted on • Updated on

Despliegue Kubernetes cluster y LoadBalancer en DO con terraform desde github self-runner

Link directo a los runners:
https://github.com/sosan/TU_REPO/actions/runners

Esta en Settings -> Actions/Runners

click boton New self hosted runner
copiamos el token del self runner AAPYBGPKXXXQ3UMKEO5QECBGxXXXXXXXXC3CXCH4I(ejemplo)

En el vps, tenemos montado un docker sin rootless (TODO: rootless)

NOTA: si seguimos las instrucciones del github, se ejecutara un runner, y cuando queramos borrarlo podemos ir al github y click boton borrar y se borraran los servicios del vps referentes al github runner

usando imagen https://hub.docker.com/r/myoung34/github-runner

Config basica runner:

docker run -d --restart always --name github-runner \
  -e REPO_URL="https://github.com/sosan/github-self-runner-digitalocean" \
  -e RUNNER_NAME="linux-terraform" \
  -e RUNNER_TOKEN="AAPYBGPKQXXXXXXX3UMKEO5QECBGC3CXCH4I" \
  -e RUNNER_WORKDIR="/tmp/github-self-runner-digitalocean" \
  -v /tmp/github-self-runner-digitalocean:/tmp/github-self-runner-digitalocean \
  -v /var/run/docker.sock:/var/run/docker.sock \
  myoung34/github-runner:latest 
Enter fullscreen mode Exit fullscreen mode
docker logs github-runner
Enter fullscreen mode Exit fullscreen mode

muestra:

# Authentication
√ Connected to GitHub
# Runner Registration
√ Runner successfully added
√ Runner connection is good
# Runner settings
√ Settings Saved.
√ Connected to GitHub
Current runner version: '2.294.0'
2022-06-26 15:58:21Z: Listening for Jobs
Enter fullscreen mode Exit fullscreen mode

en el github seccion actions/runners tendria que poner idle

mas info:
https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners#adding-a-self-hosted-runner-to-a-repository

Desde github añadimos un token llamado: DIGITALOCEAN_ACCESS_TOKEN con el PAT de digitalocean

DIGITALOCEAN_ACCESS_TOKEN=dop_v1_d8eeed703665XXXXXXXXXXX18d0021319XXXXXXXXX(ejemplo)

Imagen despliegue:

imagen

Mejoras TODO:

  • Despligue desde merge-pull-request
  • Rootless docker

Codigo fuente:
https://github.com/sosan/github-self-runner-digitalocean

Top comments (3)

Collapse
 
ellativity profile image
Ella (she/her/elle)

Hola @sosan, me encantaría etiquetar esta publicación como "español" para que las personas que buscan contenido en español puedan encontrarlo.

¿Estás de acuerdo con eso?

Collapse
 
sosan profile image
jose luis pujol Author

done :)

Collapse
 
ellativity profile image
Ella (she/her/elle)

Thank you!