This project involved the containerization and deployment of a full-stack yolo application using Docker.
Install the docker engine here:
-
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
-
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
http://localhost:3000/
- Navigate back to your terminal and press "ctrl+c"
docker-compose down
(https://hub.docker.com/repositories/p801)
docker pull p801/yolo-backend-app:V5.1
docker pull p801/yolo-app-frontend:V1.0
docker images
I have cloned the github repository
https://github.com/bryanphilips/yolo.git
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
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
yolo/
├── provisioning/
│ ├── playbook.yml
│ ├── vars.yml
│ ├── hosts
│ └── roles/
│ ├── backend/
│ │ └──tasks/
│ │ └── main.yml
│ │
│ ├── frontend/
│ │ └── tasks/
│ │ └── main.yml
│ │
│ └── mongodb/
│ ├── tasks/
│ │ └── main.yml
│ └── files/
└── Vagrantfile
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.
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
vagrant up
├── /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
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.