Skip to main content

Add your description here

Project description

Wakeup on LAN Service

Project Overview

This is a simple Wakeup on LAN (WoL) service built using FastAPI. It provides an HTTP API and a web interface to wake up network devices over the local area network.

Requirements

You can run this application using Python directly or via Docker.

  • Option A: Python 3.10+ (managed via uv)
  • Option B: Docker Engine
  • Option C: Docker Compose

Configuration

The application is configured via environment variables. These apply regardless of the running method chosen.

Environment Variables

Variable Description Default
SECRET_KEY Required. Used to sign JWT cookies. The app will not start without this. None
ADMIN_USERNAME Username for the initial admin account. If empty, authentication is disabled. None
ADMIN_PASSWORD Password for the initial admin account. If empty, authentication is disabled. None
USERS_PATH Path to store hashed user records. users.json
WOL_HOSTS_PATH Path to store saved WoL hosts. hosts.json
COOKIE_SECURE Set to true if running on HTTPS. If false, cookies are sent over HTTP. false
COOKIE_SAMESITE Cookie SameSite policy. Can be lax, strict, or none. lax
ACCESS_TOKEN_EXPIRE_MINUTES How long a login session (JWT token) is valid in minutes. 30
LOG_LEVEL Logging level for the application. INFO
TOKEN_ISSUER JWT token issuer string. wol-service
TOKEN_AUDIENCE JWT token audience string. wol-service-users

Authentication Modes

  • Authenticated (Recommended): Set ADMIN_USERNAME and ADMIN_PASSWORD.
    • Credentials are hashed and stored in USERS_PATH on the first boot.
    • Environment variables for credentials are cleared from memory immediately after startup.
    • CSRF protection is enabled.
  • Unauthenticated (Insecure): Leave ADMIN_USERNAME and ADMIN_PASSWORD unset (or set to empty strings).
    • Authentication and CSRF protections are disabled.
    • All endpoints are open. Only use this on a strictly trusted LAN.

Usage Method 1: Python (Local)

Use this method to run the application directly on the host machine.

  • Install dependencies: Ensure you have uv installed (pip install uv), then install project dependencies:
   uv install -e .
dependencies:
  • Run the application: Replace the values below as needed.
   SECRET_KEY=change-me-to-something-secure \
ADMIN_USERNAME=admin \
ADMIN_PASSWORD=adminpass \
COOKIE_SECURE=false \
uv run uvicorn wol_service.app:app --reload --host 0.0.0.0 --port 25644
   docker build -t wol-service .
  • Run the container: This command mounts a local ./data directory to persist users and hosts.
mkdir -p data

docker run -d -p 25644:25644 --name wol-service-container \
  -e SECRET_KEY=change-me-to-something-secure \
  -e ADMIN_USERNAME=admin \
  -e ADMIN_PASSWORD=adminpass \
  -e COOKIE_SECURE=false \
  -e WOL_HOSTS_PATH=/data/hosts.json \
  -e USERS_PATH=/data/users.json \
  -v "$(pwd)/data:/data" \
  wol-service
  • Access: Open http://localhost:25644. Usage Method 3: Docker Compose If you prefer using Compose, you can use the provided helper script or run standard compose commands.
  • Start the service:

    Using the helper script (builds and mounts ./data automatically)

./scripts/docker_compose_up.sh

OR using standard docker compose (ensure your compose file maps volumes correctly)

docker compose up --build -d

Development & Testing This project uses pytest. To run the test suite:

uv run --no-sync pytest

Note: A helper script is also available at scripts/run_tests.sh.

Security Notes

  • Production Deployment: Always use a strong, random SECRET_KEY.
  • Persistence: Ensure users.json and hosts.json are stored on a persistent volume (as shown in the Docker example), or data will be lost on container restart.
  • HTTPS: If running behind a reverse proxy with HTTPS, remove COOKIE_SECURE=false (let it default to true).

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

wol_service-0.1.0rc1.tar.gz (128.1 kB view details)

Uploaded Source

Built Distribution

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

wol_service-0.1.0rc1-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file wol_service-0.1.0rc1.tar.gz.

File metadata

  • Download URL: wol_service-0.1.0rc1.tar.gz
  • Upload date:
  • Size: 128.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for wol_service-0.1.0rc1.tar.gz
Algorithm Hash digest
SHA256 c88a7df5e1a261c1e01ddcb5b14a2c6162e6a1d9b4703542ff05f10cb1c44f5a
MD5 3610e2c9fa9c8510d3bafc8867a6096b
BLAKE2b-256 4c33613554e1b19df91d8914cdcb499ff97d747fb363d12896f03a653a138d99

See more details on using hashes here.

File details

Details for the file wol_service-0.1.0rc1-py3-none-any.whl.

File metadata

  • Download URL: wol_service-0.1.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for wol_service-0.1.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 09d77de0379234f71893ffd8d6a7c44e564fcef51d84924589489d35019a08ac
MD5 297d090cda7deef6cec5ddacdce6b633
BLAKE2b-256 21150e3389d67a83dfd723f0f4b10f9b3da59c797b5bb9cdbcd64951ae402974

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