-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
config lost after new build of stack #258
Comments
It is not normal behaviour. It is not really stated anywhere as a hard-and-fast rule but IOTstack implicitly makes some assumptions, such as:
This is not to say that IOTstack won't run on other platforms. It's just that it gets a lot more testing where the above assumptions hold so kinks tend to get ironed out. I'm definitely not trying to say that anything about your platform is the cause of what you are seeing. You haven't really given me a lot to go on so I need to lay out the kinds of things you might need to think about. Most containers use root ownership for their persistent storage (directories inside Mosquitto is an exception. It assumes and relies upon:
These presets are the result of running the menu. If something happens to undo the effect of running the menu then docker-compose will wade in the next time you run it. The Mosquitto container's volumes statements are:
Those decompose about the colons into "externalPath:internalPath", and the leading "." on each external path is defined as "the directory containing docker-compose.yml". Docker-compose assumes that everything is a directory so if, for example, the file at:
is missing when you run docker-compose, then the result will be a directory at that path, and that directory will have root:root ownership. I just tried this on my RPi and mosquitto got most upset:
That's a world away from your report of the config being reset so, other than where I started (this is not normal behaviour; maybe it's a Ubuntu thing), I don't know what else to suggest. If nothing here leads you to a solution, perhaps come back with a recursive listing of:
Maybe include your docker-compose.yml and override file too. |
I've been thinking about this some more. Some background. I started using IOTstack late 2019 when it was gcgarner/IOTstack. I really had no idea what was going on but my adaptations as I kicked the tyres, broke things and learned how to fix them resulted in some rules-of-thumb:
Fast forward to today and SensorsIot/IOTstack, and I added another rule-of-thumb:
When you first clone the repo, you don't have a There are two menu systems. The "old menu" (on the old-menu branch) has it origins in gcgarner/IOTstack. A bash script. Always good at first build but had a fair bit of "your mileage may vary" when trying to use it for ongoing maintenance. The "new menu" (master branch) is a SensorsIot/IOTstack-only thing written in Python. I've used it for first build (just to see what it does; never in anger to produce a stack I will depend on) and my rules of thumb mean I'm unlikely to venture much further down that path. You mentioning I'm wondering whether re-running the menu to apply the override file is having the effect of re-initialising everything? The way it works is that the menu starts with the template in:
and copies the elements to the service definition:
then sets up the folder and permission structure I mentioned before by running one of:
After that, all the little
are concatenated along with a header and, if it's new menu, with I'm not sure at which point the override stuff is applied but probably after that. In the old menu, if you re-chose a service that was already defined (ie existed in I'm wondering whether some side-effect of re-running new menu and/or the override processing is causing the same kind of thing to happen? Hopefully, I've given you enough detail to ferret through and see what there is to be seen. You could, for example, add a marker to:
then do whatever it is that you've been doing and see if the marker turns up in:
If it does, it will prove that something either intrinsic to the menu or the way you're using it is causing a "pull full service from template" effect. If not, at least it will eliminate that possibility. Getting back to my rules of thumb, I just do everything in docker-compose.yml. If I add a new service, I copy the template files myself, copy and paste the service.yml into docker-compose.yml. I see no point to either the docker-compose-supported But that's just me. Old dude. Grew up in the punched-card era. I like my CLI. I like in-ya-face. I hate opaque. But I don't have this kind of trouble. Make of that what you will. |
After I saw this happen the first time, I decided I wanted to play it extra safe and I made a backup copy of the whole IOTStack folder. Then, added the new thing from the menu I wanted to add then opened up the docker-compose.yml and found the new entry it added, copied that portion and added it to my backup's compose file along with all my other modifications, and then made the adjustments I wanted and save it, then copied all of it back to the original compose file and fired it up. This way, if for some reason you noticed anything else is goofy or overwritten, you can just grab it from your backup and put it back. If I ever need to add something else, I just refresh my backup copy with the current working IOTStack folder, rinse and repeat. While it is ideal to have automatic scheduled backups of your system as well, if you don't for some reason, at least you have something to fall back on by doing this. |
An experimentFor @Slyke TL;DRRe-running the new menu resets mosquitto.conf DetailsClean clone of master branch
Run the menu:
Choose Build Stack, select Mosquitto, and follow through to the end. Display the last line of the mosquitto configuration file "as installed":
Append a marker to that file:
Prove the marker is there:
Bring up the stack:
Show that this has not affected the marker:
Re-run the menu:
Choose Build Stack, select Grafana, and follow through to the end. What's the story with the marker?
Gone! Adding a new service re-copies This should not happen! |
References: * [Mosquitto doc](https://mosquitto.org/documentation/migrating-to-2-0/) * [Workaround](SensorsIot#265) * [IOTstack new menu breaks Mosquitto configs](SensorsIot#258 (comment)) * [Pull Request on gcgarner/IOTstack](gcgarner#228) Mosquitto 2.x has introduced a requirement for a `listener` in the config file. If this is absent, Mosquitto will bind to the loopback interface. When Mosquitto is running in a container, this implies no connectivity. Mosquitto 2.x has also changed the security defaults. Earlier versions permitted passwordless access out-of-the box. The new version assumes a password scheme will be implemented and requires passwordless access to be an explicit configuration choice. This PR maintains the IOTstack status quo by: 1. Adding `listener 1883`; and 2. Activating `allow_anonymous` with the value `true`. Anyone who has already set up a password scheme will need to import the `listener` line but, presumably, their `allow_anonymous` will already be active and set to `false`, and that will not need to change.
Probably a combination of pilot error and old Mosquitto behaviour before the self repair mods. Stale. |
Hi,
I'm new to IoTStack.
I installed it on an ubuntu server. Since I want to migrate from "native" applications to docker I'm going step by step.
One thing I discovered is that when I add a container (./menu.sh) and then run
docker-compose up -d
, I lose configurations. At least from mosquitto, which is my first container.E.g. I configured mosquitto to use ssl-certificates and port 8883. This starts OK. But when I add e.g. InfluxDB and run
docker-compose up -d
again, my configuration of mosquitto is reverted to "out of the box" i.e. my modifications are lost.Is this normal behaviour ? Now I backup my configuration before I run
docker-compose up -d
.For some things, I use compose-override.yml, but do I need this for mosquitto.conf ?
TIA
The text was updated successfully, but these errors were encountered: