Git Product home page Git Product logo

yolo's Introduction

Overview

This project involved the containerization and deployment of a full-stack yolo application using Docker.

Requirements

Install the docker engine here:

How to launch the application

Method 1 (faster)

  • NOTE: This method does not require cloning of this repository

  • Navigate to the launch_app folder and copy the contents of the [docker-compose.yaml] in the root of the project

  • On your local machine, navigate to your desired directory and create a docker-compose.yaml file, paste the contents into it and save

    touch docker-compose.yaml
    
  • Launch the application using docker compose up

    docker-compose up
    
  • Terminate the application using docker compose down

      docker-compose down
    

Method 2

  • NOTE: This requires cloning of this whole repository

  • Clone this repository to your local machine

    git clone https://github.com/bryanphilips/yolo.git
    
  • Navigate to the root directory of your cloned repository

    cd yolo

  • Launch the application using the docker-compose command

    docker-compose up
    

Access the application on your browser using the following URL

http://localhost:3000/

Screenshot of the launched application

Yolo frontend

Screenshot after adding products

yolo product persistent

How to stop the application

  • Navigate back to your terminal and press "ctrl+c"

How to terminate the application completely

docker-compose down

The Docker images used in this application are sourced from this repository

(https://hub.docker.com/repositories/p801)

The backend repository on dockerhub

docker pull p801/yolo-backend-app:V5.1

The frontend repository on dockerhub

docker pull p801/yolo-app-frontend:V1.0

Copy the command below to find out the image size after successful docker pull

docker images

You should see something similar to this

dockerimages size

IP3 Configuration Management

Approach

I have cloned the github repository

    https://github.com/bryanphilips/yolo.git

Security Improvements

hosts file

Created the hosts file with custom service hostname that can show mapping of the ip to a name then asign the name in the main.yml file

update of the playbook.yml

The playbook.yml where we have
name: Copy hosts file
copy:

    src: hosts

    dest: /etc/hosts

    owner: root

    group: root

    mode: "0644"

In the mode: '0644' setting:

  0 - No special permissions  are set.

  6 - The owner of the file has read and write permissions (rw-).

  4 - The group has read-only permissions (r--).

  4 - Others have read-only permissions (r--).

So, 0644 means:

  Owner: Read and write

  Group: Read only

  Others: Read only

Project Structure

yolo/
├── provisioning/
│   ├── playbook.yml
│   ├── vars.yml
│   ├── hosts
│   └── roles/
│       ├── backend/
│       │   └──tasks/
│       │       └── main.yml
│       │   
│       ├── frontend/
│       │   └── tasks/
│       │       └── main.yml
│       │   
│       └── mongodb/
│           ├── tasks/
│           │   └── main.yml
│           └── files/
└── Vagrantfile

Summary Description and running of the project

Summary

This setup ensures that your Vagrant VM is properly configured with Docker containers and that hostname resolution is handled through the hosts file, enabling seamless communication between services.

Description

Directory Structure: Organize the project with provisioning, roles, and Vagrantfile.

Hosts File: Define hostname mappings in provisioning/hosts.

Ansible Playbook: Include tasks to handle Docker setup and copy the hosts file.

Roles: Define roles for running Docker containers with correct hostnames.

Vagrantfile: Configure Vagrant to use the ubuntu/jammy64 box and run Ansible provisioning.

vars.yml: used to define variables network, volume, images and ports

Running the Application

  vagrant up

Screenshot after running vagrant up you should see

Screenshot from 2024-08-05 23-22-08

IP4 Orchestration

The project structure in orchestration

  ├── /manifests
  │   ├── /deployment
  │   │   ├── yolo-backend-deployment.yaml
  │   │   └── yolo-frontend-deployment.yaml
  │   │
  │   ├── /headless-service
  │   │   └── mongo-headless-service.yaml
  │   │
  │   ├── /secrets
  │   │   └── mongo-secret.yaml
  │   │
  │   ├── /service
  │   │   ├── yolo-backend-service.yaml
  │   │   └── yolo-frontend-service.yaml
  │   │
  │   ├── /statefulset
  │   │   └── mongo-statefulset.yaml

Prerequisites

Before you begin, ensure you have the following tools installed:

kubectl - Command-line tool for interacting with the Kubernetes API.

gcloud - Command-line tool for Google Cloud Platform (GCP).

Docker - Containerization platform.

Successful GCP configuration screenshot

Screenshot from 2024-08-19 19-48-07

Screenshot from 2024-08-19 19-59-33

For detailed explanation to achieve orchestration kindly see orchestration-explanation.md file

yolo's People

Contributors

bryanphilips avatar jonnygovish avatar vinge1718 avatar maubinyaachi 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.