Docker Deployment¶
This documentation has the goal of showing a user how to deploy PowerBeacon using Docker. This is the recommended deployment method for most users, as it provides a good balance between ease of use and flexibility. It is also the best option for users who want to deploy PowerBeacon on their own infrastructure, such as on-premises or in a private cloud.
Configure and run PowerBeacon with Docker¶
- Create a directory on the container host machine to store PowerBeacon configuration and data:=
-
Create a
docker-compose.ymlfile in thepowerbeacondirectory with the following content:services: db: image: postgres:16-alpine container_name: powerbeacon-db environment: POSTGRES_USER: powerbeacon POSTGRES_PASSWORD: ${DB_PASSWORD:-changeMe} POSTGRES_DB: powerbeacon volumes: - powerbeacon_data:/var/lib/postgresql/data networks: - powerbeacon_network healthcheck: test: ["CMD-SHELL", "pg_isready -U powerbeacon"] interval: 10s timeout: 5s retries: 5 powerbeacon: image: kotsiossp97/powerbeacon:latest container_name: powerbeacon environment: DB_URL: postgresql://powerbeacon:${DB_PASSWORD:-changeMe}@db:5432/powerbeacon JWT_SECRET: ${JWT_SECRET:-your-secret-key-change-in-production} ports: - "8000:80" depends_on: db: condition: service_healthy networks: - powerbeacon_network volumes: powerbeacon_data: networks: powerbeacon_network: driver: bridgeNote
Alternatively you can use the following command to download the
docker-compose.ymlfile directly from the repository:Also if you have an external database you can omit the
dbservice and update theDB_URLenvironment variable in thepowerbeaconservice to point to your external database. And an even simpler option is to use the following command to create a container directly without usingdocker-compose: