Skip to content

Commit

Permalink
Update to version 6.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
valdar committed Feb 13, 2016
1 parent 548a92f commit 9a4d332
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 37 deletions.
27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

This is a simple script that run for you 3 docker images:
- OpenLdap with preloaded users/groups data: valdar/ldapfuseusers:1.0.0
- address: `localhost:389` admin dn: `cn=admin,dc=example,dc=org` admin password: `admin`
- address: `localhost:389` admin dn: `cn=admin,dc=example,dc=org` admin password: `admin`
- PhpLdapAdmin (just to have a convenient way to visualize/modifiy ldap contents): osixia/phpldapadmin:0.5.0
- address: `https://localhost` admin dn: `cn=admin,dc=example,dc=org` admin password: `admin`
- address: `https://localhost` admin dn: `cn=admin,dc=example,dc=org` admin password: `admin`
- Jbosse fuse (**you need to build this image yourself**): https://github.com/paoloantinori/dockerfiles/tree/master/centos/fuse

After that it creates a fabric and update the configuration to authenticate using the openldap server. In this way you will be able to log in in to karaf console or hawtio using credentials stored in openldap:
Expand All @@ -17,32 +17,25 @@ When the script finish you should be able to check fuse container's local ports
```
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9e996ab8e080 fuse6.1:latest "/bin/sh -c 'service About an hour ago Up About an hour 0.0.0.0:49153->44444/tcp, 0.0.0.0:49154->61616/tcp, 0.0.0.0:49155->8101/tcp, 0.0.0.0:49156->8181/tcp, 0.0.0.0:49157->1099/tcp, 0.0.0.0:49158->22/tcp root
398aa9b12fc8 osixia/phpldapadmin:0.5.0 "/sbin/my_init" About an hour ago Up About an hour 80/tcp, 0.0.0.0:443->443/tcp phpldapadmin
38b8e0885dbf valdar/ldapfuseusers:1.0.0 "/sbin/my_init" About an hour ago Up About an hour 0.0.0.0:389->389/tcp openldap
9e996ab8e080 fuse6.2.1:latest "/bin/sh -c 'service About an hour ago Up About an hour 0.0.0.0:49153->44444/tcp, 0.0.0.0:49154->61616/tcp, 0.0.0.0:49155->8101/tcp, 0.0.0.0:49156->8181/tcp, 0.0.0.0:49157->1099/tcp, 0.0.0.0:49158->22/tcp root
398aa9b12fc8 osixia/phpldapadmin:0.5.0 "/sbin/my_init" About an hour ago Up About an hour 80/tcp, 0.0.0.0:443->443/tcp phpldapadmin
38b8e0885dbf valdar/ldapfuseusers:1.0.0 "/sbin/my_init" About an hour ago Up About an hour 0.0.0.0:389->389/tcp openldap
```
in this example the hawtio console would be at `http://localhost:49156`, activeMQ at `localhost:49154`, karaf console at `localhost:49155` and ssh into the container at `localhost:49158`.

## NOTE Before launching the script:
Before launching the script you need to build fuse6.1 image yourself by download JBoss Fuse distribution from
Before launching the script you need to build fuse6.2.1 image yourself by download JBoss Fuse distribution from

http://www.jboss.org/products/fuse

The build process will extract in the Docker image all the zip files it will find in your working folder. If it finds more than a file it will put all of them inside the Docker it's going to be created. Most of the time you will want to have just a single zip file.
The build process will extract in the Docker image all the zip files it will find in your working folder. If it finds more than a file it will put all of them inside the Docker it's going to be created. Most of the time you will want to have just a single zip file.

## To build your Fuse image:
# download docker file
wget https://raw.github.com/paoloantinori/dockerfiles/master/centos/fuse/fuse/Dockerfile

# check if base image has been updated
docker pull pantinor/fuse

# build your docker fuse image. you are expected to have either a copy of jboss-fuse-full-6.1.0.redhat-379.zip or a link to that file in the current folder.
docker build --rm -t fuse6.1 .







# build your docker fuse image. you are expected to have either a copy of jboss-fuse-full-6.2.1.0.redhat-084.zip or a link to that file in the current folder.
docker build --rm -t fuse6.2.1 .
45 changes: 27 additions & 18 deletions fuseLdap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@
# and our fuse insance which we are going to configure for autenticating against the ldap server.
#
# Dependencies:
# - docker
# - docker
# - sshpass, used to avoid typing the pass everytime (not needed if you are invoking the commands manually)
# to install on Fedora/Centos/Rhel:
# to install on Fedora/Centos/Rhel:
# sudo yum install -y docker-io sshpass
# - fuse6.1 docker image:
# 1) download docker file:
# wget https://raw.github.com/paoloantinori/dockerfiles/master/centos/fuse/fuse/Dockerfile
#
# 2) download Jboss fuse 6.1 from http://www.jboss.org/products/fuse zip and place it in the same directoryof the Dokerfile
# 2) download Jboss fuse 6.2.1 from http://www.jboss.org/products/fuse zip and place it in the same directoryof the Dokerfile
# NOTE: you are expected to have either a copy of jboss-fuse-*.zip or a link to that file in the current folder.
#
#
# 3) check if base image has been updated:
# docker pull pantinor/fuse
#
# 4) build your docker fuse image:
# docker build -rm -t fuse6.1 .
# 4) build your docker fuse image:
# docker build -rm -t fuse6.2.1 .
#
# Prerequesites:
# - run docker in case it's not already
# sudo service docker start
#
# Notes:
# - if you run the commands, typing them yourself in a shell, you probably won't need all the ssh aliases
# - if you run the commands, typing them yourself in a shell, you probably won't need all the ssh aliases
# or the various "sleep" invocations
# - as you may see this script is based on sleep commands, that maybe too short if your hardware is much slower than mine.
# increase those sleep time if you have to
Expand All @@ -39,6 +39,9 @@
################################################################################################
##### Preconfiguration and helper functions. Skip if not interested. #####
################################################################################################
# load helper functions
. ./helper_functions.sh


# scary but it's just for better logging if you run with "sh -x"
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
Expand All @@ -50,11 +53,11 @@ ulimit -n 4096
########## docker lab configuration

# remove old docker containers with the same names
docker stop -t 0 root
docker stop -t 0 openldap
docker stop -t 0 root
docker stop -t 0 openldap
docker stop -t 0 phpldapadmin
docker rm root
docker rm openldap
docker rm root
docker rm openldap
docker rm phpldapadmin

# expose ports to localhost, uncomment to enable always
Expand All @@ -69,20 +72,22 @@ docker run -t -i -p 389:389 -e SERVER_NAME=ldap.my-compagny.com --name openldap
# assign ip addresses to env variable, despite they should be constant on the same machine across sessions
IP_LDAP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' openldap)
docker run -t -i -p 443:443 -e LDAP_HOSTS=$IP_LDAP --name phpldapadmin -d osixia/phpldapadmin
docker run -d -t -i $EXPOSE_PORTS --name root fuse6.1
docker run -d -t -i $EXPOSE_PORTS --name root fuse6.2.1

# assign ip addresses to env variable, despite they should be constant on the same machine across sessions
IP_ROOT=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' root)

########### aliases to preconfigure ssh and scp verbose to type options

# full path of your ssh, used by the following helper aliases
SSH_PATH=$(which ssh)
SSH_PATH=$(which ssh)
### ssh aliases to remove some of the visual clutter in the rest of the script
# alias to connect to your docker images
alias ssh2host="$SSH_PATH -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o LogLevel=ERROR fuse@$IP_ROOT"
# alias to connect to the ssh server exposed by JBoss Fuse. uses sshpass to script the password authentication
alias ssh2fabric="sshpass -p admin $SSH_PATH -p 8101 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o LogLevel=ERROR admin@$IP_ROOT"
alias ssh2fabric="sshpass -p admin $SSH_PATH -p 8101 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o LogLevel=ERROR -oHostKeyAlgorithms=+ssh-dss admin@$IP_ROOT"
SSH2FABRIC="sshpass -p admin $SSH_PATH -p 8101 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o LogLevel=ERROR -oHostKeyAlgorithms=+ssh-dss admin@$IP_ROOT"


################################################################################################
##### Tutorial starts here #####
Expand All @@ -92,17 +97,21 @@ echo "waiting 10 sec to ssh into the root container"
sleep 10

# start fuse on root node
ssh2host "/opt/rh/jboss-fuse-6.1.0.redhat-379/bin/start"
# workaround for https://issues.jboss.org/browse/ENTESB-4894
ssh2host "mv /opt/rh/jboss-fuse-6.2.1.redhat-084/fabric/import/fabric/profiles/mq/amq.profile/org.apache.karaf.command.acl.ssh.properties /opt/rh/org.apache.karaf.command.acl.ssh.properties1"
ssh2host "mv /opt/rh/jboss-fuse-6.2.1.redhat-084/fabric/import/fabric/profiles/jboss/fuse/full.profile/org.apache.karaf.command.acl.ssh.properties /opt/rh/org.apache.karaf.command.acl.shell.properties2"

ssh2host "/opt/rh/jboss-*/bin/start"
echo "waiting the Fuse startup for 30 sec"
sleep 30

############################# here you are starting to interact with Fuse/Karaf
# If you want to type the commands manually you have to connect to Karaf. You can do it either with ssh or with the "client" command.
# Ex.
# ssh2fabric
# Ex.
# ssh2fabric

# create a new fabric
ssh2fabric "fabric:create --clean -r localip -g localip --wait-for-provisioning"
ssh2fabric "fabric:create --clean -r localip -g localip --wait-for-provisioning"

# show current containers
ssh2fabric "container-list"
Expand Down
4 changes: 2 additions & 2 deletions ldap-module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">


<cm:property-placeholder persistent-id="ldap.server" update-strategy="none" >
<cm:default-properties>
<cm:property name="ldaphostserver" value="localhost"/>
</cm:default-properties>
</cm:property-placeholder>
<jaas:config name="karaf" rank="10">
<jaas:config name="karaf" rank="100">
<jaas:module className="io.fabric8.jaas.ZookeeperLoginModule" flags="sufficient"/>
<jaas:module className="org.apache.karaf.jaas.modules.ldap.LDAPLoginModule" flags="sufficient">
initialContextFactory=com.sun.jndi.ldap.LdapCtxFactory
Expand Down

0 comments on commit 9a4d332

Please sign in to comment.