Skip to content

A simple, self-hosted web application to manage multiple Hetzner Cloud servers and projects from a single, clean interface. Built with Python, Flask, and Tailwind CSS, and fully containerized with Docker. 🐳🐍

License

Notifications You must be signed in to change notification settings

alfiosalanitri/hetzner-server-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Hetzner Server Manager πŸ–₯οΈβš™οΈ

A simple, self-hosted web application to manage multiple Hetzner Cloud servers and projects from a single, clean interface. Built with Python, Flask, and Tailwind CSS, and fully containerized with Docker. 🐳🐍

Screenshots πŸ“·

Dashboard

Project Page

Modal Confirm

Features ⭐

  • Multi-Project Management: Securely add and manage multiple Hetzner Cloud projects. πŸ”
  • Encrypted API Tokens: API tokens are encrypted at rest in the database for enhanced security. πŸ”’
  • Modern Dashboard: A responsive, card-based dashboard to monitor all your servers. πŸ“Š
  • Core Server Actions: Power on, shutdown, and reboot servers with a single click. βš‘πŸ”„
  • Styled Confirmation Modals: Prevent accidental actions with sleek, non-intrusive confirmation modals. βœ”οΈ
  • Dark/Light Mode: Theme toggler with localStorage persistence for user preferences. πŸŒ™β˜€οΈ
  • User-Friendly UX: Features like copy-to-clipboard for IP addresses and real-time status indicators. πŸ“‹πŸŸ’πŸ”΄
  • Dockerized: Easily deploy with a single command using Docker and Docker Compose. 🐳

Tech Stack πŸ› οΈ

  • Backend: Python, Flask, Gunicorn 🐍πŸ”₯
  • Database: SQLite with Flask-SQLAlchemy πŸ—„οΈ
  • Frontend: Tailwind CSS, Alpine.js 🎨⚑
  • Tooling: Node.js/npm (for asset compilation), Docker, Docker Compose πŸ“¦

πŸ› οΈ Development Setup

Use this method if you want to run the app in development mode, contribute to the project, or customize the code.

Prerequisites πŸ“‹

  • Docker 🐳
  • Docker Compose (optional, for dev DB or Redis)
  • Python 3.10+ 🐍
  • Node.js and npm πŸ“¦

Steps πŸš€

  1. Clone the repository:
git clone <your-repository-url>
cd hetzner-server-manager
  1. Create the environment file:
cp .env.example .env
  1. Create and activate a Python virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install Python dependencies:
pip install -r requirements.txt
  1. Generate a secret encryption key:
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"

Paste the key into .env under SECRET_ENCRYPTION_KEY.

  1. Generate a secret key:
python -c "import secrets; print(secrets.token_urlsafe(32))"

Paste the key into .env under SECRET_KEY.

  1. Enable Debug Mode:

Set Debug mode to true into .env under FLASK_DEBUG.

  1. Install Node.js dependencies:
npm install
  1. Initialize the database:
flask db upgrade
  1. Run the application:

Open two terminals:

  • Terminal 1: Tailwind watcher
npm run dev
  • Terminal 2: Flask development server
python ./app.py
  1. Access the app:

Navigate to http://localhost:5000 🌐

The database will be created in the data/ folder. πŸ“‚


πŸ§ͺ Running Tests

To ensure your changes work as expected or to simply verify the app, you can run automated tests! βš™οΈβœ…

Setup

Make sure you have the development dependencies installed (including testing tools):

pip install -r requirements-dev.txt

Run Tests

Use pytest to run all tests:

pytest

You should see output with passed/failed tests. Tests cover models, forms, utils, and routes.


πŸš€ Production Setup (Docker)

If you want to deploy the app in production, you can use the prebuilt Docker image with minimal configuration.

Prerequisites πŸ“‹

Steps (use the pre built image) πŸ—οΈ

ghcr.io/alfiosalanitri/hetzner-server-manager:latest
  1. Create and edit your .env file:
vim .env

Add your SECRET_ENCRYPTION_KEY, SECRET_KEY and FLASK_DEBUG=false.

πŸ’‘ Tip: You can generate a valid SECRET_ENCRYPTION_KEY using https://fernetkeygen.com

  1. Create the docker-compose.yml file:
services:
  web:
    image: ghcr.io/alfiosalanitri/hetzner-server-manager:latest
    ports:
      - "5000:5000"
    volumes:
      - ./data/instance:/app/instance
    env_file:
      - .env
    restart: unless-stopped
  1. Run the container:
docker compose up -d

Steps (create your image) πŸ—οΈ

  1. Clone this repository:
git clone https://github.com/alfiosalanitri/hetzner-server-manager.git
  1. Create and edit your .env file:
co .env.example .env
  1. Run the container:
docker compose up --build -d

The app will be available at http://localhost:5000 🌐


βœ… Docker Image Compatibility

The Docker image has been successfully tested on the following platforms:

Platform Architecture Status
Arch Linux x86_64 βœ… Tested
Ubuntu 22.04+ x86_64 βœ… Tested
Raspberry Pi OS ARMv7/ARM64 βœ… Tested

ℹ️ If you encounter issues running the container on other systems, feel free to open an issue.


πŸ” Environment Variables

The following variable is required in your .env file:

  • SECRET_ENCRYPTION_KEY: Used to encrypt and decrypt Hetzner API tokens. πŸ”‘

⚠️ If you lose this key, previously saved projects will become inaccessible.

  • SECRET_KEY: Used for securely signing session cookies and other cryptographic operations.

  • FLASK_DEBUG: Enable or disable Flask debug mode.


⚠️ Security & Access Warning

❗ Warning: This application does not implement any kind of authentication or login mechanism.

Anyone with access to the application's URL will be able to view and control all configured servers. There is no user authentication or permission control.

For this reason, it is strongly discouraged to expose the application directly to the internet without additional protection. It is highly recommended to use an access control layer such as Cloudflare Zero Trust Access, a reverse proxy with authentication, a VPN, or another secure network gateway.

πŸ”’ In production environments, securing access is essential to prevent unauthorized usage or potential harm to your infrastructure.


🀝 Contributing

Contributions are welcome! Please open an issue to suggest improvements or report bugs. Pull requests are appreciated. πŸ™Œβœ¨


πŸ“„ License

This project is licensed under the MIT License. See LICENSE for details. πŸ“œ

About

A simple, self-hosted web application to manage multiple Hetzner Cloud servers and projects from a single, clean interface. Built with Python, Flask, and Tailwind CSS, and fully containerized with Docker. 🐳🐍

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •