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

Create a deb package #25

Merged
merged 48 commits into from
May 12, 2021
Merged

Create a deb package #25

merged 48 commits into from
May 12, 2021

Conversation

velovix
Copy link
Member

@velovix velovix commented May 4, 2021

This adds the necessary configuration and CI to build the CLI as a deb package. This is accomplished using dh-virtualenv, which allows us to package Python dependencies in a virtual environment. Using dh-virtualenv not only allows us to use our own versions of Python dependencies, it also isolates our dependencies from the rest of the system. This allows us to have our own isolated installation of Docker Compose as a dependency, whose version we can update at our own pace.

The deb also obsoletes the need to install curl and rsync for the user, since they can now be expressed as package dependencies. However, Docker is currently still being installed for the user. We could consider using Ubuntu's version of Docker if we're comfortable with supporting an older version.

This includes an overhaul of our configuration system, so that different distributions of the CLI can be distributed with different defaults. Defaults are now provided by a defaults.yaml file. The deb package is given its own custom defaults.yaml that is configured to use system package locations like /var/lib/brainframe instead of user-installed locations like /var/local/brainframe.

Unfortunately, dh-virtualenv requires that we have a setup.py because it runs python3 setup.py install to add the application code to the virtual environment. I've tried to keep the setup.py as minimal as possible, shelling out to Poetry when I can.

This change is, admittedly, not immediately useful on its own. We would need a PPA or our own repository to distribute this deb to users, and updated instructions to go along with it. We will probably want to provide a script similar to get-docker.sh that handles all the installation steps for the user so that we can preserve our single-line installation experience.

See #13, which this PR does not resolve on its own.

To-do before merge:

  • Test on a clean Ubuntu 18.04 instance
  • Test on a clean Ubuntu 20.04 instance
  • Do extensive testing on the Pip version to ensure there aren't any regressions

@velovix
Copy link
Member Author

velovix commented May 4, 2021

If you want to try it out, the deb is available as a build artifact on CircleCI.

.circleci/config.yml Show resolved Hide resolved

build-deb:
docker:
- image: cimg/base:stable-18.04
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a matrix for each version of ubuntu?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. It doesn't seem like the resulting deb has any attachment to 18.04 specifically, and the deb installs fine on my local 20.04 installation. I imagine this will become more clear when we start trying to put this thing in a package repository.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out you were right. I'm not sure how it worked before, but building the deb on one version and installing it on another breaks some stuff. I've made the build-deb step a matrix build for 18.04 and 20.04.

.circleci/config.yml Show resolved Hide resolved
.circleci/config.yml Show resolved Hide resolved
brainframe/cli/config.py Outdated Show resolved Hide resolved
brainframe/cli/config.py Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
@velovix velovix requested a review from apockill May 10, 2021 05:41
@velovix
Copy link
Member Author

velovix commented May 10, 2021

@BryceBeagle @apockill

Okay! I've added a new CI job to test the deb against an Ubuntu 20.04 instance. Unfortunately, CircleCI doesn't offer 18.04 machine instances, so we can't automatically test those. I've also done manual testing for the Pip version (admittedly through local a wheel, but the behavior should be the same from PyPI), Ubuntu 18.04 with its deb, and Ubuntu 20.04 with its deb. Everything appears to work just fine. PTAPTAL!

.circleci/config.yml Show resolved Hide resolved
brainframe/cli/main.py Outdated Show resolved Hide resolved
package/debian/compat Show resolved Hide resolved
package/setup.py Outdated Show resolved Hide resolved
brainframe/cli/config.py Outdated Show resolved Hide resolved
Copy link
Member

@apockill apockill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 📦

@velovix velovix requested a review from BryceBeagle May 11, 2021 00:06
brainframe/cli/main.py Outdated Show resolved Hide resolved
@velovix velovix requested a review from BryceBeagle May 11, 2021 19:52
Copy link
Member

@BryceBeagle BryceBeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, linting failed

@velovix velovix requested a review from BryceBeagle May 12, 2021 18:46
@velovix velovix merged commit 51d3740 into master May 12, 2021
@velovix velovix deleted the feature/13-deb-install branch May 12, 2021 18:53
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.

3 participants