#50441 Ticket 50439 - Update docker integration to work out of source directory
Closed 3 years ago by spichugi. Opened 4 years ago by firstyear.
firstyear/389-ds-base xxxxx-docker-suse-source  into  master

file added
+3
@@ -0,0 +1,3 @@ 

+ .git

+ .gitignore

+ ./src/cockpit/389-console/node_modules

file modified
+2 -3
@@ -1,4 +1,3 @@ 

  

- 

- poc:

- 	docker build -t 389-poc:latest -f docker/389ds_poc/Dockerfile .

+ suse:

+ 	docker build -t 389-ds-suse:master -f docker/389-ds-suse/Dockerfile .

docker/389-ds-fedora/Dockerfile docker/389ds_poc/Dockerfile
file renamed
file was moved with no change to the file
@@ -0,0 +1,78 @@ 

+ #!BuildTag: 389-ds-container

+ FROM opensuse/leap:15.1

+ MAINTAINER wbrown@suse.de

+ 

+ EXPOSE 3389 3636

+ 

+ # RUN zypper ar -G obs://network:ldap network:ldap && \

+ RUN zypper ar http://download.opensuse.org/update/leap/15.1/oss/ u && \

+     zypper ar http://download.opensuse.org/distribution/leap/15.1/repo/oss/ m && \

+     zypper ar http://download.opensuse.org/repositories/network:ldap/openSUSE_Leap_15.1/ "network:ldap" && \

+     zypper mr -p 97 "network:ldap" && \

+     zypper --gpg-auto-import-keys ref

+ 

+ RUN zypper --non-interactive si --build-deps-only 389-ds && \

+     zypper in -y 389-ds rust cargo rust-std && \

+     zypper rm -y 389-ds

+ 

+ # Install build dependencies

+ # RUN zypper in -C -y autoconf automake cracklib-devel cyrus-sasl-devel db-devel doxygen gcc-c++ \

+ #   gdb krb5-devel libcmocka-devel libevent-devel libtalloc-devel libtevent-devel libtool \

+ #   net-snmp-devel openldap2-devel pam-devel pkgconfig python-rpm-macros "pkgconfig(icu-i18n)" \

+ #   "pkgconfig(icu-uc)" "pkgconfig(libcap)" "pkgconfig(libpcre)" "pkgconfig(libsystemd)" \

+ #   "pkgconfig(nspr)" "pkgconfig(nss)" rsync cargo rust rust-std acl cyrus-sasl-plain db-utils \

+ #   bind-utils krb5 fillup shadow openldap2-devel pkgconfig "pkgconfig(nspr)" "pkgconfig(nss)" \

+ #   "pkgconfig(systemd)" python3-argcomplete python3-argparse-manpage python3-ldap \

+ #   python3-pyasn1 python3-pyasn1-modules python3-python-dateutil python3-six krb5-client \

+ #   mozilla-nss-tools

+ 

+ # Push source code to the container

+ ADD ./ /usr/local/src/389-ds-base

+ WORKDIR /usr/local/src/389-ds-base

+ 

+ 

+ # Build and install

+ # Derived from rpm --eval '%configure' on opensuse.

+ RUN ./configure --host=x86_64-suse-linux-gnu --build=x86_64-suse-linux-gnu \

+     --program-prefix= \

+     --disable-dependency-tracking \

+     --prefix=/usr \

+     --exec-prefix=/usr \

+     --bindir=/usr/bin \

+     --sbindir=/usr/sbin \

+     --sysconfdir=/etc \

+     --datadir=/usr/share \

+     --includedir=/usr/include \

+     --libdir=/usr/lib64 \

+     --libexecdir=/usr/lib \

+     --localstatedir=/var \

+     --sharedstatedir=/var/lib \

+     --mandir=/usr/share/man \

+     --infodir=/usr/share/info \

+     --disable-dependency-tracking \

+     --enable-debug \

+     --enable-gcc-security --enable-autobind --enable-auto-dn-suffix --with-openldap \

+     --enable-cmocka --enable-rust --disable-perl --with-pythonexec="python3" --without-systemd \

+     --libexecdir=/usr/lib/dirsrv/ --prefix=/ && \

+     make -j 12 && \

+     make install && \

+     make lib389 && \

+     make lib389-install

+ 

+ # Link some known static locations to point to /data

+ RUN mkdir -p /data/config && \

+     mkdir -p /data/ssca && \

+     mkdir -p /data/run && \

+     mkdir -p /var/run/dirsrv && \

+     ln -s /data/config /etc/dirsrv/slapd-localhost && \

+     ln -s /data/ssca /etc/dirsrv/ssca && \

+     ln -s /data/run /var/run/dirsrv

+ 

+ # Temporal volumes for each instance

+ 

+ VOLUME /data

+ 

+ # Set the userup correctly.

+ # USER dirsrv

+ 

+ CMD [ "/usr/sbin/dscontainer", "-r" ]

file modified
+11 -2
@@ -45,6 +45,12 @@ 

  # is always available!

  log = setup_script_logger("container-init", True)

  

+ # Handle any dead child process signals we receive. Wait for them to terminate, or

+ # if they are not found, move on.

+ def _sigchild_handler():

+     log.debug("Received SIGCHLD ...")

+     os.waitpid(-1, os.WNOHANG)

+ 

  def begin_magic():

      log.info("The 389 Directory Server Container Bootstrap")

      # Leave this comment here: UofA let me take this code with me provided
@@ -158,8 +164,8 @@ 

  

      # Create the marker to say we exist. This is also a good writable permissions

      # test for the volume.

-     with open('/data/config/container.inf', 'w'):

-         pass

+     with open('/data/config/container.inf', 'w') as f:

+         f.write('allocated')

  

      # TODO: All of this is contingent on the server starting *and*

      # ldapi working ... Perhaps these are better inside ns-slapd core
@@ -206,6 +212,9 @@ 

      # THE LETTER OF THE DAY IS C AND THE NUMBER IS 10

  

  if __name__ == '__main__':

+     # Before all else, we are INIT so setup sigchild

+     signal.signal(signal.SIGCHLD, _sigchild_handler)

+ 

      parser = argparse.ArgumentParser(allow_abbrev=True, description="""

  dscontainer - this is a container entry point that will run a stateless

  instance of 389-ds. You should not use this unless you are developing or

@@ -212,6 +212,8 @@ 

              return True

          else:

              raise

+     # Tell the OS to reap this please ...

+     os.waitpid(pid, os.WNOHANG)

      return True

  

  def pid_from_file(pidfile):

Bug Description: Docker did not function in some cases, and we had to wait for
releases via rpm.

Fix Description: This adds the support to build from source into the tree
so that we can build and test git master. This also resolves a var/run
issue in the image, as well as some other minor python cleaning such
as handling sigchld to act as init.

https://pagure.io/389-ds-base/issue/50439

Author: William Brown william@blackhats.net.au

Review by: ???

It looks a bit weird to me that you removed the whole Docker file for Fedora and replaced it with SUSE one...
I have nothing against SUSE, of course, but I think we shouldn't remove Fedora support but fix it instead.
Or do I miss something?

I don't build on fedora, so I'm not going to update it - the fedora version was well outdated, broken, didn't work properly .... so I wasn't going to update it.

It would be easy to add a fedora one in parallel, which is why I named the folders as such :)

I don't build on fedora, so I'm not going to update it - the fedora version was well outdated, broken, didn't work properly .... so I wasn't going to update it.
It would be easy to add a fedora one in parallel, which is why I named the folders as such :)

Ok, then I think it is reasonable to not delete the existing Fedora Doker file but create an issue that it is outdated...

It would be easier to just start fresh ... You'll be rewriting the whole thing anyway, so delete or fix is much over muchness .... someone from the fedora side needs to do the work, and I'm certainly happy to advise, but the suse version is probably a guide you could use.

It would be easier to just start fresh ... You'll be rewriting the whole thing anyway, so delete or fix is much over muchness .... someone from the fedora side needs to do the work, and I'm certainly happy to advise, but the suse version is probably a guide you could use.

Sure, I agree with you.
My point is that we create unnecessary confusion by deleting something in the PR which is about adding different stuff.

I think we should not mix things up.
If this PR is about SUSE Docker file and building from a source directory tree, it should be only about it.
The second PR will remove the old one and will add a new Fedora Docker file. This will result in a clean git-log history.

Okay, I'll change the PR to reflect this then.

rebased onto d7d207e414545cd7d8cd24e29036cd17ff9c0996

4 years ago

Okay, restored the fedora file, and renamed it to make it clearer what it is.

I haven't tested on SUSE (I trust your judgement here) but the rest looks good!
You have my ack:)

rebased onto 5c6ffae

4 years ago

Pull-Request has been merged by firstyear

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3499

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago