Skip to content
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

CI setup #154

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft

CI setup #154

wants to merge 31 commits into from

Conversation

emilecantin
Copy link
Contributor

This is now a complete CI setup. It builds pyinstaller archives for all 3 major desktop platforms, as well as a more "basic", platform-agnostic package that only contains the python code + the firmware.

Unfortunately, I wasn't able to properly build a Raspberry Pi pyinstaller release, as the ARM support on Travis isn't quite there yet, and it turns out it's ARMv8 (RPi is ARMv7), so it probably won't work. To properly support the Raspberry Pi, I've created the platform-agnostic package along with an install script that should install everything WC needs to run. I've tested it on my RPi3, and I was able to flash various versions of the firmware with one slight modification to the code (fixing a path); we should add a flag somewhere to fix this. I've also amended the README instructions to match this new installation process. Overall, let me know if this is acceptable from a usability standpoint.

@madgrizzle
Copy link
Collaborator

I downloaded the linux release you created and it appears to work. I was able to downgrade and upgrade through the release manager, which is really important.

Looking at the RPI portion of the README.md file, does it just run it from source?

@emilecantin
Copy link
Contributor Author

@madgrizzle Pretty much. I simply bundle the compiled firmware with it.

@madgrizzle
Copy link
Collaborator

We'd have to modify how webcontrol's ReleaseManager works to work with this approach. I'm not against it though if it all works. Part of the reason for pyinstaller was that I had to originally build opencv and numpy from source to get it to work and asking people to spend 4-hours to do that wasn't practical. But looks like it can be installed via apt now.

@emilecantin
Copy link
Contributor Author

It's not too different (still unzipping a file over that directory), but if we change some dependencies, we'll need a mechanism to install them as well. I think it might be okay to mention it in the release logs, that people need to re-run the install script.

@madgrizzle
Copy link
Collaborator

Is there harm in running the install script as part of the upgrade process, even if there aren't any changes? The idea is to make it so people don't have to do anything but hit the upgrade button.

@emilecantin
Copy link
Contributor Author

Kind of, that script needs to run as root; and it's not a good idea to run the whole WebControl as root. Altough I guess I could add something in the pre-built RaspberryPi image that runs the script with the correct permissions.

@madgrizzle
Copy link
Collaborator

Right now, we have two archs that don't build via Travis-CI, RPI and Win32, correct? These could still be manually built and uploaded to the release if needed. Perhaps that process be automated as well so they fire-off by watching the github repo or some other means of notification to build and upload a new release. I guess there aren't any cloud-based RPI and Win32 machines, huh?

@emilecantin
Copy link
Contributor Author

