Giter Club home page Giter Club logo

terraform-webcluster's Introduction

Terraform-webcluster

Terraform Docker Nginx

This project uses Terraform and Docker to create a cluster of web servers and a load balancer for round-robin load balancing. The web servers serve a static page that displays a message "Hello from web-server (1..X)". The project also includes a health endpoint on both the web servers and load balancer that returns the name of the component. The project supports setting different versions for the web servers and load balancer.

Installation

Fully automatic installation

  1. Download and run the script fullauto.sh by running the command curl https://raw.githubusercontent.com/wondersalmon/terraform-webcluster/main/scripts/fullauto.sh >> fullauto.sh && chmod +x fullauto.sh && ./fullauto.sh in the terminal.
  2. The script will check if Terraform is installed, and if not, it will install it based on your package manager.
  3. The script will then download the project, go to the project folder, initialize Terraform, and display a menu for working with the project.

Then the script will download the project, go to the folder with the project and initialize the terraform, and displays the menu for working with the project.

Semi-automatic installation

  1. Run the script manager.sh by running the commandcurl https://raw.githubusercontent.com/wondersalmon/terraform-webcluster/main/scripts/manage.sh >> manage.sh && chmod +x manage.sh && ./manage.sh in the terminal.
  2. The script will download the project, initialize Terraform, and display a menu for working with the project.

Manual install

  1. Clone the repository by running the command git clone https://github.com/wondersalmon/terraform-webcluster.git in the terminal.
  2. Navigate to the project folder cd terraform-webcluster/terraform
  3. Initialize Terraform by running the command terraform init

Working with the cluster

The cluster can be managed using the following Terraform commands:

  • To launch the cluster, run the command terraform apply.
  • To launch the cluster with custom parameters, run the command terraform apply -var "webservers_count=$webservers_count" -var "webserver_version=$webserver_version" -var "loadbalancer_version=$loadbalancer_version" (specify custom parameters instead of variable values).
  • To delete the cluster, run the command terraform destroy.
  • To check the status of the cluster, run the command curl -s localhost:8080/health.

Cluster manager overview

In addition to manual management, the project includes a Cluster Manager that allows you to start, stop, and check the status of the cluster. The Cluster Manager can be accessed by running the script manager.sh after the project has been installed.

Note: fullauto.sh script will install Terraform, download the project and run manager.sh script.

Conclusion

This project provides a convenient and straightforward way to set up a cluster of web servers and a load balancer using Terraform and Docker. The project also includes a health endpoint and support for different versions of the web servers and load balancer. The Cluster Manager also makes it easy to start, stop, and check the status of cluster.

terraform-webcluster's People

Contributors

wondersalmon avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.