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

Clean restart #12

Merged
merged 8 commits into from
Mar 19, 2018
Merged

Clean restart #12

merged 8 commits into from
Mar 19, 2018

Conversation

joshmoore
Copy link
Member

@joshmoore joshmoore commented Mar 15, 2018

This branch attempts a couple of things:

  • Add a stable directory (/var/lib/apacheds) as a volume
  • Improve signal handling (with dumb-init)
  • Cleanly restart after a docker stop

fixes gh-11

@joshmoore
Copy link
Member Author

Currently looking into

jvm 1    | [08:55:59] ERROR [org.apache.directory.server.wrapper.ApacheDsTanukiWrapper] - Failed to start the service.
jvm 1    | org.apache.directory.api.ldap.model.exception.LdapOtherException: ERR_250_ENTRY_ALREADY_EXISTS ou=system already exists!
jvm 1    |      at org.apache.directory.server.core.api.partition.AbstractPartition.initialize(AbstractPartition.java:94)
jvm 1    |      at org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1822)
jvm 1    |      at org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:1251)
jvm 1    |      at org.apache.directory.server.ApacheDsService.initDirectoryService(ApacheDsService.java:364)
jvm 1    |      at org.apache.directory.server.ApacheDsService.start(ApacheDsService.java:197)
jvm 1    |      at org.apache.directory.server.ApacheDsService.start(ApacheDsService.java:153)
jvm 1    |      at org.apache.directory.server.wrapper.ApacheDsTanukiWrapper.start(ApacheDsTanukiWrapper.java:175)
jvm 1    |      at org.tanukisoftware.wrapper.WrapperManager$12.run(WrapperManager.java:2788)
jvm 1    | Caused by: org.apache.directory.api.ldap.model.exception.LdapOtherException: ERR_250_ENTRY_ALREADY_EXISTS ou=system already exists!
jvm 1    |      at org.apache.directory.server.core.api.partition.AbstractPartition.initialize(AbstractPartition.java:94)
jvm 1    |      at org.apache.directory.server.core.shared.partition.DefaultPartitionNexus.addContextPartition(DefaultPartitionNexus.java:809)
jvm 1    |      at org.apache.directory.server.core.shared.partition.DefaultPartitionNexus.doInit(DefaultPartitionNexus.java:227)
jvm 1    |      at org.apache.directory.server.core.api.partition.AbstractPartition.initialize(AbstractPartition.java:89)
jvm 1    |      ... 7 more
jvm 1    | Caused by: org.apache.directory.api.ldap.model.exception.LdapEntryAlreadyExistsException: ERR_250_ENTRY_ALREADY_EXISTS ou=system already exists!
jvm 1    |      at org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.add(AbstractBTreePartition.java:698)
jvm 1    |      at org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition.doInit(JdbmPartition.java:522)
jvm 1    |      at org.apache.directory.server.core.api.partition.AbstractPartition.initialize(AbstractPartition.java:89)
jvm 1    |      ... 10 more

See also:

joshmoore added a commit to joshmoore/apacheds-k8s-app that referenced this pull request Mar 15, 2018
joshmoore added a commit to joshmoore/apacheds-k8s-app that referenced this pull request Mar 15, 2018
Dockerfile Outdated
ENV APACHEDS_USER apacheds
ENV APACHEDS_GROUP apacheds

RUN ln -s ${APACHEDS_DATA}-${APACHEDS_VERSION} ${APACHDS_DATA}
Copy link
Member

Choose a reason for hiding this comment

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

typo: APACHDS_DATA
so there appear to be two data directories:

root@63b43aeb4f88:/var/lib# ls -l apacheds* -d
drwxr-xr-x 3 root     root     4096 Mar 16 16:43 apacheds
drwxr-xr-x 3 apacheds apacheds 4096 Mar 15 11:43 apacheds-2.0.0-M24

root@63b43aeb4f88:/var/lib# ls apacheds*
apacheds:
default

apacheds-2.0.0-M24:
default

Copy link
Member Author

Choose a reason for hiding this comment

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

Cheers.

README.md Outdated
@@ -13,7 +13,7 @@ The project sources can be found on [GitHub](https://github.com/openmicroscopy/a

## Installation

The folder */var/lib/apacheds-${APACHEDS_VERSION}* contains the runtime data and thus has been defined as a volume. A [volume container](https://docs.docker.com/userguide/dockervolumes/) could be used for that. The image uses exactly the file system structure defined by the [ApacheDS documentation](https://directory.apache.org/apacheds/advanced-ug/2.2.1-debian-instance-layout.html).
The folder */var/lib/apacheds* contains the runtime data and thus has been defined as a volume. A [volume container](https://docs.docker.com/userguide/dockervolumes/) could be used for that. The image uses exactly the file system structure defined by the [ApacheDS documentation](https://directory.apache.org/apacheds/advanced-ug/2.2.1-debian-instance-layout.html).
Copy link
Member

Choose a reason for hiding this comment

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

https://docs.docker.com/userguide/dockervolumes/ is broken. In any case volume containers aren't needed anymore.

#############################################
# ApacheDS wrapper command
#############################################

CMD ${APACHEDS_CMD}
Copy link
Member

Choose a reason for hiding this comment

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

Since this is removed do you still need the configurability provided by ENV APACHEDS_CMD ENV APACHEDS_SCRIPT: https://github.com/openmicroscopy/apacheds-docker/pull/12/files#diff-3254677a7917c6c01f55212f86c57fbfL41 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I couldn't get the syntax right to put the environment variable as the entrypoint (at least not without reverting to bash -c. I'll drop the rest.

scripts/run.sh Outdated
}

trap shutdown INT TERM
tail --pid=$(cat $PIDFILE) -f /dev/null
Copy link
Member

Choose a reason for hiding this comment

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

There's also

  • /var/lib/apacheds/default/log/apacheds.log
  • /var/lib/apacheds/default/log/wrapper.log
    Is one of these more useful?

Copy link
Member Author

Choose a reason for hiding this comment

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

Neither is good, but that's likely a log4j.properties issue. I'll use the more specific apacheds.log.

@joshmoore
Copy link
Member Author

Pushed.

Copy link
Member

@manics manics left a comment

Choose a reason for hiding this comment

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

👍

@joshmoore joshmoore merged commit ede8d0d into ome:master Mar 19, 2018
@joshmoore joshmoore deleted the clean-restart branch March 19, 2018 11:08
@pwalczysko
Copy link
Member

I was asked to review here too, but did not get to it for IDR-reasons.

Also, I am just not sure aobut the workflow:

  • have a ldap DB on the apacheds docker (on outreach ?)
  • restart the apacheds docker (how to do this ?)
  • observe that the ldap DB was preserved

Is that right ? @joshmoore is the workflow correct and, after we have clarified the steps (see above) I can run it as a part of some trello card task (which one ?) ?

@joshmoore
Copy link
Member Author

did not get to it for IDR-reasons.

No worries, @pwalczysko. Though I am looking forward to your showing me how this change could be better (which I'll happily implement and release incrementally) I was equally if not more interested in how you found the usability of the deployed service. (Can give you pointers to that off-PR)

Is that right ?

Roughly yes. What this work tries to enable (using your bullet list) is:

  • have an apacheds container with a persistent data directory (or "volume")
  • restart the apacheds container
  • observe that that the changes to ldap are preserved

This would be my hope that the mentioned service that I spun up will become a persistent way for us to maintain users, including multiple groups and perhaps even different styles of LDAP layouts.

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.

Drop version from data directory
3 participants