No description
Find a file
2025-07-28 01:27:00 +02:00
backend Add Docker Compose 2025-07-27 21:25:49 +02:00
frontend Add Docker Compose 2025-07-27 21:25:49 +02:00
.gitignore tweaks in gitignror 2023-04-20 02:08:02 +02:00
docker-compose.yml Add Docker Compose 2025-07-27 21:25:49 +02:00
Dockerfile Add Docker Compose 2025-07-27 21:25:49 +02:00
README.md Update README.md 2025-07-28 01:27:00 +02:00

🌐 Wake on LAN API

Python REST API that wakes a machine (that supports WoL) from outside the local network.

📦 Installation

Note

We currently bake the backend/.env file into the Docker image, which is considered bad practice. This might be fixed in future updates.

Clone the repository:

git clone https://github.com/Urpagin/WoL_Api/

Navigate to the repository:

cd WoL_Api

Create and populate your .env file:

vim .env

Add the following to .env:

HASHED_KEY=<HASHEDKEY>

Use this tool to hash your password with SHA384.

Launch the Docker Compose setup:

sudo docker compose up -d

🐳 Docker

Follow the steps in Docker Compose up to and including the .env setup.

Then build the Docker image:

docker build -t urpagin/wol-api:0.0.1 .

Check the image ID:

docker images

Run the Docker container (replace <IMAGEID> with the actual image ID):

docker run -d --restart=always --network host --name wol-api <IMAGEID>

🐍 Python

Follow the steps in Docker Compose up to and including the .env setup.

Install the dependencies:

pip install -r backend/requirements.txt

Run the application from the root directory (not from inside backend):

python backend/main.py

It's Saul Goodman! Execute docker ps to list running containers or docker ps -a to view both running and stopped containers, useful if wol-api crashes.

⚙️ API Specifications

  • / (GET): Simple static HTTP endpoint to check API status.
  • /wake (POST): Accepts key and ip; wakes a machine using a magic packet.
  • /ping (GET): Accepts key and ip; returns the ping response from the machine.
  • /add-machine (PUT): Accepts key and ip; retrieves the MAC address of ip and stores the tuple (ip, mac) in the database.
  • /database (GET): Accepts key; returns the database content as a list.

Note: All responses are JSON formatted: {"detail": <RESPONSE>}.

Note: Before using /wake, ensure you've added the machine's MAC address to the database using /add-machine.


programming-background

Hero-Wodaabe-nomads-in-Chad

flag-india

Image Credits: Image by www.slon.pics on Freepik.