/marksix

Primary LanguagePython



Marksix

This document highligth the manual or automatic deployment and installation of the marksix applications. The user of this guide should be familiar with the Linux environment,have basic understanding of Python, git, docker.

Structure of the Project

The Marksix project is comprised with 3 type of applications, the betting server, web server, chat application:

  • Betting server:

    It is a Standalone python application that handle any marksix betting data by default running on port 9001.

  • Web server:

    It is a python flask webserver application that handle any http marksix betting connecxion by default running on port 9002.

  • Chat application:

    It is a python terminal application that allow you to communicate with the betting server.

Requirement

  • Environment

    • Operating System : GNU/Linux Ubuntu 18.04
    • CPU : 4 core 3693 MHz
    • Memory : 4GB or more
  • Software packages

    Packages Version
    docker 18.09.7
    docker-compose 1.24.1
    python 3.6.9
    git 2.17.1

Installation Guide

  • Automatic installation

    Download the installation script following the below command.

    ~$ sudo curl -L "https://raw.githubusercontent.com/eirtdev/shell/master/marksix" -o /usr/local/bin/marksix && sudo chmod +x /usr/local/bin/marksix

    Now go ahead and run the below command and wait.

    ~$ marksix install
  • Mannual Installation

    • Preparing the environment

      • Install all the require packages

        • Install docker

          ~$ sudo apt-get install docker.io
        • Install docker-compose

          ~$ sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

          Make the docker-compose file executable

          ~$ sudo chmod +x /usr/local/bin/docker-compose
        • Install python3.6

            ~$ sudo apt-get install -y software-properties-common && sudo add-apt-repository ppa:deadsnakes/ppa && sudo apt-get update && sudo apt-get install -y python3.6 && sudo apt-get install -y python3-pip
            ~$ python_path=`which python`
            ~$ python6_path=`which python3.6`
            ~$ sudo unlink $python_path
            ~$ sudo ln -s $python6_path $python_path
        • Checking the pre-requisite packages installation

          ~$ python --version
          Python 3.6.9
          ~$
          ~$ docker --version
          Docker version 19.03.6, build 369ce74a3c
          ~$
          ~$ docker-compose --version
          
          docker-compose version 1.24.1, build 4667896b
          ~$
          ~$ git --version
          git version 2.17.1
          ~$
    • Clone the marksix repository

       ~$ git clone https://github.com/eirtscience/marksix.git

      Move into the cloned folder and run the below command

      ~$ cd marksix && pip3 install -r package.txt
  • Run Installation

    • Run Server

      • Run on the host

        The below command will run the betting and the http server in the background. Before running this command make you create a virtual environment and your python version is 3.5+.

        To run the server make sure you are in the cloned folder.

        ~$ marksix run host

        Now you run the above command go ahead and test it.

      • Run with docker

        ~$ marksix run docker
    • Run Application

      • Automatic Simulator

        In the cloned folder execute the below command.

        ~$ marksix test auto

        The auto command will randomly simulate the betting user at the same time check the result of his betting.

      • Http Request

        you can also submit a betting number using a linux curl command

        • Marksix Bet

          ~$ curl -d '{"number":"21 11 33 5 7 1"}' -X POST http://127.0.0.1:9002/bet/ && echo
          
          {"betting_number": "21 11 33 5 7 1", "draw_status": "In progress", "token": "bb989f353fc", "draw_id": "1e28c17a7c1b4e2", "time_before_draw": 98}
          
        • Marksix Ticket

          On the same terminal to view the draw progress, use the below curl command.

          ~$ curl http://127.0.0.1:9002/ticket/ && echo
          {"betting_number": "21 11 33 5 7 1", "draw_status": "In progress", "token": "bb989f353fc", "draw_id": "1e28c17a7c1b4e2", "time_before_draw": 20}
        • Marksix Draw

          You can also view the draw history using the below curl command.

          ~$ curl  http://127.0.0.1:9002/draw/ && echo
          
          [{"id": "df93be896f31406", "draw_number": "2-12-1-11-24-33", "special_number": 35, "date": "2020/07/21 15:40", "prize": "No winner"}, {"id": "e1365431b302471", "draw_number": "24-35-18-11-34-14", "special_number": 17, "date": "2020/07/21 15:40", "prize": "No winner"}]
      • Chat Application



        ~$ marksix test chat

        to submit a betting number "11-21-4-37-11-26", in the command terminal enter "bet 11-21-4-37-11-26". This chat terminal will be listen into the result event. Once the result of the draw is available the betting server will push the result into your terminal.

        You can also ask for the result by simply type "draw".

  • Kill all the server

    • Kill all the server on the host

      The below command will destroy the betting

      ~$ marksix kill