docker-zulip icon indicating copy to clipboard operation
docker-zulip copied to clipboard

Document how to restart after changing environment variables

Open gioragutt opened this issue 7 years ago • 11 comments

Hi, consider I'm accessing the zulip container with something like

sudo docker-compose exec zulip /bin/bash

And I want to f.e edit /etc/zulip/settings.py, currently the two methods I had were:

  1. Add a working debian souce and apt-get it myself - takes a bit more, easily overriden
  2. docker cp out -> edit the file -> docker cp in.

Not really comfortable, the second one is more reliable, but the best thing would be to easily edit the files with vim when you have an open bash in the container.

gioragutt avatar Jun 25 '18 07:06 gioragutt

Yeah, we should include this; it won't add much to the container image size and make life a lot easier for manual inspection/debugging.

timabbott avatar Jun 25 '18 07:06 timabbott

@galexrt do you have thoughts on what folks normally do for editors in an image like this? They're pretty small in disk size compared to the rest of the image, so possibly we should just include them, but I'm curious whether folks try to do it under an option or something.

timabbott avatar Jul 10 '18 06:07 timabbott

@timabbott Normally the configs would not be edited inside the container, that is what the /data/settings directory is for, see https://github.com/zulip/docker-zulip/blob/master/entrypoint.sh#L79-L91.

I'm against installing any editor, as the config can already be edited from outside the container when LINK_SETTINGS_TO_DATA is set to True, https://github.com/zulip/docker-zulip/blob/master/entrypoint.sh#L49. i think the LINK_SETTINGS_TO_DATA is just not documented yet.

galexrt avatar Jul 10 '18 07:07 galexrt

@galexrt definitely not document. I would much rather have it linked outside and edit it how I like than having to vim inside the container. But compared to not being able to edit without docker cping, then vim is a better solution.

Can you elaborate on the env var here a it?

gioragutt avatar Jul 10 '18 09:07 gioragutt

@gioragutt If you set LINK_SETTINGS_TO_DATA: "True", your data dir on the host will have a settings directory in which you can edit the settings.py.

galexrt avatar Jul 10 '18 09:07 galexrt

Amazing. BTW, using docker-compose, what's your suggested method of restarting the server after changing env vars, without losing data? I do it every now and then, always hope mother gets ruined, and yesterday I fucked my server up and lost some data trying to make it work again.

gioragutt avatar Jul 10 '18 09:07 gioragutt

Just use docker-compose stop && docker-compose rm and to start again docker-compose up -d.

The container is currently for being started and "on stop" being deleted and recreated.

Are you talking about the Zulip server?

galexrt avatar Jul 10 '18 09:07 galexrt

Yes. So the step I'm not doing is the rm.

gioragutt avatar Jul 10 '18 10:07 gioragutt

This should be added to the docs maybe. "How to restart the server after environment variables changes". Just to be sure, the rm does not delete the volume data, right?

gioragutt avatar Jul 10 '18 10:07 gioragutt

Agreed, I'm reopening this as a documentation issue for covering that.

timabbott avatar Jul 25 '18 17:07 timabbott

@gioragutt docker-compose rm only removes the containers, as long as you have specified volumes for the data in the docker-compose.yml you are good.

galexrt avatar Sep 16 '18 07:09 galexrt