Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B9CA6200CAC for ; Mon, 19 Jun 2017 16:40:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B8E39160BE1; Mon, 19 Jun 2017 14:40:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C14B5160BD5 for ; Mon, 19 Jun 2017 16:40:18 +0200 (CEST) Received: (qmail 87884 invoked by uid 500); 19 Jun 2017 14:40:18 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 87875 invoked by uid 99); 19 Jun 2017 14:40:17 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jun 2017 14:40:17 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D8C09DFE22; Mon, 19 Jun 2017 14:40:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: smckinney@apache.org To: commits@directory.apache.org Message-Id: <2ab92b5360f8430995c3cd55cbed7abe@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: directory-fortress-core git commit: FC-212 - ApacheDS in Docker Date: Mon, 19 Jun 2017 14:40:17 +0000 (UTC) archived-at: Mon, 19 Jun 2017 14:40:19 -0000 Repository: directory-fortress-core Updated Branches: refs/heads/master 5621dcf68 -> a5d7b19c6 FC-212 - ApacheDS in Docker Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/a5d7b19c Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/a5d7b19c Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/a5d7b19c Branch: refs/heads/master Commit: a5d7b19c6526a4cf0af8ab532ee78e7923c7af11 Parents: 5621dcf Author: Shawn McKinney Authored: Mon Jun 19 09:40:12 2017 -0500 Committer: Shawn McKinney Committed: Mon Jun 19 09:40:12 2017 -0500 ---------------------------------------------------------------------- README-QUICKSTART-DOCKER-APACHEDS.md | 234 ++++++++++++++++++++++++++++++ 1 file changed, 234 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/a5d7b19c/README-QUICKSTART-DOCKER-APACHEDS.md ---------------------------------------------------------------------- diff --git a/README-QUICKSTART-DOCKER-APACHEDS.md b/README-QUICKSTART-DOCKER-APACHEDS.md new file mode 100644 index 0000000..1c67aa9 --- /dev/null +++ b/README-QUICKSTART-DOCKER-APACHEDS.md @@ -0,0 +1,234 @@ + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +# APACHEDS & Fortress QUICKSTART on DOCKER + +------------------------------------------------------------------------------- +## Table of Contents + + * Document Overview + * SECTION 1. Prerequisites + * SECTION 2. Apache Fortress Core Setup using APACHEDS Docker Image + * SECTION 3. Apache Fortress Core Integration Test + * SECTION 4. Docker Commands +___________________________________________________________________________________ +## Document Overview + + * This document contains instructions to install Apache Fortress Core using APACHEDS Docker image. + * It uses [apacheds-for-apache-fortress-tests](src/docker/apacheds-for-apache-fortress-tests/Dockerfile) + +------------------------------------------------------------------------------- +## SECTION 1. Prerequisites + +Minimum hardware requirements: + * 2 Cores + * 4GB RAM + +Minimum software requirements: + * Centos or Debian Machine + * Java SDK 8 + * Apache Maven3++ + * docker-engine + +___________________________________________________________________________________ +## SECTION 2. Apache Fortress Core Setup using OpenLDAP Docker Image + +1. Download the apache directory fortress-core source from apache git repo: + + a. from the command line: + ``` + git clone https://git-wip-us.apache.org/repos/asf/directory-fortress-core.git + cd directory-fortress-core + ``` + +2. Now build the apache directory fortress docker image (trailing dot matters): + + ``` + docker build -t apachedirectory/apacheds-for-apache-fortress-tests -f src/docker/apacheds-for-apache-fortress-tests/Dockerfile . + + ``` + +3. Run the docker container: + + ``` + CONTAINER_ID=$(docker run -d -P apachedirectory/openldap-for-apache-fortress-tests) + CONTAINER_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "103389/tcp") 0).HostPort}}' $CONTAINER_ID) + echo $CONTAINER_PORT + ``` + + *note: make note of the port as it's needed later + *depending on your docker setup may need to run as root or sudo priv's. + +4. Prepare fortress to use the apacheds running inside docker container: + + ``` + cp build.properties.example build.properties + ``` + +5. Edit the *build.properties* file: + + ``` + vi build.properties + ``` + +6. Update the *ldap.port* prop: + + ``` + ldap.port= port from earlier step + ``` + +7. Save and exit + +8. Prepare your terminal for execution of maven commands. + + ``` + #!/bin/sh + export M2_HOME=... + export JAVA_HOME=... + export PATH=$PATH:$M2_HOME/bin + ``` + +9. Run the maven install to build fortress lib and prepare its configuration (fortress.properties): + + ``` + mvn clean install + ``` + +___________________________________________________________________________________ +## SECTION 3. Apache Fortress Core Integration Test + +1. From fortress core base folder, enter the following commands: + + ``` + mvn install -Dload.file=./ldap/setup/refreshLDAPData.xml + mvn install -Dload.file=./ldap/setup/DelegatedAdminManagerLoad.xml + ``` + + *These will build the Directory Information Tree (DIT), create the config and data policies needed for the integration test to follow.* + +2. Next, enter the following command: + + ``` + mvn -Dtest=FortressJUnitTest test + ``` + + *Tests the APIs against your LDAP server.* + +3. Verify the tests worked: + + ``` + Tests run: 122, Failures: 0, Errors: 0, Skipped: 0 + Results : + + Tests run: 122, Failures: 0, Errors: 0, Skipped: 0 + + [INFO] + [INFO] --- maven-antrun-plugin:1.8:run (default) @ fortress-core --- + [INFO] Executing tasks + + fortress-load: + [INFO] Executed tasks + [INFO] ------------------------------------------------------------------------ + [INFO] BUILD SUCCESS + ``` + +4. Rerun the tests to verify teardown APIs work: + + ``` + mvn -Dtest=FortressJUnitTest test + ``` + +5. Verify that worked also: + + ``` + Results : + + Tests run: 154, Failures: 0, Errors: 0, Skipped: 0 + + [INFO] + [INFO] --- maven-antrun-plugin:1.8:run (default) @ fortress-core --- + [INFO] Executing tasks + + fortress-load: + [INFO] Executed tasks + [INFO] ------------------------------------------------------------------------ + [INFO] BUILD SUCCESS + [INFO] ------------------------------------------------------------------------ + ``` + Notice 154 tests ran this time vs 122 the first time. + + Test Notes: + * If tests complete without errors Apache Fortress works with your ApacheDS server (in Docker). + * These tests load thousands of objects into the target ldap server. + * Warning messages are negative tests in action. + +6. Optional sections in the [README](README.md) file: + + * SECTION 11. Instructions to run the Apache Fortress Command Line Interpreter (CLI). + * SECTION 12. Instructions to run the Apache Fortress Command Console. + * SECTION 13. Instructions to build and test the Apache Fortress samples. + * SECTION 14. Instructions to performance test. + +___________________________________________________________________________________ +## SECTION 4. Docker Commands + +Here are some common commands needed to manage the Docker image. + +#### Build image + + ``` + docker build -t apachedirectory/openldap-for-apache-fortress-tests -f src/docker/openldap-for-apache-fortress-tests/Dockerfile . + ``` + + * trailing dot matters + +Or just to be sure don't use cached layers: + + ``` + docker build --no-cache=true -t apachedirectory/openldap-for-apache-fortress-tests -f src/docker/openldap-for-apache-fortress-tests/Dockerfile . + ``` + +#### Run container + + ``` + CONTAINER_ID=$(docker run -d -P apachedirectory/openldap-for-apache-fortress-tests) + CONTAINER_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "103389/tcp") 0).HostPort}}' $CONTAINER_ID) + echo $CONTAINER_PORT + ``` + +#### Go into the container + + ``` + docker exec -it $CONTAINER_ID bash + ``` + +#### Restart container + + ``` + docker restart $CONTAINER_ID + ``` + +#### Stop and delete container + + ``` + docker stop $CONTAINER_ID + docker rm $CONTAINER_ID + ``` + +____________________________________________________________________________________ +#### END OF README-QUICKSTART-DOCKER-APACHEDS \ No newline at end of file