Skip to content

drache42/WakeOnLanService

Repository files navigation

WakeOnLanService

Test Status

Development Instructions

Initial Set Up

  1. Clone this repo

  2. Create a virtual environment

    Python virtual environments allow you to install Python packages in a location isolated from the rest of your system instead of installing them system-wide.

    You can learn more about virtual environments on the Python.land website

  3. Activate the virtual environment

  4. Install Poetry

    Package management is handled via Poetry. If you don't have Poetry installed, you can install it by following the instructions on the Poetry website.

  5. Install Dependencies

    poetry install

  6. Set Up Environment Variables

    Create a .env file in the root directory of the project and add the necessary environment variabless:

    FLASK_APP=src.app
    FLASK_ENV=development
    FLASK_DEBUG=1
    MAC_ADDRESS=your_mac_address_here
    URL=your_url_here
  7. Run the Flask Application

    With the virtual environment activated and environment variables set, you can now run your Flask application:

    flask run --host=0.0.0.0 --port=5000

    Access the application by opening your web browser and navigating to http://127.0.0.1:5000/.

Optional VSCode Set Up

If you want to use VSCode for development, create a .vscode\launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Flask",
            "type": "debugpy",
            "request": "launch",
            "program": "${workspaceFolder}/src/wakeonlanservice/app.py",
            "env": {
                "PYTHONPATH": "${workspaceFolder}/src",
                "FLASK_ENV": "development",
                "FLASK_DEBUG": "true",
                "URL": you_url_here,
                "MAC_ADDRESS": your_mac_address_here
            },
            "args": [],
            "jinja": true
        }
    ]
}

Build and Test Instructions

Building for docker

Run build.ps1 to build docker container.

Run build.ps1 -Run to build and run the container.

Testing

To run tests, simply run command poetry run pytest. This will run all tests.

If you only want to run unit tests, run: poetry run pytest tests/unit

Dockerhub

Docker container can be found at https://hub.docker.com/r/drache42/wakeonlanservice