diff --git a/rocks/consul/README.md b/rocks/consul/README.md index fb7a57f..7df81b0 100644 --- a/rocks/consul/README.md +++ b/rocks/consul/README.md @@ -17,7 +17,7 @@ it will help ensure that all layers of the image are imported into docker (this is just the top layer). ```bash -> skopeo --insecure-policy copy oci-archive:consul_v1.19.2_amd64.rock docker-daemon:consul:v1.19.2 +> skopeo --insecure-policy copy oci-archive:consul_1.19.2_amd64.rock docker-daemon:consul:1.19.2 ``` If you are interested in giving it a go in Microk8s, you can @@ -25,8 +25,8 @@ export the image from your docker registry and then into the microk8s registry: ```bash -> docker save consul:v1.19.2 > ./consul_v1.19.2.tar -> microk8s ctr image import ./consul_v1.19.2.tar +> docker save consul:1.19.2 > ./consul_1.19.2.tar +> microk8s ctr image import ./consul_1.19.2.tar # Try with sunbeam -> juju attach-resource consul consul-image=consul:v1.19.2 +> juju attach-resource consul consul-image=consul:1.19.2 ``` diff --git a/rocks/consul/rockcraft.yaml b/rocks/consul/rockcraft.yaml index 5978c4b..adf2f83 100644 --- a/rocks/consul/rockcraft.yaml +++ b/rocks/consul/rockcraft.yaml @@ -3,49 +3,42 @@ summary: Hashicorp Consul license: Apache-2.0 description: | Ubuntu distribution of Hashicorp Consul -version: 'v1.19.2' - -# renovate: base: ubuntu:22.04@sha256:1b8d8ff4777f36f19bfe73ee4df61e3a0b789caeff29caa019539ec7c9a57f95 -base: ubuntu@22.04 +version: "1.19.2" +base: bare +build-base: ubuntu@24.04 platforms: amd64: -package-repositories: - - type: apt - cloud: caracal - priority: always +run-user: _daemon_ services: consul: override: replace - command: consul + command: bin/consul agent + user: consul + group: consul parts: consul-user: plugin: nil - overlay-script: | - groupadd --root $CRAFT_OVERLAY --gid 5996 --system consul - useradd \ - --gid 5996 \ - --uid 5996 \ - --no-create-home \ - --home /var/lib/consul \ - --root $CRAFT_OVERLAY \ - --system \ - --shell /bin/false \ - consul override-prime: | craftctl default - # Give permission and create the required directories - mkdir -p $CRAFT_PRIME/var/lib/consul - chown -R 5996:5996 $CRAFT_PRIME/var/lib/consul + mkdir -p $CRAFT_PRIME/etc || true + echo "consul:x:5996:" >> $CRAFT_PRIME/etc/group + echo "consul:x:5996:5996::/var/lib/consul:/usr/bin/false" >> $CRAFT_PRIME/etc/passwd + folders=(var/lib/consul etc/consul.d) + for folder in "${folders[@]}"; do + mkdir -p $CRAFT_PRIME/$folder || true + chown -R 5996:5996 $CRAFT_PRIME/$folder + done - snap-consul-client: # replace with consul snap once it is available + snap-consul-client: after: [consul-user] + stage-packages: + # following are just for debug purposes + - bash_bins + - coreutils_bins plugin: nil stage-snaps: - - consul-client/latest/edge - override-prime: | - mkdir -p $CRAFT_PRIME/usr/local/bin - cp /root/parts/$CRAFT_PART_NAME/install/consul $CRAFT_PRIME/usr/local/bin/consul \ No newline at end of file + - consul-client/latest/edge