Skip to content

Commit 5e983f7

Browse files
authored
Merge pull request #358 from Paraphraser/20210604-octoprint-master
Octoprint - ports - PR 1 of 3 - master branch
2 parents b8fadef + 4a192b0 commit 5e983f7

File tree

2 files changed

+185
-31
lines changed

2 files changed

+185
-31
lines changed

.templates/octoprint/service.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ octoprint:
99
# - CAMERA_DEV=/dev/video0
1010
ports:
1111
- "9980:80"
12-
- "9981:8080"
1312
devices:
1413
- /dev/ttyAMA0:/dev/ttyACM0
1514
# - /dev/video0:/dev/video0

docs/Containers/Octoprint.md

Lines changed: 185 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,6 @@ To activate a Raspberry Pi camera attached via ribbon cable:
170170

171171
* The device path on the right hand side of the `CAMERA_DEV` environment variable corresponds with the right hand side (ie *after* the colon) of the device mapping. There should be no reason to change either.
172172

173-
Use the following values to configure the camera in the OctoPrint web interface:
174-
175-
* Stream URL: /webcam/?action=stream
176-
* Snapshot URL: http://localhost:8080/?action=snapshot
177-
* Path to FFMPEG: /usr/bin/ffmpeg
178-
179-
> For those who normally hear alarm bells when they see "localhost" in a Docker context, rest assured that this is correct. The MJPG streamer runs inside the *same* container as OctoPrint so "localhost" is appropriate.
180-
181173
The three environment variables are required:
182174

183175
```
@@ -220,6 +212,140 @@ To start a print session:
220212

221213
If you try to start the OctoPrint container before your 3D printer has been switched on and the USB interface has registered with the Raspberry Pi, the container will go into a restart loop.
222214

215+
### first run – the Setup Wizard
216+
217+
Use a browser to point to port 9980 on your Raspberry Pi. For example:
218+
219+
```
220+
http://raspberrypi.local:9980
221+
```
222+
223+
This will launch the "Setup Wizard".
224+
225+
1. Click the "Next" button until you reach the "Access Control" screen:
226+
227+
* Define a Username and Password, and keep a record of your decisions.
228+
* Click "Create Account".
229+
* Ignore the alarming popup alert by clicking "Ignore". This alert is a result of OctoPrint running in a Docker container.
230+
* Click "Next".
231+
232+
2. At the "Online Connectivity Check" screen:
233+
234+
* Click "Disable Connectivity Check".
235+
* Click "Next".
236+
237+
3. At the "Configure Anonymous Usage Tracking" and "Configure plugin blacklist processing" screens:
238+
239+
* Make a decision about whether you want the feature enabled or disabled and click the appropriate button.
240+
* Click "Next".
241+
242+
4. At the "Set up your printer profile" screen:
243+
244+
* It is probably a good idea to visit the tabs and set values appropriate to your printer (build volume, at least).
245+
* Click "Next".
246+
247+
5. At the "Server Commands" screen:
248+
249+
* Enter the following in the "Restart OctoPrint" field:
250+
251+
```
252+
s6-svc -r /var/run/s6/services/octoprint
253+
```
254+
255+
* Click "Next".
256+
257+
6. At the "Webcam & Timelapse Recordings" screen, and assuming you are configuring a PiCamera:
258+
259+
* Enter the following in the "Stream URL" field:
260+
261+
```
262+
/webcam/?action=stream
263+
```
264+
265+
Click the "Test" button to confirm that the camera is working, then click "Close".
266+
267+
* Enter the following in the "Snapshot URL" field:
268+
269+
```
270+
http://localhost:8080/?action=snapshot
271+
```
272+
273+
Click the "Test" button to confirm that the camera is working, then click "Close".
274+
275+
* Enter the following in the "Path to FFMPEG" field:
276+
277+
```
278+
/usr/bin/ffmpeg
279+
```
280+
281+
The expected result is the message "The path is valid".
282+
283+
* Click "Next".
284+
285+
7. Click "Finish" then click the button to reload the user interface.
286+
287+
### after the first run
288+
289+
Use a browser to point to port 9980 on your Raspberry Pi. For example:
290+
291+
```
292+
http://raspberrypi.local:9980
293+
```
294+
295+
Supply your user credentials and login.
296+
297+
### popup messages
298+
299+
OctoPrint will display *numerous* messages in popup windows. These generally fall into two categories:
300+
301+
* Messages that refer to updates; and
302+
* Messages that refer to other events.
303+
304+
In general, you can ignore messages about updates. You will get all updates automatically the next time the octoprint-docker container is rebuilt and pushed to DockerHub.
305+
306+
You can, if you wish, allow an update to proceed. It might be appropriate to do that if you want to test an update. Just be aware that:
307+
308+
1. Updates are ephemeral and will disappear the next time the Octoprint container is created.
309+
2. Updates can change the structure of the persistent storage area in a way which can't be undone, and which may prevent the Octoprint container from starting the next time it is created. In other words, if you want to trial an update, take a backup of OctoPrint's persistent storage area **first**.
310+
311+
### restarting the OctoPrint container
312+
313+
You can restart the OctoPrint service in two ways:
314+
315+
* via the Raspberry Pi command line; or
316+
* via the OctoPrint user interface.
317+
318+
Whichever method you choose will result in a refresh of the OctoPrint user interface and you will need to follow the prompts to reload your browser page.
319+
320+
#### restarting via the command line
321+
322+
Run the following commands:
323+
324+
```
325+
$ cd ~/IOTstack
326+
$ docker-compose restart octoprint
327+
```
328+
329+
#### restarting via OctoPrint user interface
330+
331+
From the "System" icon in the OctoPrint toolbar (looks like a power button symbol):
332+
333+
1. Choose "Restart OctoPrint".
334+
335+
Note:
336+
337+
* If you do not see the "System" icon in the toolbar, fix it line this:
338+
339+
1. Click the "Settings" icon (looks like a wrench) in the OctoPrint toolbar.
340+
2. Choose "Server".
341+
3. Enter the following into the "Restart OctoPrint" field:
342+
343+
```
344+
s6-svc -r /var/run/s6/services/octoprint
345+
```
346+
347+
4. Click "Save".
348+
223349
### stopping the OctoPrint container
224350

225351
Unless you intend to leave your printer switched on 24 hours a day, you will also need to be careful when you switch off the printer:
@@ -236,25 +362,15 @@ Unless you intend to leave your printer switched on 24 hours a day, you will als
236362

237363
If you turn the printer off without terminating the container, you will crash the container.
238364

239-
### Connecting to OctoPrint
240-
241-
Use a browser to point to port 9980 on your Raspberry Pi. For example:
242-
243-
```
244-
http://raspberrypi.local:9980
245-
```
246-
247-
The first time you do this, you will need to create an administrative account.
248-
249-
### Video feed (built-in camera interface)
365+
## Video feed (built-in camera interface)
250366

251367
You can view the video feed independently of the OctoPrint web interface like this:
252368

253369
```
254-
http://raspberrypi.local:9981/?action=stream
370+
http://raspberrypi.local:9980/webcam/?action=stream
255371
```
256372

257-
### Silencing the security warning
373+
## Silencing the security warning
258374

259375
OctoPrint assumes it is running "natively" rather than in a container. From a data-communications perspective, OctoPrint (the process running inside the OctoPrint container) sees itself as running on a computer attached to the internal Docker network. When you connect to OctoPrint's web interface from a client device attached to an external network, OctoPrint sees that your source IP address is not on the internal Docker network and it issues a security warning.
260376

@@ -278,16 +394,16 @@ To silence the warning:
278394

279395
```
280396
server:
281-
282-
ipCheck:
283-
enabled: true
284-
trustedSubnets:
285-
- 192.168.1.0/24
397+
398+
ipCheck:
399+
enabled: true
400+
trustedSubnets:
401+
- 203.0.132.0/24
286402
```
287403

288404
Notes:
289405

290-
* It is likely that the `server:`, `ipCheck:` and `enabled:` directives are already in place but the `trustedSubnets:` directive may not be. Add it, and then add your local subnet(s) where you see the "192.168.1.0/24" example.
406+
* The `server:`, `ipCheck:` and `enabled:` directives may already be in place but the `trustedSubnets:` directive may not be. Add it, and then add your local subnet(s) where you see the "192.168.1.0/24" example.
291407
* Remember to use spaces in YAML files. Do not use tabs.
292408

293409
4. Save the file.
@@ -298,7 +414,7 @@ To silence the warning:
298414
$ docker-compose up -d octoprint
299415
```
300416

