jetekteam / picontrol

Pi Control
9 stars 7 forks source link

Updates for deployment and maintanibility #2

Open Lemmons opened 7 years ago

Lemmons commented 7 years ago

The core concept of this pull request is to get the code building in https://travis-ci.org and deploying automatically to pypi upon a tagged release (a git tag of some version, like "0.9"). So picontrol is now pip installable.

I really wanted to be able to make changes to this code as needed, but because the source was all contained inside the tgz, not in the actual repo, it would have made things very hard. Instead, if the source lives in the repo directly, we can get all the benefits of source code management, including easy collaboration.

There are many improvements to logic in this, but one of the bigger ones is how updating happens. Because the code is now deploying to pypi, all that needs to happen is a pip install -U picontrol and the code gets updated. Additionally, this means we can use pip to check if we need an upgrade or not, using the pip list command.

Also, a bit of work was done to the config system. First, in an effort to generalize things a bit, the main config now lives at /etc/picontrol/picontrol.conf This should help things to be a bit more portable. Configs in the old location will still be checked if the etc config doesn't exist, but changes/saves will be done to the etc location. Additionally, the default config has been build into the config.py code, so a base config no longer needs to ship with the code. It will be auto-generated on the first run. As the config that was storing the processes running is transient (deleted every time we restart the machine) it is now created in the /tmp folder, and again, is create at run time.

One big caveat to this is that this will break the existing upgrade functionality, as in, code running on a system right now will not be able to upgrade to this new version. To this, I have a fix in mind, where one last picontrol.tgz would be created which contains the new upgrade logic, and new code could, in turn, upgrade to the pip based version. It would basically require two upgrades in a row for people on the old version, but should work no problem.

One small issue is that I haven't been able to test with the hardware (switches/nfc) as I haven't gotten my kit yet, but I have been testing extensively on my rpi3, and so far everything is looking good.

I will update this pull request once I have created the in-between picontrol.tgz and then we can go from there.

Lemmons commented 7 years ago

I have added picontrol.tgz back in and thoroughly tested, and from what I can tell it is working really well. Both the upgrade functionality from the picontrol.tgz based code to pypi deployed code is working well, as well as from one version to the next of the pypi version.

Lemmons commented 7 years ago

To fully test this, you need to update your the download location checkUpdates and updateVersion are checking to https://raw.githubusercontent.com/Lemmons/picontrol/simplify-for-sharing/picontrol.tgz. Once these changes are merged in, of course, this will not be necessary.

From there you can go through the webui update process twice (once to update to the new picontrol.tgz, and a second time to update to the pypi version). Once that is finished you should be on version 1.1, which is the pypi version and should be running as before.