Starlyng Server Management
This project manages servers by automatically rebooting them using Baseboard Management Controller (BCM) when crashes occur.
Prerequisites
Before you begin, ensure you have met the following requirements:
- Python 3.x installed
- Basic understanding of Python and virtual environments
- ipmitool installed on the server you will run the script:
- Ubuntu:
sudo apt-get install ipmitool - macOS:
brew install ipmitool
- Ubuntu:
- If outside local network, configure port forwarding on your router:
- Forward BCM port 623 to each server's unique port (62300-62399)
- Example: Forward port 62300 to 192.168.50.13:623, port 62301 to 192.168.50.14:623
- Port range must be between 62300-62399
Running
Using VSCode/Cursor
Run the Program:
- Go to the Run and Debug view (⌘+Shift+D, or Ctrl+Shift+D on Windows)
- Select the pre-configured launch configuration from the dropdown menu
- Click the green play button (F5) or use the "Run" menu to start the program
Setting Up Your Development Environment
-
Clone the repository:
git clone https://github.com/starlyngapp/server-management.git cd server-management
-
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_server_management
To install development dependencies (useful for contributing to the project):
pip install starlyng_server_management[dev]
Alternatively, you can install the development dependencies using:
pip install -r dev-requirements.txt
Create and activate a virtual environment:
- macOS/Linux:
python -m venv venv source venv/bin/activate
- Windows:
python -m venv venv venv\Scripts\activate
Releases to PyPi
This should be done through creating a new release in GitHub
Environment Configuration
To configure server management, 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
- Copy the example environment file:
cp .env.example .env
- Open the
.envfile 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:623,192.168.1.2:623
# BCM username
BCM_USER=user
# BCM password
BCM_PASSWORD=secret
- Save the
.envfile.
The BCM_SERVERS variable should be a comma-separated list of server IP addresses and ports.
Usage
To run the main function:
server_management
PyPI
Command-line Arguments
You can also override configuration using command-line arguments:
server_management --bcm_servers "192.168.1.1:623,192.168.1.2:623" --bcm_user "bcm_username" --bcm_pass "secret" --public_ip "false" --server_mgmt_dir "/path/to/server/mgmt/" --ssh_base_hostname "server" --ssh_key_path "/path/to/your/.ssh/id_rsa" --ssh_user "your_ssh_username" --ssh_vlan_id "10" --vast_api_key "vast_api_key"
Or locally:
python main.py --bcm_servers "192.168.1.1:623,192.168.1.2:623" --bcm_user "bcm_username" --bcm_pass "secret" --public_ip "false" --server_mgmt_dir "/path/to/server/mgmt/" --ssh_base_hostname "server" --ssh_key_path "/path/to/your/.ssh/id_rsa" --ssh_user "your_ssh_username" --ssh_vlan_id "10" --vast_api_key "vast_api_key"
Building and Uploading Your Package
- Build the package:
python setup.py sdist bdist_wheel
- Upload to PyPI:
twine upload dist/*
Upload using specific project name referenced in .pypirc
twine upload dist/* --repository starlyng-server-management
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:
- Fork the project.
- Create your feature branch (git checkout -b feature/YourFeature).
- Commit your changes (git commit -am 'Add some YourFeature').
- Push to the branch (git push origin feature/YourFeature).
- Open a pull request.
Contact
If you have any questions, please contact:
- GitHub: @justinsherwood
Metadata
Release files for starlyng-server-management 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| starlyng_server_management-0.2.2.tar.gz | 10.7 kB | Without provenance | Details for starlyng_server_management-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| starlyng_server_management-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for starlyng_server_management-0.2.2-py3-none-any.whl |
Total release size: 21.9 kB
Release files / starlyng_server_management-0.2.2.tar.gz
| Download URL | starlyng_server_management-0.2.2.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
971bd6089842d1448afbaf4a7de957d65a0ff57b86ba829d2ab9dcfdbae22d09
|
|
BLAKE2b-256 checksum How to use checksums |
f12a4f4d271a5681d54ffb87911c3d85dca7ace9e2c0c1252a917974c8241c41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.20
|
Release files / starlyng_server_management-0.2.2-py3-none-any.whl
| Download URL | starlyng_server_management-0.2.2-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc37716be64bcb54f5fe8ce4324865ce5572808366378a71767ecaa46ae2ef99
|
|
BLAKE2b-256 checksum How to use checksums |
af19a3df71a5daa1388232086038912b0c7113d62f00fe7e9ead1599f9b8551e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.9.20
|
Security for starlyng-server-management 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.