Coder Social home page Coder Social logo

octopus's Introduction

Octopus Project

Octopus is an Ansible-based project to deploy a poll application across multiple machines without using containers. This application consists of a Python Flask web client, a Redis queue, a Java worker, and a Node.js web client that displays the results.

TABLE OF CONTENTS

  1. Getting Started
  2. Features
  3. Environment Setup
  4. Repository Structure
  5. Usage
  6. Important Notes

Getting Started

To get started with the project, make sure you have the following prerequisites:

Ansible installed on your local machine Access to 5 Debian 10 (Buster) virtual machines A cloud platform account (optional, but recommended)

Features

The project includes 6 Ansible roles:

  1. base: Configures all machines and installs useful packages.
  2. redis: Installs and sets up Redis.
  3. postgresql: Installs PostgreSQL 12, psql tool, and creates the necessary user and schema.
  4. poll: Uploads poll service, installs dependencies, and runs the poll web client.
  5. worker: Uploads worker service, installs dependencies, builds the worker, and runs the worker.
  6. result: Uploads result service, installs dependencies, and runs the result web client.

Environment Setup

Your inventory should have 5 groups, each containing 1 instance: redis, postgres, poll, result, and worker. You will need 5 virtual machines based on Debian 10 (Buster). You can run it locally, but it is recommended to use a cloud platform. Do not spend too much credit, as you may need cloud platforms for future DevOps projects.

Repository Structure

.
├── playbook.yml
├── poll.tar
├── result.tar
├── worker.tar
├── group_vars
│   └── all.yml
└── roles
    ├── base
    │   └── tasks
    │       └── main.yml
    ├── postgresql
    │   ├── files
    │   │   ├── pg_hba.conf
    │   │   └── schema.sql
    │   └── tasks
    │       └── main.yml
    ├── redis
    │   ├── files
    │   │   └── redis.conf
    │   └── tasks
    │       └── main.yml
    ├── poll
    │   ├── files
    │   │   └── poll.service
    │   └── tasks
    │       └── main.yml
    ├── result
    │   ├── files
    │   │   └── result.service
    │   └── tasks
    │       └── main.yml
    └── worker
        ├── files
        │   └── worker.service
        └── tasks
            └── main.yml

Usage

  • Set the ANSIBLE_VAULT_PASSWORD_FILE environment variable and store your vault password: :
export ANSIBLE_VAULT_PASSWORD_FILE=/tmp/.vault_pass
echo verySecretPassword > /tmp/.vault_pass
  • Run the Ansible playbook using your own inventory file named production:
ansible-playbook -i production playbook.yml

Important Notes

  • Docker, Podman, and Ansible Galaxy are forbidden for this project.
  • Clear-text passwords found in the repository will result in the project being considered as failed. Use Ansible Vault to secure sensitive information.
  • All services must be managed by systemd and start automatically on boot.
  • Services must be configured with environment variables, such as: host, port, user, password, database name, etc.
  • Idempotence should be maintained. After applying the Ansible playbook twice, there should be as few changed tasks as possible in your PLAY RECAP.
  • Avoid using the command / shell / raw modules as much as possible. Use dedicated modules like apt_key, apt_repository, or pip. Use the command module only if no dedicated module exists.

(back to top)

octopus's People

Contributors

jvlxz avatar

Watchers

 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.