301-
### routine container maintenance
417+
## Routine container maintenance
302418

303419
You can check for updates like this:
304420

@@ -309,9 +425,46 @@ $ docker-compose up -d octoprint
309425
$ docker system prune
310426
```
311427

312-
### if all else fails…
428+
## If you forget your username and password
313429

314-
If you forget your administrative password or the OctoPrint container seems to be misbehaving, you can get a "clean slate" by:
430+
You can view a list of usernames like this:
431+
432+
```
433+
$ docker exec octoprint octoprint --basedir /octoprint/octoprint user list
434+
```
435+
436+
To reset a user's password:
437+
438+
1. Use the following line as a template and replace `«username»` and `«password»` with appropriate values:
439+
440+
```
441+
docker exec octoprint octoprint --basedir /octoprint/octoprint user password --password «password» «username»
442+
```
443+
444+
2. Execute the edited command. For example, to set the password for user "me" to "verySecure":
445+
446+
```
447+
$ docker exec octoprint octoprint --basedir /octoprint/octoprint user password --password verySecure me
448+
```
449+
450+
3. Restart OctoPrint:
451+
452+
```
453+
$ cd ~/IOTstack
454+
$ docker-compose restart octoprint
455+
```
456+
457+
Note:
458+
459+
* OctoPrint supports more than one username. To explore the further:
460+
461+
```
462+
$ docker exec octoprint octoprint --basedir /octoprint/octoprint user --help
463+
```
464+
465+
## If all else fails…
466+
467+
If the OctoPrint container seems to be misbehaving, you can get a "clean slate" by:
315468

316469
```
317470
$ cd ~/IOTstack
@@ -320,3 +473,5 @@ $ docker-compose rm -f octoprint
320473
$ sudo rm -rf ./volumes/octoprint
321474
$ docker-compose up -d octoprint
322475
```
476+
477+
The OctoPrint container is well-behaved and will re-initialise its persistent storage area correctly. OctoPrint will adopt "first run" behaviour and display the Setup Wizard.

0 commit comments

Comments
 (0)