Skip to content

Commit 45acf86

Browse files
committed
Ändere Frontend-Port auf 3000 und füge Nginx-Container hinzu
1 parent 0dcca86 commit 45acf86

3 files changed

Lines changed: 179 additions & 20 deletions

File tree

README.md

Lines changed: 89 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ BambuCAM is a user-friendly web application for monitoring different 3D printers
4545

4646
The fastest way to get started is using our pre-built Docker images:
4747

48-
1. Create a Folder sudo mkdir BambuCAM
49-
2. Jump into the folder cd BambuCAM
48+
1. Create a Folder: `sudo mkdir BambuCAM`
49+
2. Jump into the folder: `cd BambuCAM`
5050
3. Create a `docker-compose.yml`:
5151
```yaml
52+
version: '3'
5253

5354
services:
5455
frontend:
@@ -60,34 +61,111 @@ services:
6061
image: bangertech/bambucam-backend:latest
6162
restart: unless-stopped
6263
volumes:
63-
- bambucam_data:/app/data
64-
- bambucam_logs:/app/logs
64+
- type: bind
65+
source: ./data
66+
target: /app/data
67+
bind:
68+
create_host_path: true
69+
- type: bind
70+
source: ./logs
71+
target: /app/logs
72+
bind:
73+
create_host_path: true
74+
- type: bind
75+
source: ./data/go2rtc
76+
target: /app/data/go2rtc
77+
bind:
78+
create_host_path: true
79+
environment:
80+
- LOG_LEVEL=DEBUG
6581
network_mode: "host"
6682

83+
nginx:
84+
image: nginx:alpine
85+
network_mode: "host"
86+
restart: unless-stopped
87+
command: >
88+
/bin/sh -c "echo 'worker_processes auto;
89+
events {
90+
worker_connections 1024;
91+
}
92+
http {
93+
include /etc/nginx/mime.types;
94+
default_type application/octet-stream;
95+
sendfile on;
96+
keepalive_timeout 65;
97+
98+
server {
99+
listen 80;
100+
101+
location / {
102+
proxy_pass http://localhost:3000;
103+
proxy_http_version 1.1;
104+
proxy_set_header Upgrade $$http_upgrade;
105+
proxy_set_header Connection \"upgrade\";
106+
proxy_set_header Host $$host;
107+
}
108+
109+
location /api {
110+
proxy_pass http://localhost:4000;
111+
proxy_http_version 1.1;
112+
proxy_set_header Host $$host;
113+
}
114+
115+
location /go2rtc/ {
116+
proxy_pass http://localhost:1984/;
117+
proxy_http_version 1.1;
118+
proxy_set_header Upgrade $$http_upgrade;
119+
proxy_set_header Connection \"upgrade\";
120+
proxy_set_header Host $$host;
121+
}
122+
}
123+
}' > /etc/nginx/nginx.conf && nginx -g 'daemon off;'"
124+
depends_on:
125+
- frontend
126+
- backend
127+
- go2rtc
128+
67129
go2rtc:
68130
image: alexxit/go2rtc
69131
container_name: go2rtc
70132
restart: unless-stopped
71133
network_mode: host
72134
volumes:
73-
- bambucam_go2rtc:/config
135+
- type: bind
136+
source: ./data/go2rtc
137+
target: /config
138+
bind:
139+
create_host_path: true
74140
environment:
75141
- GO2RTC_CONFIG=/config/go2rtc.yaml
76142
- GO2RTC_API=listen=:1984
77143
- GO2RTC_API_BASE=/go2rtc
78-
79-
volumes:
80-
bambucam_logs:
81-
bambucam_data:
82-
bambucam_go2rtc:
144+
- GO2RTC_LOG_LEVEL=debug
145+
command: >
146+
/bin/sh -c "
147+
mkdir -p /config &&
148+
touch /config/go2rtc.yaml &&
149+
chmod 777 /config/go2rtc.yaml &&
150+
echo 'api:' > /config/go2rtc.yaml &&
151+
echo ' listen: :1984' >> /config/go2rtc.yaml &&
152+
echo ' base: /go2rtc' >> /config/go2rtc.yaml &&
153+
echo 'webrtc:' >> /config/go2rtc.yaml &&
154+
echo ' listen: :8555' >> /config/go2rtc.yaml &&
155+
echo 'rtsp:' >> /config/go2rtc.yaml &&
156+
echo ' listen: :8554' >> /config/go2rtc.yaml &&
157+
go2rtc
158+
"
159+
depends_on:
160+
- backend
83161
```
84162
85163
4. Start BambuCAM:
86164
```bash
87165
docker compose up -d
88166
```
89167

