Skip to main content

Infrastructure deployment automation toolkit

Project description

InfraDrone ๐Ÿš€

InfraDrone is a robust infrastructure automation tool designed to simplify the deployment and management of cloud resources, Docker containers, and SSH configurations. With support for multiple cloud providers and a user-friendly terminal interface, InfraDrone empowers developers and DevOps engineers to streamline their workflows.


Features โœจ

  • Cloud Infrastructure Deployment:

    • Supports Yandex Cloud and Google Cloud Platform (GCP).
    • Automates VM creation with Terraform templates.
    • Configures SSH access for deployed instances.
  • Docker Management:

    • Deploys Docker containers with pre-configured templates.
    • Includes support for Keycloak and PostgreSQL.
  • SSH Configuration:

    • Manages SSH keys and connections.
    • Automatically updates ssh.json for easy access.
  • Extensible Architecture:

    • Easily add new cloud providers or Docker templates.
    • Modular design for custom workflows.

Project Structure ๐Ÿ“‚

infradrone/
โ”œโ”€โ”€ config.py               # Configuration loader and saver
โ”œโ”€โ”€ deploy.py               # Terminal-based deployment menu
โ”œโ”€โ”€ infra_operations.py     # Core infrastructure deployment logic
โ”œโ”€โ”€ menus/                  # Terminal UI menus
โ”‚   โ”œโ”€โ”€ main_menu.py        # Main menu for navigation
โ”‚   โ”œโ”€โ”€ ssh_connections.py  # SSH connection management
โ”‚   โ””โ”€โ”€ deploy_docker.py    # Docker deployment menu
โ”œโ”€โ”€ tf/                     # Terraform templates for cloud providers
โ”‚   โ”œโ”€โ”€ gcp/                # GCP-specific templates
โ”‚   โ””โ”€โ”€ yc/                 # Yandex Cloud-specific templates
โ”œโ”€โ”€ docker/                 # Docker templates
โ”‚   โ””โ”€โ”€ ubuntu/keycloak/    # Keycloak Docker setup
โ”œโ”€โ”€ sh/                     # Shell scripts for installation and helpers
โ”œโ”€โ”€ utils.py                # Utility functions
โ”œโ”€โ”€ main.py                 # Entry point for the application
โ”œโ”€โ”€ requirements.txt        # Python dependencies
โ”œโ”€โ”€ README.md               # Project documentation
โ””โ”€โ”€ config.ini              # Configuration file

Installation ๐Ÿ› ๏ธ

Prerequisites

  • Python 3.10+
  • Terraform 0.13+
  • Docker and Docker Compose
  • Cloud provider credentials (e.g., GCP or Yandex Cloud)

Steps

  1. Clone the repository:

    git clone https://github.com/HMCorp-Fund/infradrone/infradrone.git
    cd infradrone
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Configure the project:

    • Edit config.ini to set the BaseDirectory:
      [Paths]
      BaseDirectory = %%USERPROFILE%%\infradrone
      
    • Add your cloud provider credentials to config.json.
  4. Run the application:

    python main.py
    

Configuration ๐Ÿ“„

Before using InfraDrone, you need to configure the project by editing the config.json file and ensuring the required keys are in place.

1. Configuring config.json

The config.json file contains essential settings for InfraDrone, including SSH credentials, working directories, and cloud provider configurations. Below is an explanation of the key fields:

Example config.json:

{
    "DEFAULT_SSH_PASSWORD": "admin",
    "DEFAULT_SSH_USER": "admin",
    "WORKING_DIR": "C:\\users\\user\\infradrone\\working_dir",
    "KNOWN_HOSTS_DIR": "~\\.ssh\\known_hosts",
    "SSH_PROVIDER": "gcp",

    "PROVIDERS": {
        "yc": {
            "YC_TOKEN": "your-yandex-cloud-token",
            "YC_CLOUD_ID": "your-cloud-id",
            "YC_FOLDER_ID": "your-folder-id",
            "YC_CLOUD_PREFIX": "your-cloud-prefix",
            "YC_ZONE": "your-zone"
        },
        "gcp": {
            "GCP_CREDENTIALS_FILE": "C:\\users\\user\\infradrone\\keys\\your-gcp-credentials.json",
            "GCP_PROJECT_ID": "your-gcp-project-id",
            "GCP_ZONE": "your-gcp-zone",
            "GCP_VM_ZONE": "your-gcp-vm-zone",
            "GCP_NETWORK": "default",
            "GCP_SUBNET": "default",
            "GCP_SSH_KEY": "C:\\users\\user\\infradrone\\keys\\gcp",
            "GCP_SSH_KEY_PASS": "your-ssh-key-password",
            "GCP_SSH_USER": "your-ssh-username"
        }
    }
}

Key Fields:

  • DEFAULT_SSH_USER and DEFAULT_SSH_PASSWORD:
    • Default SSH credentials for connecting to instances.
  • WORKING_DIR:
    • Directory where temporary files and logs will be stored.
  • KNOWN_HOSTS_DIR:
    • Path to the SSH known_hosts file.
  • SSH_PROVIDER:
    • The default cloud provider (gcp or yc).
  • PROVIDERS:
    • Contains provider-specific configurations:
      • Yandex Cloud (yc):
        • YC_TOKEN: Yandex Cloud API token.
        • YC_CLOUD_ID and YC_FOLDER_ID: IDs for your Yandex Cloud project.
        • YC_ZONE: The zone where instances will be deployed.
      • Google Cloud Platform (gcp):
        • GCP_CREDENTIALS_FILE: Path to your GCP service account JSON key.
        • GCP_PROJECT_ID: Your GCP project ID.
        • GCP_ZONE and GCP_VM_ZONE: Zones for deploying instances.
        • GCP_SSH_KEY: Path to your SSH private key for GCP.
        • GCP_SSH_USER: Username for SSH connections.

2. Creating an SSH Key

Before deploying infrastructure, you must create an SSH key pair for secure access to your instances.

Steps to Create an SSH Key:

  1. Open a terminal or PowerShell.
  2. Run the following command to generate an SSH key pair:
    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    
  3. Save the key to the specified path (e.g., C:\users\user\infradrone\keys\gcp).
  4. Add the public key to your cloud provider's metadata:
    • Google Cloud: Add the public key to the "SSH Keys" section in the GCP console.
    • Yandex Cloud: Add the public key to the "SSH Keys" section in the Yandex Cloud console.

3. Creating a Google Cloud Key

To use InfraDrone with Google Cloud, you need a service account key for authentication.

Steps to Create a GCP Service Account Key:

  1. Go to the Google Cloud Console.
  2. Navigate to IAM & Admin > Service Accounts.
  3. Create a new service account or select an existing one.
  4. Assign the necessary roles (e.g., Compute Admin and Storage Admin).
  5. Generate a JSON key for the service account:
    • Click Manage Keys > Add Key > Create New Key.
    • Save the JSON key to C:\users\user\infradrone\keys\your-gcp-credentials.json.
  6. Update the GCP_CREDENTIALS_FILE field in config.json with the path to this key.

Usage ๐Ÿš€

Main Menu

Navigate through the terminal-based menu to deploy infrastructure, manage Docker containers, or configure SSH connections.

Deploying Cloud Infrastructure

  1. Select a cloud provider (e.g., Yandex Cloud or GCP).
  2. Choose an OS and a template.
  3. Provide instance details (e.g., name, allowed ports).
  4. InfraDrone will deploy the instance and configure SSH access.

Managing Docker Containers

  1. Select a Docker OS and template.
  2. InfraDrone will deploy the container using docker-compose.

SSH Configuration

  • View, add, or delete SSH connections directly from the menu.

License ๐Ÿ“œ

This project is licensed under the MIT License. See the LICENSE file for details.


Happy automating! ๐ŸŽ‰

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

infradrone-0.1.1.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

infradrone-0.1.1-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file infradrone-0.1.1.tar.gz.

File metadata

  • Download URL: infradrone-0.1.1.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for infradrone-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a9f0160462442966da82e31effec52690d466f0c7a3a0c46da95a12b1d41abdd
MD5 ca8f335905bf2e7ea37a9ec34a5923a5
BLAKE2b-256 2a01efcc131498eac9e16295394c2e5ac3d061977cfcc8396f068e86bf9577a6

See more details on using hashes here.

File details

Details for the file infradrone-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: infradrone-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for infradrone-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 324993fe9632e975c84f6eb80769f7336e1a2e481591845178ce92ff33cbcac6
MD5 9bc40e9d739cc029942bdf86a82a8e12
BLAKE2b-256 d99957b6e195c338f75a2e55ab039721d871be2e2b04e9121afdd6cdf3e30e0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page