Skip to main content

This project manages servers by rebooting using BCM due to crashes.

Project description

Starlyng Smart Reboot

This project manages servers by rebooting using BCM due to crashes.

Prerequisites

Install ipmitool on the server you will run the script. You can usually do this via your package manager:

  • Ubuntu: sudo apt-get install ipmitool
  • macOS: brew install ipmitool
  • If outside local network, set Port Forwarding on the network for BCM IP to 623

Before you begin, ensure you have met the following requirements:

  • You have installed Python 3.x.
  • You have a basic understanding of Python and virtual environments.

Setting Up Your Development Environment

To set up your development environment and run the project, follow these steps:

Clone the Repository

First, clone the repository to your local machine:

git https://github.com/starlyngapp/smart-reboot.git
cd smart-reboot

Create and Activate Virtual Environment

For macOS and Linux:

python -m venv venv
source venv/bin/activate

For Windows:

python -m venv venv
venv\Scripts\activate

Setup Environment for VSCode

  • Open the Command Palette (Ctrl+Shift+P)
  • Search for the Python: Create Environment command, and select it
  • Select Venv
  • Select Python interpreter
  • Select dependencies to install

Install Required Packages

Install all dependencies listed in the dev-requirements.txt file:

pip install -r dev-requirements.txt

Installation

To install only the package (without dev dependencies):

pip install starlyng_smart_reboot

To install development dependencies (useful for contributing to the project):

pip install starlyng_smart_reboot[dev]

Alternatively, you can install the development dependencies using:

pip install -r dev-requirements.txt

Environment Configuration

To configure smart reboot, you need to set up environment variables. This can be done by creating a .env file in the root of the project.

An example .env file is provided as .env.example. You can copy this file and update the values as needed.

Steps to Configure Environment Variables

  1. Copy the example environment file:
cp .env.example .env
  1. Open the .env file and update the values:
# .env
# List of server IPs and ports in the format ip:port, separated by commas
BCM_SERVERS=192.168.1.1:8001,192.168.1.2:8002

# BCM username
BCM_USER=user

# BCM password
BCM_PASSWORD=secret
  1. Save the .env file.

The BCM_SERVERS variable should be a comma-separated list of server IP addresses and ports.

Usage

To run the main function:

smart_reboot

PyPI

starlyng-smart-reboot

Command-line Arguments

You can also override configuration using command-line arguments:

smart_reboot --bcm_servers "192.168.1.1:22,192.168.1.2:22" --bcm_username "bcm_username" --bcm_password "secret"

Or locally:

python main.py --bcm_servers "192.168.1.1:22,192.168.1.2:22" --bcm_username "bcm_username" --bcm_password "secret"

Building and Uploading Your Package

  1. Build the package:
python setup.py sdist bdist_wheel
  1. Upload to PyPI:
twine upload dist/*

Upload using specific project name referenced in .pypirc

twine upload dist/* --repository starlyng-smart-reboot

Running Tests

To run tests, execute the following command in your terminal:

pytest

This command will run all tests and report the results. You can also run specific tests by providing the path and filename of the test file.

Contributing to the Project

Contributions to this project are welcome. Here's how you can contribute:

  1. Fork the project.
  2. Create your feature branch (git checkout -b feature/YourFeature).
  3. Commit your changes (git commit -am 'Add some YourFeature').
  4. Push to the branch (git push origin feature/YourFeature).
  5. Open a pull request.

Contact

If you have any questions, please contact us at:

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

starlyng_smart_reboot-0.1.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

starlyng_smart_reboot-0.1.1-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: starlyng_smart_reboot-0.1.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for starlyng_smart_reboot-0.1.1.tar.gz
Algorithm Hash digest
SHA256 28cd4dbfc64f8957f2f233cc4ed0433029f16e920502ec866aacfcb2c95868f3
MD5 c01c2a753734e072e045a6304cbeb992
BLAKE2b-256 40cfa21031ed86e5125aed1788139f9157d47131e3226025b239604bc6eb7215

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for starlyng_smart_reboot-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7f45e31525a58e38e719c0702ba86a8bc496278c90d51b54ec8a25bfce2a2c06
MD5 c0eed34577a8cd0e860c14abfc310e03
BLAKE2b-256 d669bfad3540cba64777d8394c7dcbfd048868dead53b74fde73ef29f0412959

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