Skip to main content

The Python script & library for managing web service stack

Project description

VNGuru TOOLS

This Python package contains a collection of tools for managing webserver's stack from provisioning, deployment, to configuration.


Compatibility

Ubuntu 22.04 and Ubuntu 24.04


Notices

Python >=3.10 is required for this project.


Prerequisites

  • Python 3.10 or higher (most of the OS current supported)
  • Terraform CLI How to install
  • Ansible How to install
  • The sshpass package, please use this command
# Ubuntu
sudo apt install sshpass
# MacOS
brew install sshpass

Getting Started

Installation

python -m venv .venv
source .venv/bin/activate

Then, you can install vg_management from PyPI with:

python -m pip install vg_tools

See All Options

vg_deploy --help

Server is already provisioned

Please make sure the ssh connection is allowed. Then, let's begin deployment.

# Using ssh password authentication
vg_deploy --provisioned-ip <server_ip> --ssh-password <ssh_password>
# or if you prefer ssh-key authentication
vg_deploy --provisioned-ip <server_ip> --ssh-key-file <key_file_path>

Deploy to multiple servers are supported

vg_deploy --provisioned-ip <server_ip_1> <server_ip_2> --ssh-password <ssh_password>

Server is not provisioned yet

Currently, we only support provisioning server based on terraform and only support DigitalOcean Cloud Provider. First, you need to create a DigitalOcean token, please follow this guide Then, create an ssh key pair with this command

# Leave all the option as default
ssh-keygen
# Check the key
cat ~/.ssh/id_rsa.pub # Public key
cat ~/.ssh/id_rsa # Private key

Please note that the ssh key pair location is kept as default, if you change the location when you generate the key pair, please change the --ssh-key-file and --ssh-key-file variables in the vg_tools.py accordingly

Now run the tools with those informations to provision and deployment a webserver

DO_TOKEN=<digitalocean_key> vg_deploy

Post Deployment

When the first deployment is done, if you want to install another php version to your server, please run

vg_deploy --php-version 8.3 --provisioned-ip <server_ip> --ssh-password <ssh_password>

All the installed and configured softwares will be ignored, the command only installs php 8.3


Cleanup

The tool is not support cleanup yet, please manually delete the server with terraform command

Inside the vg_provisioning directory, we could find the terraform state file

# Get the python package
python -m pip show vg_tools
# Get the location of the python package
# Like this
Location: /root/.venv/lib/python3.10/site-packages

cd <Location>/vg_provisioning
# Get the state file
ls -la | grep tfstate

Run destroy to delete the server

terraform destroy

## Input the values
var.do_ssh_key_name
  Enter a value:

var.do_ssh_pubkey_file
  Enter a value: /root/.ssh/id_rsa

var.do_token
  Enter a value: <your_do_key>

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

vg_tools-0.1.0.post3-py3-none-any.whl (73.5 kB view details)

Uploaded Python 3

File details

Details for the file vg_tools-0.1.0.post3-py3-none-any.whl.

File metadata

File hashes

Hashes for vg_tools-0.1.0.post3-py3-none-any.whl
Algorithm Hash digest
SHA256 894ea214e560503e589c2fb60719fe49d89dd25834242b096a66280ef529f314
MD5 b12b82751ccf00580748e515c04ad64f
BLAKE2b-256 7f7c3933963ad3d9d72498d38031e30e8f3f36e05aaab9cc19bb16a91104802a

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