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 saline server container #9451

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions containers/server-saline-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# SPDX-License-Identifier: MIT
#!BuildTag: uyuni/server-saline:latest

ARG BASE=registry.suse.com/bci/bci-base:15.6
FROM $BASE

ARG PRODUCT=Uyuni
ARG VENDOR="Uyuni project"
ARG URL="https://www.uyuni-project.org/"
ARG REFERENCE_PREFIX="registry.opensuse.org/uyuni"

RUN groupadd -r --gid 10554 salt && \
useradd -r -s /usr/sbin/nologin -g salt -d /var/lib/salt --uid 10554 salt

# Main packages
RUN zypper ref && zypper --non-interactive up
RUN zypper --gpg-auto-import-keys --non-interactive install --auto-agree-with-licenses --force-resolution saline python3-saline && zypper clean --all
RUN cat /var/log/zypp/history

RUN mkdir /etc/saline.defaults && cp -r /etc/salt/saline* /etc/saline.defaults/
RUN chown -R salt:salt /etc/saline.defaults

# Build Service required labels
# labelprefix=org.opensuse.uyuni.server-saline
LABEL org.opencontainers.image.title="${PRODUCT} server saline container"
LABEL org.opencontainers.image.description="Image contains the ${PRODUCT} server component to extend Salt capabilities"
LABEL org.opencontainers.image.created="%BUILDTIME%"
LABEL org.opencontainers.image.vendor="${VENDOR}"
LABEL org.opencontainers.image.url="${URL}"
LABEL org.opencontainers.image.name=server-saline-image
LABEL org.opencontainers.image.version=5.1.0
LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL org.opensuse.reference="${REFERENCE_PREFIX}/salt-saline:${PRODUCT_VERSION}.%RELEASE%"
# endlabelprefix

# Saline
EXPOSE 8216/tcp

COPY cleanup.sh /cleanup.sh
RUN bash /cleanup.sh ; rm /cleanup.sh

COPY run_saline.sh /run_saline.sh
RUN chmod +x /run_saline.sh
CMD /run_saline.sh
4 changes: 4 additions & 0 deletions containers/server-saline-image/_service
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<services>
<service mode="buildtime" name="kiwi_metainfo_helper"/>
<service mode="buildtime" name="docker_label_helper"/>
</services>
21 changes: 21 additions & 0 deletions containers/server-saline-image/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

sed -i '/pam_systemd.so/d' /etc/pam.d/*

rpm -e --nodeps \
systemd systemd-presets-branding-openSUSE systemd-default-settings-branding-openSUSE systemd-default-settings systemd-presets-common-SUSE \
curl container-suseconnect kubic-locale-archive file-magic libmagic1 dmidecode netcfg update-alternatives \
zypper libzypp boost-license1_66_0 libboost_thread1_66_0 libsolv-tools libsolv-tools-base \
info xz gzip perl-base ncurses-utils libsqlite3-0 \
libsodium23 iproute2 p11-kit-tools libp11-kit0 cracklib-dict-small \
libxtables12 libcap-ng0 libcap2 libapparmor1 procps libprocps8 libusb-1_0-0 \
python3-Babel python3-zypp-plugin python3-rpm python3-pyasn1 python3-asn1crypto python3-urllib3 python3-idna \
python3-pyparsing python3-pycparser python3-setuptools python3-cryptography python3-M2Crypto python3-psutil \
python3-cffi python3-chardet python3-pyOpenSSL python3-py python3-requests python3-ply python3-pytz python3-jmespath \
python3-appdirs python3-apipkg \
rpm-config-SUSE rpm-ndb

rm -rf /var/lib/zypp /var/log/zypp /var/cache/zypp /var/log/* /var/lib/rpm/*

mkdir -p /var/log/salt
chown salt:salt /var/log/salt
35 changes: 35 additions & 0 deletions containers/server-saline-image/run_saline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

if [[ ! -z "$TZ" ]]; then
timedatectl set-timezone $TZ
fi

cp -r /etc/saline.defaults/saline* /etc/salt/

mkdir -p /run/salt/master
chown -R salt:salt /run/salt

mkdir -p /etc/salt/pki/saline

if [[ "$NOSSL" == "YES" ]]; then
cat > /etc/salt/saline.d/restapi.conf <<EOL
restapi:
host: 0.0.0.0
disable_ssl: true
EOL
else
cp /etc/pki/tls/certs/spacewalk.crt /etc/salt/pki/saline/saline.crt
cp /etc/pki/tls/private/spacewalk.key /etc/salt/pki/saline/saline.key
chown -R salt:salt /etc/salt/pki/saline
chmod 0750 /etc/salt/pki/saline
cat > /etc/salt/saline.d/restapi.conf <<EOL
restapi:
host: 0.0.0.0
ssl_crt: /etc/salt/pki/saline/saline.crt
ssl_key: /etc/salt/pki/saline/saline.key
EOL
fi

chown -R salt:salt /etc/salt/saline*

exec /usr/bin/salined -l info
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Initial version
1 change: 1 addition & 0 deletions rel-eng/packages/server-saline-image
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.1.0 containers/server-saline-image/
Loading