Coder Social home page Coder Social logo

cloud-computing-in2073-2024's Introduction

Cloud Computing Course Project at TUM

This repository contains the project for the Cloud Computing course at the Technical University of Munich (TUM). The project demonstrates the use of Docker and Docker Compose to build, deploy, and manage microservices in a cloud environment.

Project Structure

The project is organized into the following directories:

/my_project
├── api
│   └── books
│       ├── get
│       │   ├── main.go
│       │   └── Dockerfile
│       ├── post
│       │   ├── main.go
│       │   └── Dockerfile
│       ├── put
│       │   ├── main.go
│       │   └── Dockerfile
│       └── delete
│           ├── main.go
│           └── Dockerfile
├── web
│   ├── main.go
│   ├── Dockerfile
│   ├── views
│   │   ├── index.html
│   │   ├── authors.html
│   │   ├── years.html
│   │   └── search-bar.html
│   └── css
│       └── styles.css
├── nginx
│   └── nginx.conf
├── docker-compose.yml
├── go.mod
└── go.sum

Services

NGINX

The NGINX service acts as a reverse proxy, routing traffic to the appropriate microservice based on the HTTP request method.

Web Service

The Web Service serves the web application, providing HTML pages for the user interface.

API Services

GET Service

Handles HTTP GET requests to retrieve book information.

POST Service

Handles HTTP POST requests to create new book entries.

PUT Service

Handles HTTP PUT requests to update existing book entries.

DELETE Service

Handles HTTP DELETE requests to remove book entries.

MongoDB

A MongoDB instance is used to store book information.

Setup and Running the Project

Prerequisites

  • Docker
  • Docker Compose

Steps to Build and Run the Project

  1. Clone the Repository
git clone <repository-url>
cd my_project
  1. Build and Start the Containers
docker-compose up --build

This command will build the Docker images for each service and start the containers.

  1. Access the Application

You can use tools like curl or Postman to test the API endpoints.

Testing the API

Example using curl to test the GET endpoint:

curl -X GET http://localhost/api/books

Configuration

NGINX Configuration

The NGINX configuration file is located at nginx/nginx.conf and routes traffic based on the request methods.

events {}

http {
    server {
        listen 80;

        location /api/books {
            if ($request_method = GET) {
                proxy_pass http://get_service:80;
            }
            if ($request_method = POST) {
                proxy_pass http://post_service:80;
            }
            if ($request_method = PUT) {
                proxy_pass http://put_service:80;
            }
            if ($request_method = DELETE) {
                proxy_pass http://delete_service:80;
            }
        }

        location / {
            proxy_pass http://web_service:80;
        }
    }
}

Environment Variables

Each service connects to MongoDB using the DATABASE_URI environment variable, which is set in the docker-compose.yml file:

environment:
  - DATABASE_URI=mongodb://mongodb:27017

Contact

For any inquiries, please contact the course instructor or the project maintainer.

cloud-computing-in2073-2024's People

Contributors

ndina 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.