90-
That's it! The application will be available at http://localhost
168+
That's it! The application will be available at http://localhost. Your data will be stored in the `./data` and `./logs` directories, making it easy to access and backup.
91169

92170
### Windows Users
93171

docker-compose.yml

Lines changed: 86 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
version: '3'
12

23
services:
34
frontend:
@@ -9,23 +10,100 @@ services:
910
image: bangertech/bambucam-backend:latest
1011
restart: unless-stopped
1112
volumes:
12-
- bambucam_data:/app/data
13-
- bambucam_logs:/app/logs
13+
- type: bind
14+
source: ./data
15+
target: /app/data
16+
bind:
17+
create_host_path: true
18+
- type: bind
19+
source: ./logs
20+
target: /app/logs
21+
bind:
22+
create_host_path: true
23+
- type: bind
24+
source: ./data/go2rtc
25+
target: /app/data/go2rtc
26+
bind:
27+
create_host_path: true
28+
environment:
29+
- LOG_LEVEL=DEBUG
1430
network_mode: "host"
1531

32+
nginx:
33+
image: nginx:alpine
34+
network_mode: "host"
35+
restart: unless-stopped
36+
command: >
37+
/bin/sh -c "echo 'worker_processes auto;
38+
events {
39+
worker_connections 1024;
40+
}
41+
http {
42+
include /etc/nginx/mime.types;
43+
default_type application/octet-stream;
44+
sendfile on;
45+
keepalive_timeout 65;
46+
47+
server {
48+
listen 80;
49+
50+
location / {
51+
proxy_pass http://localhost:3000;
52+
proxy_http_version 1.1;
53+
proxy_set_header Upgrade $$http_upgrade;
54+
proxy_set_header Connection \"upgrade\";
55+
proxy_set_header Host $$host;
56+
}
57+
58+
location /api {
59+
proxy_pass http://localhost:4000;
60+
proxy_http_version 1.1;
61+
proxy_set_header Host $$host;
62+
}
63+
64+
location /go2rtc/ {
65+
proxy_pass http://localhost:1984/;
66+
proxy_http_version 1.1;
67+
proxy_set_header Upgrade $$http_upgrade;
68+
proxy_set_header Connection \"upgrade\";
69+
proxy_set_header Host $$host;
70+
}
71+
}
72+
}' > /etc/nginx/nginx.conf && nginx -g 'daemon off;'"
73+
depends_on:
74+
- frontend
75+
- backend
76+
- go2rtc
77+
1678
go2rtc:
1779
image: alexxit/go2rtc
1880
container_name: go2rtc
1981
restart: unless-stopped
2082
network_mode: host
2183
volumes:
22-
- bambucam_go2rtc:/config
84+
- type: bind
85+
source: ./data/go2rtc
86+
target: /config
87+
bind:
88+
create_host_path: true
2389
environment:
2490
- GO2RTC_CONFIG=/config/go2rtc.yaml
2591
- GO2RTC_API=listen=:1984
2692
- GO2RTC_API_BASE=/go2rtc
27-
28-
volumes:
29-
bambucam_logs:
30-
bambucam_data:
31-
bambucam_go2rtc:
93+
- GO2RTC_LOG_LEVEL=debug
94+
command: >
95+
/bin/sh -c "
96+
mkdir -p /config &&
97+
touch /config/go2rtc.yaml &&
98+
chmod 777 /config/go2rtc.yaml &&
99+
echo 'api:' > /config/go2rtc.yaml &&
100+
echo ' listen: :1984' >> /config/go2rtc.yaml &&
101+
echo ' base: /go2rtc' >> /config/go2rtc.yaml &&
102+
echo 'webrtc:' >> /config/go2rtc.yaml &&
103+
echo ' listen: :8555' >> /config/go2rtc.yaml &&
104+
echo 'rtsp:' >> /config/go2rtc.yaml &&
105+
echo ' listen: :8554' >> /config/go2rtc.yaml &&
106+
go2rtc
107+
"
108+
depends_on:
109+
- backend

frontend/Dockerfile.prod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ FROM nginx:alpine
1616
COPY --from=builder /app/build /usr/share/nginx/html
1717
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
1818

19-
EXPOSE 80
19+
# Ändern der Nginx-Konfiguration, um auf Port 3000 zu lauschen
20+
RUN sed -i 's/listen\s*80/listen 3000/g' /etc/nginx/conf.d/default.conf
21+
22+
EXPOSE 3000

0 commit comments

Comments
 (0)