-
Notifications
You must be signed in to change notification settings - Fork 77
Github: Add and replace snap build job #1470
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
Open
roosterfish
wants to merge
3
commits into
canonical:main
Choose a base branch
from
roosterfish:merge_packaging
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| name: microcloud | ||
| base: core24 | ||
| assumes: | ||
| - snapd2.59 | ||
| version: git | ||
| grade: devel | ||
| license: AGPL-3.0-only | ||
|
|
||
| title: MicroCloud | ||
| summary: Deploy a low-touch, open source cloud platform in minutes with MicroCloud. | ||
| description: |- | ||
| MicroCloud creates a lightweight cluster of machines that operates as a scalable private cloud. It combines LXD for virtualization, MicroCeph for distributed storage, and MicroOVN for networking—all automatically configured by the **MicroCloud snap** for reproducible, scalable deployments. | ||
|
|
||
| With MicroCloud, you can eliminate the complexity of manual setup and quickly benefit from high availability, streamlined security updates, and fine-grained access control for multi-tenancy. Cluster members can run full virtual machines or lightweight system containers with bare-metal performance. Manage it through your choice of client interfaces, including a graphical UI and CLI. | ||
|
|
||
| MicroCloud is designed for small-scale private clouds and hybrid cloud extensions. Its efficiency and simplicity also make it an excellent choice for edge computing, test labs, and other resource-constrained use cases. | ||
|
|
||
| **MicroCloud supports single-node deployments, but at least 3 nodes are recommended for high availability.** | ||
|
|
||
| Once the simple bootstrapping is completed, users can launch, run and manage their workloads, and otherwise utilize regular LXD functionalities. | ||
|
|
||
| To get started, LXD, MicroCeph, MicroOVN and MicroCloud snaps are needed. Users can install them at once with the command: | ||
|
|
||
| `snap install lxd microceph microcloud microovn` | ||
|
|
||
| The bootstrapping process starts with running | ||
|
|
||
| `microcloud init` on the initiating member | ||
| and `microcloud join` on the joining members if you're using more than one system. | ||
|
|
||
| Following the simple CLI prompts, a working MicroCloud will be ready within minutes. | ||
|
|
||
| contact: lxd@lists.canonical.com | ||
| issues: https://github.com/canonical/microcloud/issues | ||
| source-code: https://github.com/canonical/microcloud | ||
| website: | ||
| - https://canonical.com/microcloud | ||
| - https://documentation.ubuntu.com/microcloud/latest/microcloud/ | ||
| confinement: strict | ||
|
|
||
| apps: | ||
| # Service | ||
| daemon: | ||
| command: commands/daemon.start | ||
| daemon: simple | ||
| plugs: | ||
| - lxd | ||
| - microceph | ||
| - microovn | ||
| - network | ||
| - network-bind | ||
|
|
||
| # Commands | ||
| microcloud: | ||
| command: commands/microcloud | ||
| plugs: | ||
| - network | ||
|
|
||
| parts: | ||
| dqlite: | ||
| source: https://github.com/canonical/dqlite | ||
| source-branch: main | ||
| source-depth: 1 | ||
| source-type: git | ||
| plugin: autotools | ||
| autotools-configure-parameters: | ||
| - --prefix= | ||
| - --enable-build-raft | ||
| stage-packages: | ||
| - liblz4-1 | ||
| - libsqlite3-0 | ||
| - libuv1 | ||
| build-packages: | ||
| - liblz4-dev | ||
| - libsqlite3-dev | ||
| - libuv1-dev | ||
| - pkg-config | ||
| organize: | ||
| usr/lib/: lib/ | ||
| prime: | ||
| - lib/libdqlite*so* | ||
| - lib/*/libuv* | ||
| #- lib/*/liblz4.so* # use liblz4.so from the base snap | ||
|
|
||
| microcloud: | ||
| source: . | ||
| after: | ||
| - dqlite | ||
| build-snaps: | ||
| - go | ||
|
roosterfish marked this conversation as resolved.
|
||
| plugin: nil | ||
| override-pull: | | ||
| craftctl default | ||
| set -ex | ||
|
|
||
| # Download the dependencies | ||
| go get -v -tags=agent ./... | ||
| override-build: | | ||
| set -ex | ||
|
|
||
| # Setup build environment | ||
| export CGO_CFLAGS="-I${CRAFT_STAGE}/include/ -I${CRAFT_STAGE}/usr/local/include/" | ||
| export CGO_LDFLAGS="-L${CRAFT_STAGE}/lib/ -L${CRAFT_STAGE}/usr/local/lib/" | ||
| export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)" | ||
|
|
||
| # Build the binaries | ||
| go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/microcloud" -tags=agent ./cmd/microcloud | ||
| go build -trimpath -o "${CRAFT_PART_INSTALL}/bin/microcloudd" -tags=agent,libsqlite3 ./cmd/microcloudd | ||
|
|
||
| # Workaround for https://bugs.launchpad.net/ubuntu/+source/vim/+bug/1968912 | ||
| mkdir -p "${CRAFT_PART_INSTALL}/usr/share/vim/vim91" | ||
| touch "${CRAFT_PART_INSTALL}/usr/share/vim/vim91/defaults.vim" | ||
| prime: | ||
| - bin/microcloud | ||
| - bin/microcloudd | ||
| - usr/share/vim/vim91/defaults.vim | ||
|
|
||
| strip: | ||
| after: | ||
| - dqlite | ||
| - microcloud | ||
| plugin: nil | ||
| override-prime: | | ||
| set -x | ||
|
|
||
| # Strip binaries | ||
| find "${CRAFT_PRIME}"/bin -type f -exec strip -s {} + | ||
|
|
||
| # Strip libraries | ||
| find "${CRAFT_PRIME}"/lib -type f -exec strip -s {} + | ||
|
|
||
| wrappers: | ||
| plugin: dump | ||
| source: snapcraft/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/sh | ||
| export DQLITE_SOCKET="@snap.${SNAP_INSTANCE_NAME}.dqlite" | ||
|
|
||
| MICROCLOUDD="microcloudd" | ||
| if [ -x "${SNAP_COMMON}/microcloudd.debug" ]; then | ||
| MICROCLOUDD="${SNAP_COMMON}/microcloudd.debug" | ||
| echo "==> WARNING: Using a custom debug MicroCloud binary!" | ||
| GOCOVERDIR="${SNAP_COMMON}/data/cover" | ||
| export GOCOVERDIR | ||
| mkdir -p "${GOCOVERDIR}" | ||
| fi | ||
|
|
||
| exec "${MICROCLOUDD}" --state-dir "${SNAP_COMMON}/state" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/bin/sh | ||
| MICROCLOUD="microcloud" | ||
| if [ -x "${SNAP_COMMON}/microcloud.debug" ]; then | ||
| MICROCLOUD="${SNAP_COMMON}/microcloud.debug" | ||
| GOCOVERDIR="${SNAP_COMMON}/data/cover" | ||
| export GOCOVERDIR | ||
| mkdir -p "${GOCOVERDIR}" | ||
| fi | ||
|
|
||
| # Change the location of $VIMRUNTIME root to be able to define the defaults.vim file. | ||
| # This is to prevent seeing the message 'E1187: Failed to source defaults.vim' | ||
| # which is caused by not having the 'vim-runtime' package. | ||
| # Also see https://bugs.launchpad.net/ubuntu/+source/vim/+bug/1968912. | ||
| export VIMRUNTIME="${SNAP}/usr/share/vim/vim91" | ||
| export EDITOR="vim.tiny -Z --clean" | ||
|
roosterfish marked this conversation as resolved.
|
||
|
|
||
| # Run the CLI from an accessible directory which allows reads. | ||
| # When launching VIM it tries to access the $PWD regardless of the --clean setting. | ||
| cd "$SNAP_USER_DATA" || exit | ||
| exec "${MICROCLOUD}" --state-dir "${SNAP_COMMON}/state" "$@" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.