@madgrizzle correct. RPi would ideally use the pre-built image (or just follow the install instructions), and is Win32 really still in use? It used to be a big deal 10 years ago, but now? (Last time I dealt with Windows machines was 2013, I'm genuinely curious)

@madgrizzle
Copy link
Collaborator

Re: RPI, I'd like not to force people to change their installations if it can be avoided. I don't know how many people use webcontrol on an RPI currently, but I know its being used. I think this is something to discuss in general (maybe outside this PR) to see if we can find a good solution.

Re: Win-32.. There are people trying to use old computers/laptops to run webcontrol for their maslow and this was a build that was requested. Whether or not anyone still uses it, I don't know. Is there a way to track downloads on github? Maybe we need a poll on the maslow forum.

@emilecantin
Copy link
Contributor Author

Good points. I personally am planning on running WebControl on a Raspberry Pi, but I'm really just getting started, so I don't really have an existing installation to maintain. I'll see what we can do with the upgrade process for these.

Agreed about the poll; Win32 computers might have become even too old for "shop computers", but we never know. Want to launch it on the forums?

In other news, the releases will look like this: https://github.com/WebControlCNC/WebControl/releases/tag/2020-05-26-1423

They're triggered by tagging a commit, like this: git tag -a 2020-05-26-1423 -m "Test the tagged builds", and then pushing the tag with git push --tags. Once everything is done, it'll be marked as pre-release, and we can change that flag once we're confident it'll be stable for everyone.

@gb0101010101
Copy link
Contributor

GitHub does count asset downloads and it is publicly accessible via their API
(not mine) https://somsubhra.com/github-release-stats/?username=madgrizzle&repository=WebControl

@madgrizzle
Copy link
Collaborator

Interesting.. I switched it to look at this repo since it has more history. Seems like maybe a few people download the win32 version. RPI is definitely in the lead.

@emilecantin
Copy link
Contributor Author

Okay, I've been working on the Raspberry Pi upgrade from pyinstaller to "regular" python (my "universal" release), and I encountered a few snags:

  • The current upgrade process unzips the new version over the old version. This works fine for new files and modified files, but anything that should have been removed in the upgrade won't be.
  • The current upgrade process uses the current version's script to do the unzip, so any changes to it (e.g post-install stuff) needs to happen elsewhere.
  • On a more general note, the main process exits when unzipping the new version. I understand why it's needed, but it wreaks havok when running WebControl as a service: systemd re-launches it as soon as it exits, and I had to use a config option for the service to keep systemd from killing the orphaned children. This works for the upgrade process, but it's undesireable in general; it could leave orphan processes behind in the case of a crash.
  • Again on a more general note, there's no UI feedback as to what's happening during the upgrade, making me worried as to what's happening.

With that, I propose the following changes to the upgrade process:

  • Move the unzipping logic in Python
  • Do the actual unzipping to a sibling directory of the current one (or maybe somewhere in .WebControl, in case of a permission issue), named webcontrol_next
  • At this point, there should be a hook to install any new dependencies for the next version (probably just run a specific script, in the new version)
  • Once the unzipping is done, rename the current directory webcontrol_old and move webcontrol_next to webcontrol.
  • Either tell the user to restart WebControl, or just exit, letting systemd restart the new version

The dependencies hook could move somewhere else, but it needs to run before restarting WebControl, and probably only for the "universal" install type.

In any case, these changes to the upgrade process would help it become more interactive, and allow for an easy "undo" in case of an error at some point.

@emilecantin emilecantin marked this pull request as draft May 27, 2020 14:02
@emilecantin
Copy link
Contributor Author

I've made the proposed changes to the upgrade code in #155

@davidelang
Copy link

davidelang commented May 30, 2020 via email

@davidelang
Copy link

davidelang commented May 30, 2020 via email

@gb0101010101
Copy link
Contributor

I don't think using debian package is a good idea beyond installing Python or Docker. For everything else the release process is too slow, with outdated packages, and adds a lot of bureaucracy in updating them. LTS releases rarely change.

Python PIP (with PyInstaller) is much better for rapid changes as is working.
Docker will be easy once its setup. Just stop, destroy, download, and run.

@davidelang
Copy link

davidelang commented May 31, 2020 via email

@emilecantin
Copy link
Contributor Author

Yeah, I've slowly been thinking more and more about doing a .deb for the Raspberry Pi version; there's a lot of merit into that.

Pyinstaller works well for users, but it's a pain for package builders; because you can't cross-build with it. (which IMO is pretty bad; even native code can be cross-compiled in most cases). I'd keep it for desktop systems (Win, Mac and Linux), but I'd prefer to build a .deb for everything else.

And regarding internet; I think it's safe to assume they have it when they're updating through the UI.

The reason we're talking about changing the build process is to move it to a cloud-based build; so we don't depend on Madgrizzle's personal machines to build. Upping the bus factor of this project in the process.

@davidelang
Copy link

davidelang commented May 31, 2020 via email

@zaneclaes
Copy link
Member

docker doesn't work on windows, which is why we moved away from it to the
pyinstaller version.

Huh? I've been using Docker on Windows for years.

@davidelang
Copy link

davidelang commented May 31, 2020 via email

@madgrizzle
Copy link
Collaborator

madgrizzle commented May 31, 2020

It was more the need to enable hyperv which windows 10 home doesn't support. There may be a way to run it in Windows home through a virtualboz VM though, but with the build problems I was having in general (and being on my own at that point) and concern regarding how complex everything was getting, I moved to getting pyinstaller to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants