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

Conversation

vzhestkov
Copy link
Contributor

What does this PR change?

Adds server container with Saline inside.

GUI diff

No difference.

Before:

After:

  • DONE

Documentation

Test coverage

ℹ️ If a major new functionality is added, it is strongly recommended that tests for the new functionality are added to the Cucumber test suite

  • No tests: add explanation

  • No tests: already covered

  • Unit tests were added

  • Cucumber tests were added

  • DONE

Links

Issue(s): #
Port(s): # add downstream PR(s), if any

  • DONE

Changelogs

Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository

If you don't need a changelog check, please mark this checkbox:

  • No changelog needed

If you uncheck the checkbox after the PR is created, you will need to re-run changelog_test (see below)

Re-run a test

If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run:

  • Re-run test "changelog_test"
  • Re-run test "backend_unittests_pgsql"
  • Re-run test "java_pgsql_tests"
  • Re-run test "schema_migration_test_pgsql"
  • Re-run test "susemanager_unittests"
  • Re-run test "javascript_lint"
  • Re-run test "spacecmd_unittests"

Before you merge

Check How to branch and merge properly!

@vzhestkov vzhestkov requested a review from a team as a code owner November 8, 2024 12:58
@vzhestkov vzhestkov force-pushed the add-saline-server-container branch 3 times, most recently from 089cbf5 to be0bf41 Compare November 15, 2024 10:22
containers/server-saline-image/Dockerfile Outdated Show resolved Hide resolved
containers/server-saline-image/Dockerfile Outdated Show resolved Hide resolved
containers/server-saline-image/Dockerfile Outdated Show resolved Hide resolved
rel-eng/packages/server-saline-image Outdated Show resolved Hide resolved
Copy link
Contributor

@szachovy szachovy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional

containers/server-saline-image/Dockerfile Show resolved Hide resolved
containers/server-saline-image/Dockerfile Show resolved Hide resolved
containers/server-saline-image/Dockerfile Show resolved Hide resolved
Comment on lines +20 to +21
RUN mkdir /etc/saline.defaults && cp -r /etc/salt/saline* /etc/saline.defaults/
RUN chown -R salt:salt /etc/saline.defaults
Copy link
Contributor

@szachovy szachovy Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried something like:
COPY --chown=salt:salt "/etc/salt/saline*" "/etc/saline.defaults"

# endlabelprefix

# Saline
EXPOSE 8216/tcp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand this container is in the same network, is it possible to contact server without exposing? For example by using the name.

containers/server-saline-image/Dockerfile Show resolved Hide resolved
containers/server-saline-image/Dockerfile Show resolved Hide resolved
Comment on lines +3 to +18
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/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of all that, can you do multistage build with only the packages required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, because there are a list of the hard dependencies for python3-salt which makes sense for either master or minion, but doesn't make any sense for Saline as it's not using such calls internally. As the result on installing python3-salt it installs all the dependencies, but maybe threre is any way to install the packages with forcing to ignore the dependencies completely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +7 to +25
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a lot of cp, chown, chmod. Can you do it in the container at once and here only generate file based on NOSSL value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files are from the shared volume and runtime ones, no any changes to do it during the build time of the container.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but in case of this file specifically, it would be less code to (if possible):

  • mkdir --parents /run/salt/master /etc/salt/pki/saline
  • It's unlikely that privileges on certs are set wrongly during generation, can we remove chmod 0750 /etc/salt/pki/saline?
  • one chown in the end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chmod 0750 here is not recursive and sets the permission to the directory only while the chown call is recursive to set salt owner on the certificate and key file, I can rearrange the orders of the calls, but without 0750 on the directory the permisison is wrong there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I was thinking directory permission is not important, but maybe it's true as you can? delete folder with certs having permissions correctly set

containers/server-saline-image/run_saline.sh Show resolved Hide resolved
@deneb-alpha
Copy link
Contributor

@vzhestkov did you try to build the container pushing it to OBS?
I'm getting this:

build-packages-for-obs server-saline-image
server-saline-image
Going to build new obs packages in /tmp/push-packages-to-obs/SRPMS...
=== Building package [server-saline-image-5.1.0] from containers/server-saline-image/ (Try 1)
ERROR: Error running command: rpmbuild --define "_source_filedigest_algorithm md5"  --define "_binary_filedigest_algorithm md5"  --eval '%undefine scl' --define "_topdir /tmp/push-packages-to-obs/SRPMBUILD/rpmbuild-server-saline-image9c83uqka" --define "_sourcedir /tmp/push-packages-to-obs/SRPMBUILD/rpmbuild-server-saline-image9c83uqka/SOURCES" --define "_builddir /tmp/push-packages-to-obs/SRPMBUILD/rpmbuild-server-saline-image9c83uqka/BUILD" --define "_srcrpmdir /tmp/push-packages-to-obs/SRPMBUILD" --define "_rpmdir /tmp/push-packages-to-obs/SRPMBUILD"   --nodeps -bs /tmp/push-packages-to-obs/SRPMBUILD/rpmbuild-server-saline-image9c83uqka/SOURCES/server-saline-image-git-0.fa4069f/Dockerfile

Status code: 1

Command output: ['error: line 4: Unknown tag: ARG BASE=registry.suse.com/bci/bci-base:15.6', '']

Creating output directory: /tmp/push-packages-to-obs/SRPMBUILD
Building package [server-saline-image-5.1.0-5.1.0]
Wrote: /tmp/push-packages-to-obs/SRPMBUILD/server-saline-image-git-0.fa4069f.tar.gz
error: line 4: Unknown tag: ARG BASE=registry.suse.com/bci/bci-base:15.6



Traceback (most recent call last):
  File "/usr/bin/tito", line 23, in <module>
    CLI().main(sys.argv[1:])
  File "/usr/lib64/python3.6/site-packages/tito/cli.py", line 206, in main
    return module.main(argv)
  File "/usr/lib64/python3.6/site-packages/tito/cli.py", line 381, in main
    return builder.run(self.options)
  File "/usr/lib64/python3.6/site-packages/tito/builder/main.py", line 153, in run
    self.srpm()
  File "/usr/lib64/python3.6/site-packages/tito/builder/main.py", line 229, in srpm
    output = run_command_func(cmd)
  File "/usr/lib64/python3.6/site-packages/tito/common.py", line 468, in run_command_print
    raise RunCommandException(command, status, "\n".join(output))
tito.exception.RunCommandException: Error running command: rpmbuild --define "_source_filedigest_algorithm md5"  --define "_binary_filedigest_algorithm md5"  --eval '%undefine scl' --define "_topdir /tmp/push-packages-to-obs/SRPMBUILD/rpmbuild-server-saline-image9c83uqka" --define "_sourcedir /tmp/push-packages-to-obs/SRPMBUILD/rpmbuild-server-saline-image9c83uqka/SOURCES" --define "_builddir /tmp/push-packages-to-obs/SRPMBUILD/rpmbuild-server-saline-image9c83uqka/BUILD" --define "_srcrpmdir /tmp/push-packages-to-obs/SRPMBUILD" --define "_rpmdir /tmp/push-packages-to-obs/SRPMBUILD"   --nodeps -bs /tmp/push-packages-to-obs/SRPMBUILD/rpmbuild-server-saline-image9c83uqka/SOURCES/server-saline-image-git-0.fa4069f/Dockerfile
=== Building package [server-saline-image-5.1.0] from containers/server-saline-image/ (Try 2)
ERROR: Error running command: rpmbuild --define "_source_filedigest_algorithm md5"  --define "_binary_filedigest_algorithm md5"  --eval '%undefine scl' --define "_topdir /tmp/push-packages-to-obs/SRPMBUILD/rpmbuild-server-saline-imagecuxfv399" --define "_sourcedir /tmp/push-packages-to-obs/SRPMBUILD/rpmbuild-server-saline-imagecuxfv399/SOURCES" --define "_builddir /tmp/push-packages-to-obs/SRPMBUILD/rpmbuild-server-saline-imagecuxfv399/BUILD" --define "_srcrpmdir /tmp/push-packages-to-obs/SRPMBUILD" --define "_rpmdir /tmp/push-packages-to-obs/SRPMBUILD"   --nodeps -bs /tmp/push-packages-to-obs/SRPMBUILD/rpmbuild-server-saline-imagecuxfv399/SOURCES/server-saline-image-git-0.fa4069f/Dockerfile

Status code: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants