GithubHelp home page GithubHelp logo

prasadashu / ottserver-deployer Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 75 KB

This project showcases the deployment of an Over-the-Top (OTT) media streaming server with a strong focus on scalability, containerization and load balancing.

Python 38.58% Dockerfile 16.74% Jinja 44.68%
ansible docker docker-compose ansible-playbook ansible-roles dockerfile

ottserver-deployer's Introduction

OTTServer-Dockerized-Deployer

The project is in association with https://github.com/official-srv-modak/OTTServer.

Repository to deploy containerized OTTServer through Ansible.

How to deploy OTTServer?

  • Install Ansible in RedHat based distros.
sudo yum install -y ansible
  • Clone this repo.
git clone https://github.com/prasadashu/OTTServer-Deployer.git
  • Execute the playbook.
ansible-playbook deploy_dockerized_ottserver.yml -i inventory/inventory.txt --extra-vars "{'host':'db_web_server'}"
  • Access the home page through port 5000.

Repository File Structure

.
├── deploy_dockerized_ottserver.yml
├── host_vars
│   └── db_web_server.yml
├── inventory
│   └── inventory.txt
├── library
│   └── custom_debug.py
├── mariadb
│   └── Dockerfile
├── nginx
│   ├── Dockerfile
│   └── nginx.conf
├── php-apache-web
│   └── Dockerfile
├── README.md
├── roles
│   ├── firewall_setup
│   │   └── tasks
│   │       └── main.yml
│   ├── python_dependency
│   │   └── tasks
│   │       └── main.yml
│   ├── setup_dependencies
│   │   └── tasks
│   │       └── main.yml
│   ├── setup_scripts
│   │   ├── tasks
│   │   │   └── main.yml
│   │   └── templates
│   │       ├── db.php.j2
│   │       └── path.php.j2
│   └── spin_up_docker
│       └── tasks
│           └── main.yml
├── templates
│   └── docker-compose.yml.j2
└── TO_DO.txt

Repository details

  • Docker is configured to run three services.

    • web service to run the web server.
    • db service to run the db server.
    • nginx service to run the load balancer.
  • By default, three web containers are set to spin up when the server is deployed.

  • These web containers are being load balanced through an NginX container.

  • The NginX container is running on port 5000 and so should be the port to access the home page.

  • One can check the running containers in the background using the command below.

docker ps
  • Firewall has been enabled as part of the deployment process.

  • Firewall enabled ports can be viewed using the below command.

firewall-cmd --list-all
  • Scaling up of containers can be achieved through the command below.
docker-compose up -d --scale <service_name_1>=<number of containers> <service_name_1>=<number of containers>
  • An example to scale web server containers to 5.
docker-compose up -d --scale web=5

Configuration details

  • The deployment can be configured at host_vars/db_web_server.yml.

  • ansible_connection is set to local.

    • Other possible value ssh
    • Do not use winrm as the repo is configured for RedHat based distros.
  • The Linux user, group and password for OTTServer admin can be changed.

    • flix_admin to change the Linux user.
    • flix_admin_group to change the Linux group.
    • flix_admin_pass to change the Linux user password.
  • The database user and credentials can be configured.

    • mysql_db to change the DB name.
    • mysql_user to change the DB user.
    • mysql_password to change the DB user password.
    • mysql_root_password to change the DB root password.
  • The hosted path for the server can be changed through path_server.

  • A password salt value can be changed through password_salt.

Encrypting using Ansible Vault

The file host_vars/db_web_server.yml containing all the credentials is set in plain text format for display purposes. However, this file can be encrypted using Ansible Vault.

  • To encrypt the file use the command
ansible-vault encrypt host_vars/db_web_server.yml
  • To view the encrypted file use the command
ansible-vault view host_vars/db_web_server.yml
  • To run the playbook with the encrypted vault file
ansible-playbook deploy_dockerized_ottserver.yml -i inventory/inventory.txt --extra-vars "{'host':'db_web_server'}" --ask-vault-pass

Version details

The below tech stack versions have been used to test the project:-

  • OS: CentOS Linux release 7.7.1908 (Core)

  • Ansible: ansible 2.9.25

  • Web Dockerfile base image: php:7.2-apache

    • Apache: 2.4.38 (Debian)
    • PHP: 7.2.34 (cli)
  • DB Dockerfile base image: mariadb:10

    • MariaDB: mariadb Ver 15.1 Distrib 10.6.4-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
  • NginX Dockerfile base image: nginx:1.21

    • NginX: nginx/1.21.3
  • Docker compose: docker-compose version 1.29.2

  • Docker version: Docker version 19.03.6, build 369ce74a3c

ottserver-deployer's People

Contributors

prasadashu avatar

Stargazers

 avatar  avatar

Watchers

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