Coder Social home page Coder Social logo

Comments (16)

LongLiveCHIEF avatar LongLiveCHIEF commented on June 1, 2024 1

This image is actually based on the image you're referring to, but uses a supervisor designed for containers instead of full operating systems.

The command should be (i actually haven't tested it yet):

s6-svc -r /var/run/s6/octoprint

from octoprint-docker.

LongLiveCHIEF avatar LongLiveCHIEF commented on June 1, 2024 1

Just leaving some thoughts here for posterity... @toofewacres to be clear I'm not asking you to respond (unless you want to 😄)

As @ax42 mentioned It's designed to just have a container restarted by the host as the best way, especially if you're doing something that changes the container environment, as a restart is the only way to load updates to the container environment.

The command posted works to restart all services (not just octoprint), but may not have the same effect that restarting octoprint would on a normal operating system (for example after plugin update or intallation), and I'm afraid that could cause problems for users who aren't aware of this.

Almost thinking we need a section in the docs for octoprint-docker about "known differences/issues using octoprint in a container".

That being said, it would be worth investigating ways to trigger a container reload from within the container... although that comes with it's own challenges for container permissions/docker-in-docker types of scenarios.

One possible way would be if the hosts daemon was configured for the api to be acccessible on a port (by default it binds to a fd), and the container could send an http request from within the container to the api to trigger restart of the container.

The other approach is to just create a finish script for the octoprint service that causes the container to shut down, then a command to kill the octoprint service would be the server restart command you would configure... and as long as you're using a restart option in docker/compose, the container should automatically spin back up.

That last one is the approach I'm going to start with and will go from there.

from octoprint-docker.

Thermionix avatar Thermionix commented on June 1, 2024 1

I needed to set the restart command to redirfd -w 2 /dev/null s6-svscanctl -t /var/run/s6/services
The default s6-svc -r /var/run/s6/octoprint did not work for me

from octoprint-docker.

LongLiveCHIEF avatar LongLiveCHIEF commented on June 1, 2024 1

The default is nots6-svc -r /var/run/s6/octoprint. It is: s6-svc -r /var/run/s6/services/octoprint

from octoprint-docker.

ax42 avatar ax42 commented on June 1, 2024

I think this is tricky, as you need to restart the container which is a command on the host. FWIW I've spun up a portainer instance so I can restart containers via a browser https://www.portainer.io/installation/

from octoprint-docker.

toofewacres avatar toofewacres commented on June 1, 2024

That's what I do for now also. I also run Home Assistant and am able to have "switch" which turns docker containers off and on. Works for now.
I used to use a previous docker image (can't remember the name at the the moment) but you could do "supervisorctl docker restart octoprint" and it would restart the docker container from within Octoprint.

from octoprint-docker.

toofewacres avatar toofewacres commented on June 1, 2024

Tried your command and it did not work.

from octoprint-docker.

toofewacres avatar toofewacres commented on June 1, 2024

I did some digging around and came up with this command line that worked:

redirfd -w 2 /dev/null s6-svscanctl -t /var/run/s6/services

There may be a better way to do this, but this is what I found that works.

from octoprint-docker.

LongLiveCHIEF avatar LongLiveCHIEF commented on June 1, 2024

Thanks!

from octoprint-docker.

LongLiveCHIEF avatar LongLiveCHIEF commented on June 1, 2024

I'm going to reopen if you don't mind, I'd still like to add a restart command suggestion to the documentation.

from octoprint-docker.

toofewacres avatar toofewacres commented on June 1, 2024

If there is a cleaner way of restarting just the Octoprint service, I'm all for it. I searched around last night and I guess I found the brut force method! I'm not all that familiar with the entire docker environment, but love the ease of installation, etc. that it gives you.

from octoprint-docker.

LongLiveCHIEF avatar LongLiveCHIEF commented on June 1, 2024

Once #132 is accepted, the command to restart octoprint will be preconfigured and work automatically for the docker image. Just like usual, the user will be able to view or change the restart command from the settings menu.

from octoprint-docker.

LongLiveCHIEF avatar LongLiveCHIEF commented on June 1, 2024

@Thermionix have you tried it with the latest updates? I remembered you said this before from the forum, but that was before I added octoprint to the service directory.

from octoprint-docker.

oerkel47 avatar oerkel47 commented on June 1, 2024

Hi. I started a clean container with the recent release and there was no preconfigured text for the restart setting. I tried both settings that @Thermionix mentionend and can confirm only the first one worked (unreliable though, sometimes server stays offline).

Octoprint output:

2020-12-10 20:21:55,463 - octoprint.server.api.system - INFO - Performing command for core:restart: s6-svc -r /var/run/s6/octoprint
octoprint | 2020-12-10 20:21:55,511 - octoprint.server.api.system - WARNING - Command for core:restart failed with return code 111:
octoprint | ! STDOUT:
octoprint | ! STDERR: s6-svc: fatal: unable to control /var/run/s6/octoprint: No such file or directory

from octoprint-docker.

oerkel47 avatar oerkel47 commented on June 1, 2024

Uh, that works. Thank you. Fyi, like I said it wasn't preconfigured and I didn't find this command anywhere, maybe add it to readme :)

from octoprint-docker.

LongLiveCHIEF avatar LongLiveCHIEF commented on June 1, 2024

yeah, i will be adding it in there. I've noticed there are a few situations when the config doesn't get pre-loaded, and I'm still working through those as well.

from octoprint-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.