-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from canonical/initial-implementation
Initial implementation
- Loading branch information
Showing
6 changed files
with
226 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,27 @@ | ||
name: Build ROCK | ||
|
||
on: | ||
workflow_call: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Setup LXD | ||
uses: canonical/setup-lxd@main | ||
- name: Install dependencies | ||
run: | | ||
sudo snap install yq | ||
sudo snap install rockcraft --classic | ||
- name: Build ROCK | ||
run: | | ||
rockcraft pack | ||
- name: Upload locally built ROCK artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: valkey-rock | ||
path: charmed-valkey_*_amd64.rock |
This file contains 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,55 @@ | ||
name: Publish to GHCR | ||
|
||
env: | ||
RELEASE: edge | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yaml | ||
publish: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
permissions: | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Setup Docker | ||
run: | | ||
sudo snap install docker | ||
sudo addgroup --system docker; sudo adduser $USER docker | ||
newgrp docker | ||
sudo snap disable docker; sudo snap enable docker | ||
- name: Install skopeo | ||
run: | | ||
sudo snap install --devmode --channel edge skopeo | ||
- name: Install yq | ||
run: | | ||
sudo snap install yq | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: valkey-rock | ||
path: . | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ secrets.GHCR_USER }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
- name: Import and push to GHCR | ||
run: | | ||
version=$(yq '(.version|split("-"))[0]' rockcraft.yaml) | ||
rock_image_version=$(yq '(.version)' rockcraft.yaml) | ||
base=$(yq '(.base|split("@"))[1]' rockcraft.yaml) | ||
tag=${version}-${base}-${{ env.RELEASE }} | ||
echo "Publishing charmed-valkey:${tag}" | ||
sudo skopeo --insecure-policy copy \ | ||
oci-archive:charmed-valkey_${rock_image_version}_amd64.rock \ | ||
docker-daemon:ghcr.io/canonical/charmed-valkey:${tag} | ||
docker push ghcr.io/canonical/charmed-valkey:${tag} |
This file contains 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,38 @@ | ||
# Charmed Valkey rock | ||
[![Release to GHCR](https://github.com/canonical/charmed-valkey-rock/actions/workflows/release.yaml/badge.svg)](https://github.com/canonical/charmed-valkey-rock/actions/workflows/release.yaml) | ||
|
||
This repository contains the packaging metadata for creating a rock of Charmed Valkey built from Charmed Valkey | ||
Snap. For more information on rocks, visit the [rockcraft Github](https://github.com/canonical/rockcraft). | ||
|
||
## Building the rock | ||
The steps outlined below are based on the assumption that you are building the rock with the latest LTS of Ubuntu. | ||
If you are using another version of Ubuntu or another operating system, the process may be different. | ||
|
||
### Clone Repository | ||
```bash | ||
git clone [email protected]:canonical/charmed-valkey-rock.git | ||
cd charmed-valkey-rock | ||
``` | ||
### Installing Prerequisites | ||
```bash | ||
sudo snap install rockcraft --edge --classic | ||
sudo snap install docker | ||
sudo snap install lxd | ||
sudo snap install skopeo --edge --devmode | ||
``` | ||
### Configuring Prerequisites | ||
```bash | ||
sudo usermod -aG docker $USER | ||
sudo lxd init --auto | ||
``` | ||
*_NOTE:_* You will need to open a new shell for the group change to take effect (i.e. `su - $USER`) | ||
### Packing and Running the rock | ||
```bash | ||
rockcraft pack | ||
sudo skopeo --insecure-policy copy oci-archive:charmed-valkey*.rock docker-daemon:<username>/charmed-valkey:<tag> | ||
docker run --rm -it <username>/charmed-valkey:<tag> | ||
``` | ||
|
||
## License: | ||
The Charmed Valkey rock is free software, distributed under the Apache Software License, version 2.0. See licenses for | ||
more information. |
File renamed without changes.
This file contains 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,49 @@ | ||
# License 1 | ||
|
||
BSD 3-Clause License | ||
|
||
Copyright (c) 2024-present, Valkey contributors | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the | ||
following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the | ||
following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the | ||
following disclaimer in the documentation and/or other materials provided with the distribution. | ||
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote | ||
products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
# License 2 | ||
|
||
BSD 3-Clause License | ||
|
||
Copyright (c) 2006-2020, Salvatore Sanfilippo | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the | ||
following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the | ||
following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the | ||
following disclaimer in the documentation and/or other materials provided with the distribution. | ||
* Neither the name of Redis nor the names of its contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains 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,57 @@ | ||
# Copyright 2024 Canonical Ltd. | ||
# See LICENSE-rock file for licensing details. | ||
--- | ||
name: charmed-valkey # the name of your ROCK | ||
base: [email protected] # the base environment for this ROCK | ||
version: '7.2.5' # just for humans. Semantic versioning is recommended | ||
summary: Charmed Valkey ROCK OCI # 79 char long summary | ||
description: | | ||
This is an OCI image that bundles Valkey together with the metrics exporter | ||
in order to be used in Charmed Operators, providing automated operations | ||
management from day 0 to day 2 on Valkey, on top of a Virtual Machine cluster | ||
and K8s cluster. It is an open source, end-to-end, production ready data | ||
platform on top of cloud native technologies. | ||
license: Apache-2.0 # your application's SPDX license | ||
|
||
platforms: # The platforms this ROCK should be built on and run on | ||
amd64: | ||
|
||
services: | ||
valkey: | ||
override: replace | ||
startup: enabled | ||
summary: Start Valkey | ||
command: "valkey-server --dir /var/lib/valkey" | ||
user: valkey | ||
redis_exporter: | ||
override: replace | ||
startup: enabled | ||
summary: Start Metrics Exporter | ||
command: "/bin/redis_exporter" | ||
user: valkey | ||
|
||
parts: | ||
valkey: | ||
plugin: nil | ||
stage-snaps: | ||
- charmed-valkey/latest/edge | ||
valkey-user: | ||
plugin: nil | ||
after: | ||
- valkey | ||
overlay-script: | | ||
# Create a user in the $CRAFT_OVERLAY chroot | ||
groupadd -R $CRAFT_OVERLAY -g 584788 valkey | ||
useradd -R $CRAFT_OVERLAY -M -r -g valkey -u 584788 valkey | ||
override-prime: | | ||
mkdir -p $CRAFT_PRIME/var/lib/valkey | ||
chown -R 584788:584788 $CRAFT_PRIME/var/lib/valkey | ||
redis_exporter: | ||
plugin: go | ||
after: | ||
- valkey-user | ||
source: https://github.com/canonical/redis_exporter.git | ||
source-type: git | ||
source-branch: "v1.60.0" | ||
build-snaps: | ||
- go/1.21/stable |