Skip to content

profmaddo/terraform-docker-health-check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌐 Projeto Terraform + Docker: Health Check entre Containers

🇧🇷 Versão em Português

Este projeto cria dois containers Linux baseados em Alpine usando Terraform e Docker. Cada container realiza um ping para o outro a cada minuto e registra os resultados em arquivos .txt salvos localmente.


🧱 Estrutura Criada

  • Rede personalizada Docker chamada ping_network.
  • 2 containers Alpine (linux_a e linux_b).
  • Script de health check via ping entre os containers.
  • Agendamento via cron para executar o script a cada minuto.
  • Logs salvos no diretório logs/ com nomes como:
    • node_a_yyyymmddhhmmss.txt
    • node_b_yyyymmddhhmmss.txt

🚀 Requisitos


📦 Como usar

  1. Extraia o projeto:

    unzip projeto_ping_docker_terraform.zip
    cd projeto_ping_docker_terraform
  2. Inicialize o Terraform:

    terraform init
  3. Aplique o plano:

    terraform apply
  4. Verifique os logs:

    ls logs/
    tail -f logs/node_a_*.txt

🧹 Como remover

terraform destroy

🇺🇸 English Version

This project uses Terraform and Docker to create two lightweight Linux containers (based on Alpine). Each container pings the other every minute and logs the results into a .txt file stored on the host.


🧱 Setup Summary

  • Custom Docker network called ping_network
  • Two Alpine-based containers: linux_a and linux_b
  • Health check script using ping
  • Cron job scheduled to run every minute
  • Logs saved to the host in:
    • logs/node_a_yyyymmddhhmmss.txt
    • logs/node_b_yyyymmddhhmmss.txt

🚀 Requirements


📦 Usage

  1. Extract the project:

    unzip projeto_ping_docker_terraform.zip
    cd projeto_ping_docker_terraform
  2. Initialize Terraform:

    terraform init
  3. Apply the plan:

    terraform apply
  4. Check the logs:

    ls logs/
    tail -f logs/node_a_*.txt

🧹 Cleanup

terraform destroy

About

Projeto Terraform + Docker: Health Check entre Containers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors