Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Basic rock configuration for HashiCorp Consul #68

Closed
wants to merge 1 commit into from

Conversation

jadonn
Copy link

@jadonn jadonn commented Sep 24, 2024

OpenStack Masakari requires HashiCorp Consul. This change adds a rockcraft.yaml configuration for building a Consul rock from the consul-client snap I registered. The Consul rock is for running Consul in server mode in Kubernetes. The consult-client snap will provide Consul for running in client mode on compute hypervisor nodes.

OpenStack Masakari requires HashiCorp Consul. This change adds
a rockcraft.yaml configuration for building a Consul rock from
the consul-client snap I registered. The Consul rock is for
running Consul in server mode in Kubernetes. The consult-client
snap will provide Consul for running in client mode on compute
hypervisor nodes.
@gboutry
Copy link
Collaborator

gboutry commented Sep 25, 2024

I think we can go on a much more simple rock for Consul, such as:

base: bare
build-base: ubuntu@24.04
platforms:
  amd64:

run-user: _daemon_

services:
  consul:
    override: replace
    command: bin/consul agent
    user: consul
    group: consul

parts:
  consul-user:
    plugin: nil
    override-prime: |
      craftctl default
      # Give permission and create the required directories
      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
    after: [consul-user]
    stage-packages:
      # following are just for debug purposes
      - bash_bins
      - coreutils_bins
    plugin: nil
    stage-snaps:
      - consul-client/latest/edge
    organize:
      consul: bin/consul

Is there a reason why the consul-client snap is based on core22 instead of core24?

Can we make sure all config / data paths are present and with the right permission inside the Rock?

Ideally, this Rock should be able to have pebble run as _daemon_ (rootless) and the consul service as the consul user. But this might be pushing it for now.

@gboutry
Copy link
Collaborator

gboutry commented Oct 2, 2024

Closed in favor of #71

@gboutry gboutry closed this Oct 2, 2024
@gboutry gboutry reopened this Oct 2, 2024
@gboutry
Copy link
Collaborator

gboutry commented Oct 2, 2024

Commits are not signed, can't merge

@gboutry gboutry closed this Oct 2, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants