Skip to content

Commit c8d997c

Browse files
committed
Add Docker Hub installation instructions and docker-compose.dockerhub.yml
1 parent 31e0e62 commit c8d997c

File tree

3 files changed

+146
-0
lines changed

3 files changed

+146
-0
lines changed

DOCKER.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ This document provides detailed instructions for setting up and configuring Powe
2424

2525
## Quick Start
2626

27+
### Using Local Build
28+
2729
1. Clone the repository:
2830
```bash
2931
git clone https://github.com/blink-zero/powerpulse.git
@@ -53,6 +55,49 @@ This document provides detailed instructions for setting up and configuring Powe
5355

5456
5. Access PowerPulse at http://localhost
5557

58+
### Using Docker Hub Images
59+
60+
You can also run PowerPulse directly from Docker Hub without cloning the repository:
61+
62+
1. Create a directory for PowerPulse:
63+
```bash
64+
mkdir powerpulse
65+
cd powerpulse
66+
```
67+
68+
2. Create a data directory for the server:
69+
```bash
70+
mkdir -p server/data
71+
```
72+
73+
3. Download the Docker Compose file:
74+
```bash
75+
wget https://raw.githubusercontent.com/blink-zero/powerpulse/v1.8.2/docker-compose.dockerhub.yml -O docker-compose.yml
76+
```
77+
78+
4. Create an environment file:
79+
```bash
80+
wget https://raw.githubusercontent.com/blink-zero/powerpulse/v1.8.2/.env.example -O .env
81+
```
82+
83+
5. Edit the `.env` file to set your configuration:
84+
```bash
85+
# Generate a secure JWT secret
86+
JWT_SECRET=$(openssl rand -hex 32)
87+
# Replace the default value in .env
88+
sed -i "s/JWT_SECRET=.*/JWT_SECRET=$JWT_SECRET/" .env
89+
90+
# Edit other settings as needed
91+
nano .env
92+
```
93+
94+
6. Start the containers:
95+
```bash
96+
docker-compose up -d
97+
```
98+
99+
7. Access PowerPulse at http://localhost
100+
56101
## Configuration
57102

58103
### Environment Variables

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,37 @@ powerpulse/
121121
docker-compose up -d
122122
```
123123

124+
#### Docker Hub Installation
125+
126+
You can also run PowerPulse directly from Docker Hub without cloning the repository:
127+
128+
1. Create a directory for PowerPulse:
129+
```
130+
mkdir powerpulse
131+
cd powerpulse
132+
```
133+
134+
2. Create a data directory for the server:
135+
```
136+
mkdir -p server/data
137+
```
138+
139+
3. Download the Docker Compose file:
140+
```
141+
wget https://raw.githubusercontent.com/blink-zero/powerpulse/v1.8.2/docker-compose.dockerhub.yml -O docker-compose.yml
142+
```
143+
144+
4. Create an environment file:
145+
```
146+
wget https://raw.githubusercontent.com/blink-zero/powerpulse/v1.8.2/.env.example -O .env
147+
# Edit .env with your configuration
148+
```
149+
150+
5. Start with Docker Compose:
151+
```
152+
docker-compose up -d
153+
```
154+
124155
### Testing with Sample Data
125156

126157
To generate test battery history data for development and testing:

docker-compose.dockerhub.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
version: '3.8'
2+
3+
services:
4+
server:
5+
image: blinkzero/powerpulse-server:1.8.2
6+
container_name: powerpulse-server
7+
restart: unless-stopped
8+
command: ["node", "server.js"]
9+
ports:
10+
- "5001:5000"
11+
volumes:
12+
- ./server/data:/app/data
13+
environment:
14+
- NODE_ENV=production
15+
- PORT=5000
16+
- TZ=${TZ:-UTC}
17+
- JWT_SECRET=${JWT_SECRET:-change_this_to_a_secure_random_string}
18+
- DEFAULT_NUT_HOST=${DEFAULT_NUT_HOST:-host.docker.internal}
19+
- DEFAULT_NUT_PORT=${DEFAULT_NUT_PORT:-3493}
20+
- DEFAULT_NUT_USERNAME=${DEFAULT_NUT_USERNAME:-}
21+
- DEFAULT_NUT_PASSWORD=${DEFAULT_NUT_PASSWORD:-}
22+
- NUT_CONNECTION_TIMEOUT=${NUT_CONNECTION_TIMEOUT:-5000}
23+
- NUT_RETRY_ATTEMPTS=${NUT_RETRY_ATTEMPTS:-3}
24+
- NUT_RETRY_DELAY=${NUT_RETRY_DELAY:-1000}
25+
- LOG_LEVEL=${LOG_LEVEL:-info}
26+
# Email configuration
27+
- SMTP_HOST=${SMTP_HOST:-}
28+
- SMTP_PORT=${SMTP_PORT:-}
29+
- SMTP_USER=${SMTP_USER:-}
30+
- SMTP_PASS=${SMTP_PASS:-}
31+
- SMTP_FROM=${SMTP_FROM:-powerpulse@example.com}
32+
healthcheck:
33+
test: ["CMD", "sh", "-c", "wget --no-verbose --tries=1 --spider http://localhost:5000/api/auth/check-setup || exit 1"]
34+
interval: 30s
35+
timeout: 10s
36+
retries: 3
37+
start_period: 30s
38+
networks:
39+
- powerpulse-network
40+
41+
client:
42+
image: blinkzero/powerpulse-client:1.8.2
43+
container_name: powerpulse-client
44+
restart: unless-stopped
45+
ports:
46+
- "80:80"
47+
depends_on:
48+
server:
49+
condition: service_healthy
50+
environment:
51+
- SERVER_HOST=server
52+
- SERVER_PORT=5000
53+
- TZ=${TZ:-UTC}
54+
- ENABLE_HTTPS=${ENABLE_HTTPS:-false}
55+
healthcheck:
56+
test: ["CMD", "sh", "-c", "wget --no-verbose --tries=1 --spider http://localhost/health || exit 1"]
57+
interval: 30s
58+
timeout: 10s
59+
retries: 3
60+
start_period: 30s
61+
networks:
62+
- powerpulse-network
63+
64+
networks:
65+
powerpulse-network:
66+
driver: bridge
67+
68+
volumes:
69+
data:
70+
driver: local

0 commit comments

Comments
 (0)