starlyng-smart-reboot


Namestarlyng-smart-reboot JSON
Version 0.2.4 PyPI version JSON
download
home_pagehttps://github.com/starlyngapp/smart-reboot
SummaryManage servers by rebooting using BCM in case of crashes.
upload_time2024-12-27 04:27:47
maintainerNone
docs_urlNone
authorJustin Sherwood
requires_python>=3.7
licenseMIT
keywords server management bcm smart reboot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Starlyng Smart Reboot

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`
* 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

1. Clone the repository:
   ```bash
   git clone https://github.com/starlyngapp/smart-reboot.git
   cd smart-reboot
   ```

2. 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

3. Install Required Packages

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

```bash
pip install -r dev-requirements.txt
```

## Installation

To install only the package (without dev dependencies):

```bash
pip install starlyng_smart_reboot
```

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

```bash
pip install starlyng_smart_reboot[dev]
```

Alternatively, you can install the development dependencies using:

```bash
pip install -r dev-requirements.txt
```

## Create and activate a virtual environment:
   * macOS/Linux:
     ```bash
     python -m venv venv
     source venv/bin/activate
     ```
   * Windows:
     ```bash
     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 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:**

```sh
cp .env.example .env
```

2. **Open the `.env` file and update the values:**

```env
# .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
```

3. **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:

```bash
smart_reboot
```

## PyPI

[starlyng-smart-reboot](https://pypi.org/project/starlyng-smart-reboot/)

## Command-line Arguments

You can also override configuration using command-line arguments:

```bash
smart_reboot --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:

```bash
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

1. **Build the package**:

```bash
python setup.py sdist bdist_wheel
```

2. **Upload to PyPI**:

```bash
twine upload dist/*
```

Upload using specific project name referenced in .pypirc

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

## Running Tests

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

```bash
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:

- GitHub: [@justinsherwood](https://github.com/justinsherwood)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/starlyngapp/smart-reboot",
    "name": "starlyng-smart-reboot",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "server management bcm smart reboot",
    "author": "Justin Sherwood",
    "author_email": "justin@sherwood.fm",
    "download_url": "https://files.pythonhosted.org/packages/4a/79/d739b25537e45c000f11fc7fff097ef397bee1e95148d7c7a3c175757d9d/starlyng_smart_reboot-0.2.4.tar.gz",
    "platform": null,
    "description": "# Starlyng Smart Reboot\n\nThis project manages servers by automatically rebooting them using Baseboard Management Controller (BCM) when crashes occur.\n\n## Prerequisites\n\nBefore you begin, ensure you have met the following requirements:\n* Python 3.x installed\n* Basic understanding of Python and virtual environments\n* ipmitool installed on the server you will run the script:\n  * Ubuntu: `sudo apt-get install ipmitool`\n  * macOS: `brew install ipmitool`\n* If outside local network, configure port forwarding on your router:\n  * Forward BCM port 623 to each server's unique port (62300-62399)\n  * Example: Forward port 62300 to 192.168.50.13:623, port 62301 to 192.168.50.14:623\n  * Port range must be between 62300-62399\n\n## Running\n\n### Using VSCode/Cursor\n\n**Run the Program:**\n   - Go to the Run and Debug view (\u2318+Shift+D, or Ctrl+Shift+D on Windows)\n   - Select the pre-configured launch configuration from the dropdown menu\n   - Click the green play button (F5) or use the \"Run\" menu to start the program\n\n## Setting Up Your Development Environment\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/starlyngapp/smart-reboot.git\n   cd smart-reboot\n   ```\n\n2. Setup Environment for VSCode:\n\n* Open the Command Palette (Ctrl+Shift+P)\n* Search for the Python: Create Environment command, and select it\n* Select Venv\n* Select Python interpreter\n* Select dependencies to install\n\n3. Install Required Packages\n\nInstall all dependencies listed in the dev-requirements.txt file:\n\n```bash\npip install -r dev-requirements.txt\n```\n\n## Installation\n\nTo install only the package (without dev dependencies):\n\n```bash\npip install starlyng_smart_reboot\n```\n\nTo install development dependencies (useful for contributing to the project):\n\n```bash\npip install starlyng_smart_reboot[dev]\n```\n\nAlternatively, you can install the development dependencies using:\n\n```bash\npip install -r dev-requirements.txt\n```\n\n## Create and activate a virtual environment:\n   * macOS/Linux:\n     ```bash\n     python -m venv venv\n     source venv/bin/activate\n     ```\n   * Windows:\n     ```bash\n     python -m venv venv\n     venv\\Scripts\\activate\n     ```\n\n## Releases to PyPi\n\nThis should be done through creating a new release in GitHub\n\n## Environment Configuration\n\nTo 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.\n\nAn example `.env` file is provided as `.env.example`. You can copy this file and update the values as needed.\n\n### Steps to Configure Environment Variables\n\n1. **Copy the example environment file:**\n\n```sh\ncp .env.example .env\n```\n\n2. **Open the `.env` file and update the values:**\n\n```env\n# .env\n# List of server IPs and ports in the format ip:port, separated by commas\nBCM_SERVERS=192.168.1.1:623,192.168.1.2:623\n\n# BCM username\nBCM_USER=user\n\n# BCM password\nBCM_PASSWORD=secret\n```\n\n3. **Save the `.env` file.**\n\nThe `BCM_SERVERS` variable should be a comma-separated list of server IP addresses and ports.\n\n## Usage\n\nTo run the main function:\n\n```bash\nsmart_reboot\n```\n\n## PyPI\n\n[starlyng-smart-reboot](https://pypi.org/project/starlyng-smart-reboot/)\n\n## Command-line Arguments\n\nYou can also override configuration using command-line arguments:\n\n```bash\nsmart_reboot --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\"\n```\n\nOr locally:\n\n```bash\npython 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\"\n```\n\n### Building and Uploading Your Package\n\n1. **Build the package**:\n\n```bash\npython setup.py sdist bdist_wheel\n```\n\n2. **Upload to PyPI**:\n\n```bash\ntwine upload dist/*\n```\n\nUpload using specific project name referenced in .pypirc\n\n```bash\ntwine upload dist/* --repository starlyng-smart-reboot\n```\n\n## Running Tests\n\nTo run tests, execute the following command in your terminal:\n\n```bash\npytest\n```\n\nThis 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.\n\n## Contributing to the Project\n\nContributions to this project are welcome. Here's how you can contribute:\n\n1. Fork the project.\n2. Create your feature branch (git checkout -b feature/YourFeature).\n3. Commit your changes (git commit -am 'Add some YourFeature').\n4. Push to the branch (git push origin feature/YourFeature).\n5. Open a pull request.\n\n## Contact\n\nIf you have any questions, please contact:\n\n- GitHub: [@justinsherwood](https://github.com/justinsherwood)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Manage servers by rebooting using BCM in case of crashes.",
    "version": "0.2.4",
    "project_urls": {
        "Homepage": "https://github.com/starlyngapp/smart-reboot"
    },
    "split_keywords": [
        "server",
        "management",
        "bcm",
        "smart",
        "reboot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ddca6d11af7d726c41ebb696daced8b3834425369aa20a0e23d061d4b7cbb45",
                "md5": "f362a3f6cac3ba101cf9d4e45970648d",
                "sha256": "ff7581035096a09814407daa491079d2e0c81ac47e972964ae3cdc9b18e4a39f"
            },
            "downloads": -1,
            "filename": "starlyng_smart_reboot-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f362a3f6cac3ba101cf9d4e45970648d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 12115,
            "upload_time": "2024-12-27T04:27:44",
            "upload_time_iso_8601": "2024-12-27T04:27:44.994503Z",
            "url": "https://files.pythonhosted.org/packages/0d/dc/a6d11af7d726c41ebb696daced8b3834425369aa20a0e23d061d4b7cbb45/starlyng_smart_reboot-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a79d739b25537e45c000f11fc7fff097ef397bee1e95148d7c7a3c175757d9d",
                "md5": "ef5c436072e65589996bf51041d33522",
                "sha256": "48d2ecb1cdc48ec704cf1e44d96c53aa5d8a2eef3cefab03c38d985f6ef03c0b"
            },
            "downloads": -1,
            "filename": "starlyng_smart_reboot-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "ef5c436072e65589996bf51041d33522",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 11795,
            "upload_time": "2024-12-27T04:27:47",
            "upload_time_iso_8601": "2024-12-27T04:27:47.200607Z",
            "url": "https://files.pythonhosted.org/packages/4a/79/d739b25537e45c000f11fc7fff097ef397bee1e95148d7c7a3c175757d9d/starlyng_smart_reboot-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-27 04:27:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "starlyngapp",
    "github_project": "smart-reboot",
    "github_not_found": true,
    "lcname": "starlyng-smart-reboot"
}
        
Elapsed time: 4.28476s