Skip to content

Sailboat is a Docker controller application to be used by software developers. It has multiple modes to utilize the capabilities of the Docker. Also, it can take additional arguments the extend these capabilities like pushing images to desired container registry.

Notifications You must be signed in to change notification settings

huyagci/sailboat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Protein DevOps Engineer Bootcamp

Project of the Third Week

Built with;

Linux Bash Docker VirtualBox Vagrant

#️⃣ Assignment

Create a script that helps the developer to dockerize their applications, deploy it locally or push to a remote container registry.

Provide a MySQL or MongoDB database service with Docker Compose in addition to the application.1

Script has to be able to ;

  • Build and run docker images.
  • Push the image to the Docker Hub or Gitlab Container Registry.
  • Limit machine resources like CPU and memory if relevant arguments are given. (Default is limitless)
  • Deploy additional services like MySQL or Mongo Database with Docker Compose.

📖 Table of Contents

  1. Overview
  2. Features
  3. Installation
  4. Usage
  5. Technologies
  6. Directories
  7. Submitted Assignment

📔 Overview 🔝

This repository contains an assignment project developed under the Patika.dev & Protein DevOps Engineer Bootcamp. Bootstrapper is an initializer script that sets up the machine as instructed. Sailboat is the main script that is coded by the terms of the project.

 

Sailboat Branding Image

Features 🔝

Bootstrapper

  • Sets the timezone of the machine as UTC+3 (Europe/Istanbul) and enables Network Time Protocol.
  • Downloads the latest package information.
  • Downloads, installs, and configures Docker Engine and Docker Compose.
  • Sets the permissions of the script files.
  • Defines a system-wide alias of the main script for easy use.

Sailboat

  • Has three modes: Build, Deploy, and Template.
  • Build and deploy modes may take additional arguments like image name and image tag to define image properties.
  • Build mode may also take "--registry" argument which will cause re-tag the image with the defined username.
  • The re-tagged image will be pushed to the specified container registry.
  • With deploy mode, you may also name your container and set CPU and memory limits.
  • Template mode will assist the user with predefined database services in addition to the main image.
  • Docker-compose is used in template mode with pre-defined database services are MySQL and MongoDB.

⚙️ Installation 🔝

Automated
  1. Install VirtualBox and Vagrant to your machine if you do not have them.
  2. Clone the project to your machine.
  3. Open your CLI, change directory to project directory, and type vagrant up.
  4. Vagrant will configure the virtual machine first then you may test the project.
Manual
  1. Download all of the project files.
  2. Copy all scripts under the /shared/scripts and sample project from /shared/projects/python to your environment.
  3. Execute bootstrap.sh first to configure the machine.
  4. Make sure your environment has a Docker installation too.
  5. Run the scripts with the aliases configured or manually from the directories that are stated below.

🔧 Usage 🔝

  • Built-in alias is sailboat You may use it if you executed bootstrap.sh first.
  • Optionally, you may call the scripts from any directory with an acceptable arguments that are stated below.
  • The target directory of Sailboat script is /opt/projects/python directory.
  • You can change these settings by re-defining the TARGET_DIR variable within the configuration file of the script.
Parameters
OPTIONS:                 ARGUMENTS:                DESCRIPTION:                     OBLIGATION:

-m | --mode              <build|deploy|template>   Mode selection.                  Mandatory for ALL modes.
-n | --image-name        <image-name>              Docker image name.               Mandatory for BUILD and DEPLOY modes.
-t | --image-tag         <image-tag>               Docker image tag.                Mandatory for BUILD and DEPLOY modes.
-r | --registry          <dockerhub|gitlab>        Docker Hub or GitLab Registry.   Optional for BUILD Mode.
-c | --container-name    <container-name>          Container name.                  Optional for DEPLOY mode.
-p | --cpu               <cpu-limit>               Container CPU limit              Optional for DEPLOY mode.
-s | --memory            <memory-limit>            Container memory limit.          Optional for DEPLOY mode.
-a | --application-name  <mongo|mysql>             Run MySQL or MongoDB server.     Mandatory for TEMPLATE mode.
-h | --help                                        Shows this help message.

💻 Technologies 🔝

  • Linux
  • Bash Scripting
  • Docker ❤️
  • Oracle VM VirtualBox
  • Vagrant by HashiCorp

📂 Directories 🔝

Scripts             : /opt/scripts
Configurations      : /opt/scripts/configs
Sample Project      : /opt/projects/python

💾 Submitted Assignment 🔝

You may check out the submitted version of this project here.

View Counter

Footnotes

  1. A simple Python application(flask) is provided as a sample project and the script is built upon this configuration. (Can be modified to any other project)

About

Sailboat is a Docker controller application to be used by software developers. It has multiple modes to utilize the capabilities of the Docker. Also, it can take additional arguments the extend these capabilities like pushing images to desired container registry.

Topics

Resources

Stars

Watchers

Forks