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

Add snapcraft packaging information #6084

Merged
merged 2 commits into from Oct 10, 2019

Conversation

@devec0
Copy link
Contributor

devec0 commented Sep 22, 2019

Signed-off-by: James Hebden james@ec0.io

This PR adds packaging metadata to allow snaps (https://snapcraft.io) to be built automatically and published to the snap store, where people can install Synapse by running sudo snap install matrix-synapse. In addition to this being merged, to enable automatic publishing (the snap can still be built locally and installed with --devmode) someone with access to this repository will have to enable this repo to be monitored by the snapcraft store, so that it can automatically build and publish new versions as new commits are merged into master. The version to be published to the store will be calculated based on the projects existing git tags - I have tested this with the current develop branch, which generates the version number 1.3.1.

I am also happy to assist in the publishing of this package to the store, and maintaining any snap-related matters in regard to any part of the Matrix ecosystem.

@devec0 devec0 force-pushed the devec0:add-snapcraft branch from 9914393 to a189e55 Sep 22, 2019
@devec0

This comment has been minimized.

Copy link
Contributor Author

devec0 commented Sep 22, 2019

Just pushed a new revision of these changes removing the redundant snap wrapper I had inadvertently checked in. The snapper isn't required as the commands to start and stop Synapse can easily be added to the snapcraft.yaml in the case of Synapse, given the availability of synctl

@richvdh

This comment has been minimized.

Copy link
Member

richvdh commented Sep 23, 2019

I'm afraid we've dismissed this in the past: #4484

@richvdh richvdh closed this Sep 23, 2019
@richvdh

This comment has been minimized.

Copy link
Member

richvdh commented Sep 23, 2019

(but thank you for the contribution!)

@devec0

This comment has been minimized.

Copy link
Contributor Author

devec0 commented Sep 23, 2019

Is there any opportunity to reopen this as a discussion around publishing synapse as a snap package?

I have reviewed the previous PR, and given it was back in January, a fair bit has changed around snapcraft and snaps. I think at least having the packaging files present in the repo would be useful for folks.

As I see it, the main issues boiled down to:

  • Support burden
  • GitHub credentials
  • Maintenance of the snapcraft packaging metadata
  • Docker

As you will see by reviewing the snapcraft I have put together, I have tried to write the package in the most minimal way possible. This snap is calling synctl, which mirrors the upstream guidance on how to stop and start synapse directly. This thin shim gets placed into a systemd unit on the host, and the commands are executed inside the snap's overlay filesystem.

Snaps, unlike Docker, are not a container - think of them more as a package that runs in a chroot (like many common daemons, postfix, for example). There is some additional isolation that is configured, but there is no support burden of this, as this snap exposes the network and network-bin plugs, which are automatically connected on install. Connecting a plug is like granting a permission, it's not an ongoing item that requires support, and as these are autoconnected plugs, the user does not have to do anything other thant 'sudo snap install matrix-synapse'.

From the perspective of support burden, I would be more than happy to take over all snapcraft related inquiries and support questions, as well as maintaining the snapcraft package if required to keep up with changes. None of these would be surprising in my opinion, as any change that would break snapcraft would be very likely to break most if not all other packaging mechanisms supported today.

As to the GitHub question, that is only for automatic publishing. And there are no credentials to maintain - the snapcraft store authorizes as a GitHub 'application' and then monitors the repository using its read access so it can build and publish snaps (this does not require any additional infrastructure for the Matrix project) automatically as commits are pushed. I have structured the snapcraft in such a way that the existing git metadata will automatically be used to set versions.

Providing this snapcraft metadata and hopefully discussing the use of snaps is part of a larger goal of mine, as I would like to make Matrix and the appservice bridges as easy for people to install and keep up to date as possible - and snapd fits that well. I am also in the process writing a Juju Charm to aid in installing and configuring a Matrix homeserver for folks, which I think will help the adoption of Matrix, a very important goal in my mind.

Anyhow, thanks for reading this. I hope you'll reconsider and we can have a discussion about this - but either way, I wanted to make sure the decision was being made with up to date information and my offer to take up any support related inquiries.

@richvdh

This comment has been minimized.

Copy link
Member

richvdh commented Sep 23, 2019

ok, I'll reopen this and we can reconsider.

@richvdh richvdh reopened this Sep 23, 2019
.gitignore Outdated
@@ -40,3 +40,6 @@ _trial_temp*/
/docs/build/
/htmlcov
/pip-wheel-metadata/

# snapcraft
*.snap

This comment has been minimized.

Copy link
@richvdh

richvdh Sep 23, 2019

Member

this would need to be in the 'filename patterns' section.

This comment has been minimized.

Copy link
@devec0

devec0 Sep 24, 2019

Author Contributor

I've pushed a revised commit that moves this in amongst the file globs - thanks for the guidance, I managed to miss that structure!

@devec0 devec0 force-pushed the devec0:add-snapcraft branch from a189e55 to a3ddbf2 Sep 24, 2019
@devec0 devec0 changed the title Add snapcraft packaging informaiton Add snapcraft packaging information Sep 24, 2019
Signed-off-by: James Hebden <james@ec0.io>
@devec0 devec0 force-pushed the devec0:add-snapcraft branch from a3ddbf2 to e2dc913 Oct 1, 2019
@richvdh richvdh requested a review from matrix-org/synapse-core Oct 3, 2019
@richvdh richvdh added this to In progress in Homeserver Task Board via automation Oct 3, 2019
@richvdh richvdh moved this from In progress to Community PRs in Homeserver Task Board Oct 3, 2019
Copy link
Member

richvdh left a comment

Thanks for contributing this! We've decided we're happy to merge it for people to use as they wish, but don't plan to create an official snap store account.

@richvdh richvdh merged commit 0aee490 into matrix-org:develop Oct 10, 2019
Homeserver Task Board automation moved this from Community PRs to Done Oct 10, 2019
@devec0

This comment has been minimized.

Copy link
Contributor Author

devec0 commented Oct 14, 2019

Thanks, greats news.
If I wanted to help in supporting any snapcraft-related issues, what would be the best way to get involved?
Also, if I wanted to publish this myself on the snap store, would there be any objection or conditions you would like to place around that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
2 participants
You can’t perform that action at this time.