Skip to content

abejide001/container-deployment

Repository files navigation

Using Containers for Deployment

Introduction

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings

Technologies Used

  • Docker - Docker is a computer program that performs operating-system-level virtualization
  • Kubernetes - Kubernetes (K8s) is an open-source system for automating deployment, scaling, and management of containerized applications Chart_02_Kubernetes-Architecture
  • Google Cloud Platform

How the application works

The Dockerfiles directory contains the dockerfile for the frontend and backend service.

  • The backend dockerfile

Screenshot 2019-04-30 at 11 04 17 PM

The commands are being executed in sequece when the dockerfile is ran, the file can be rexecuted with the command `docker build -t backend.dockerfile .`
  • The frontend dockerfile

Screenshot 2019-04-30 at 11 11 34 PM

The frontend image is built from a `node:10.15.3-alpine` image, the commands are being executed in sequence, the frontend can be executed with the command `docker build -t frontend.dockerfile .`

The Kubernetes deployments directory contains the deployments configurations for the database, backend and frontend of the application

  • The frontend kubernetes deployment script

Screenshot 2019-04-30 at 11 18 05 PM

Kubernetes deployment api object was being to used to deploy the frontend docker image built as a running container in the pod inside the cluster, 3 **replicas** were created, so there will be 3 running pods, this is because if one fails another pod is going to start running, to acheive high availability.
  • The backend kubernetes deployment script

Screenshot 2019-05-01 at 12 03 25 AM

The backend runs the backend image built in a running container, the backend uses the database in the container, the backend as 3 **replicas**
  • The database kubernetes deployment script

Screenshot 2019-05-01 at 12 11 28 AM

Volume were being used to persist the database data, there are 2 **replicas** for the database.

How to run the application

  • Create a .env file
  • Copy the content of the .env.sample and paste into the .env file
  • Run the database deployment script with the command
$ ./database.sh
  • Run the backend deployment script with the command
$ ./backend.sh
  • Run the frontend deployment script with the command
$ ./frontend.sh

Acknowledgement

  • Timileyin Farayola

About

Using Containers for Deployment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages