Skip to content

Commit

Permalink
Merge branch 'release-0.9.0' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
BertrandGouny committed Sep 29, 2019
2 parents d868f20 + 1c3dc57 commit 6d1b92e
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 36 deletions.
101 changes: 101 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
language: bash

services:
- docker
env:
global:
- NAME="osixia/phpldapadmin"
- VERSION="${TRAVIS_BRANCH}-dev"
matrix:
- TARGET_ARCH=amd64 QEMU_ARCH=x86_64
- TARGET_ARCH=arm32v7 QEMU_ARCH=arm
- TARGET_ARCH=arm64v8 QEMU_ARCH=aarch64

addons:
apt:
# The docker manifest command was added in docker-ee version 18.x
# So update our current installation and we also have to enable the experimental features.
sources:
- sourceline: "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
key_url: "https://download.docker.com/linux/ubuntu/gpg"
packages:
- docker-ce

before_install:
- docker --version
- mkdir $HOME/.docker
- 'echo "{" > $HOME/.docker/config.json'
- 'echo " \"experimental\": \"enabled\"" >> $HOME/.docker/config.json'
- 'echo "}" >> $HOME/.docker/config.json'
- sudo service docker restart

install:
# For cross buidling our images
# This is necessary because travis-ci.org has only x86_64 machines.
# If travis-ci.org gets native arm builds, probably this step is not
# necessary any more.
- docker run --rm --privileged multiarch/qemu-user-static:register --reset
# Bats is necessary for the UT
- curl -o bats.tar.gz -SL https://github.com/bats-core/bats-core/archive/v1.1.0.tar.gz
- mkdir bats-core && tar -xf bats.tar.gz -C bats-core --strip-components=1
- cd bats-core/
- sudo ./install.sh /usr/local
- cd ..

before_script:
# Set baseimage.
- sed -i -e "s/FROM \(.*\)/FROM \1-${TARGET_ARCH}/g" image/Dockerfile;
- cat image/Dockerfile;
# If this is a tag then change the VERSION variable to only have the
# tag name and not also the commit hash.
- if [ -n "$TRAVIS_TAG" ]; then
VERSION=$(echo "${TRAVIS_TAG}" | sed -e 's/\(.*\)[-v]\(.*\)/\1\2/g');
fi
- if [ "${TRAVIS_BRANCH}" == 'stable' ]; then
VERSION="stable";
fi

script:
- make build-nocache NAME=${NAME} VERSION=${VERSION}-${TARGET_ARCH}
# Run the test and if the test fails mark the build as failed.
- make test NAME=${NAME} VERSION=${VERSION}-${TARGET_ARCH}

before_deploy:
- docker run -d --name test_image ${NAME}:${VERSION}-${TARGET_ARCH} sleep 10
- sleep 5
- sudo docker ps | grep -q test_image
# To have `DOCKER_USER` and `DOCKER_PASS`
# use `travis env set`.
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
- make tag NAME=${NAME} VERSION=${VERSION}-${TARGET_ARCH}

deploy:
provider: script
on:
all_branches: true
script: make push NAME=${NAME} VERSION=${VERSION}-${TARGET_ARCH}

jobs:
include:
- stage: Manifest creation
install: skip
script: skip
after_deploy:
- docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
- docker manifest create ${NAME}:${VERSION} ${NAME}:${VERSION}-amd64 ${NAME}:${VERSION}-arm32v7 ${NAME}:${VERSION}-arm64v8;
docker manifest annotate ${NAME}:${VERSION} ${NAME}:${VERSION}-amd64 --os linux --arch amd64;
docker manifest annotate ${NAME}:${VERSION} ${NAME}:${VERSION}-arm32v7 --os linux --arch arm --variant v7;
docker manifest annotate ${NAME}:${VERSION} ${NAME}:${VERSION}-arm64v8 --os linux --arch arm64 --variant v8;

# The latest tag is coming from the stable branch of the repo
- if [ "${TRAVIS_BRANCH}" == 'stable' ]; then
docker manifest create ${NAME}:latest ${NAME}:${VERSION}-amd64 ${NAME}:${VERSION}-arm32v7 ${NAME}:${VERSION}-arm64v8;
docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-amd64 --os linux --arch amd64;
docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-arm32v7 --os linux --arch arm --variant v7;
docker manifest annotate ${NAME}:latest ${NAME}:${VERSION}-arm64v8 --os linux --arch arm64 --variant v8;
fi

- docker manifest push ${NAME}:${VERSION};
if [ "${TRAVIS_BRANCH}" == 'stable' ]; then
docker manifest push ${NAME}:latest;
fi
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.9.0] - 2019-09-29
## Added
- Multiarch support

### Changed
- Upgrade phpLDAPadmin to 1.2.5
- Upgrade baseimage to web-baseimage:1.2.0 (debian buster)

## [0.8.0] - 2019-05-29
### Changed
- phpLDAPadmin 1.2.4
- Upgrade phpLDAPadmin 1.2.4
- Upgrade baseimage to web-baseimage:1.1.2

## [0.7.2] - 2018-09-04
Expand Down Expand Up @@ -98,6 +106,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.5.0] - 2015-03-03
New version initial release, no changelog before this sorry.

[0.9.0]: https://github.com/osixia/docker-phpLDAPadmin/compare/v0.8.0...v0.9.0
[0.8.0]: https://github.com/osixia/docker-phpLDAPadmin/compare/v0.7.2...v0.8.0
[0.7.2]: https://github.com/osixia/docker-phpLDAPadmin/compare/v0.7.1...v0.7.2
[0.7.1]: https://github.com/osixia/docker-phpLDAPadmin/compare/v0.7.0...v0.7.1
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NAME = osixia/phpldapadmin
VERSION = 0.8.0
VERSION = 0.9.0

.PHONY: build build-nocache test tag-latest push push-latest release git-tag-version

Expand All @@ -12,6 +12,9 @@ build-nocache:
test:
env NAME=$(NAME) VERSION=$(VERSION) bats test/test.bats

tag:
docker tag $(NAME):$(VERSION) $(NAME):$(VERSION)

tag-latest:
docker tag $(NAME):$(VERSION) $(NAME):latest

Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[hub]: https://hub.docker.com/r/osixia/phpldapadmin/

Latest release: 0.8.0 - phpLDAPadmin 1.2.4 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/phpldapadmin/) 
Latest release: 0.9.0 - phpLDAPadmin 1.2.5 - [Changelog](CHANGELOG.md) | [Docker Hub](https://hub.docker.com/r/osixia/phpldapadmin/) 

**A docker image to run phpLDAPadmin.**
> [phpldapadmin.sourceforge.net](http://phpldapadmin.sourceforge.net)
Expand All @@ -27,7 +27,7 @@ Latest release: 0.8.0 - phpLDAPadmin 1.2.4 - [Changelog](CHANGELOG.md) | [Docker
- [Link environment file](#link-environment-file)
- [Make your own image or extend this image](#make-your-own-image-or-extend-this-image)
- [Advanced User Guide](#advanced-user-guide)
- [Extend osixia/phpldapadmin:0.8.0 image](#extend-osixiaphpldapadmin080-image)
- [Extend osixia/phpldapadmin:0.9.0 image](#extend-osixiaphpldapadmin090-image)
- [Make your own phpLDAPadmin image](#make-your-own-phpldapadmin-image)
- [Tests](#tests)
- [Kubernetes](#kubernetes)
Expand All @@ -41,7 +41,7 @@ Run a phpLDAPadmin docker image by replacing `ldap.example.com` with your ldap h

docker run -p 6443:443 \
--env PHPLDAPADMIN_LDAP_HOSTS=ldap.example.com \
--detach osixia/phpldapadmin:0.8.0
--detach osixia/phpldapadmin:0.9.0

That's it :) you can access phpLDAPadmin on [https://localhost:6443](https://localhost:6443)

Expand All @@ -51,7 +51,7 @@ Example script:

#!/bin/bash -e
docker run --name ldap-service --hostname ldap-service --detach osixia/openldap:1.1.8
docker run --name phpldapadmin-service --hostname phpldapadmin-service --link ldap-service:ldap-host --env PHPLDAPADMIN_LDAP_HOSTS=ldap-host --detach osixia/phpldapadmin:0.8.0
docker run --name phpldapadmin-service --hostname phpldapadmin-service --link ldap-service:ldap-host --env PHPLDAPADMIN_LDAP_HOSTS=ldap-host --detach osixia/phpldapadmin:0.9.0

PHPLDAP_IP=$(docker inspect -f "{{ .NetworkSettings.IPAddress }}" phpldapadmin-service)

Expand All @@ -68,7 +68,7 @@ but setting your own config.php is possible. 2 options:

- Link your config file at run time to `/container/service/phpldapadmin/assets/config/config.php` :

docker run --volume /data/my-config.php:/container/service/phpldapadmin/assets/config/config.php --detach osixia/phpldapadmin:0.8.0
docker run --volume /data/my-config.php:/container/service/phpldapadmin/assets/config/config.php --detach osixia/phpldapadmin:0.9.0

- Add your config file by extending or cloning this image, please refer to the [Advanced User Guide](#advanced-user-guide)

Expand All @@ -77,7 +77,7 @@ but setting your own config.php is possible. 2 options:
#### Use autogenerated certificate
By default HTTPS is enable, a certificate is created with the container hostname (it can be set by docker run --hostname option eg: phpldapadmin.my-company.com).

docker run --hostname phpldapadmin.my-company.com --detach osixia/phpldapadmin:0.8.0
docker run --hostname phpldapadmin.my-company.com --detach osixia/phpldapadmin:0.9.0

#### Use your own certificate

Expand All @@ -87,22 +87,22 @@ You can set your custom certificate at run time, by mounting a directory contain
--env PHPLDAPADMIN_HTTPS_CRT_FILENAME=my-cert.crt \
--env PHPLDAPADMIN_HTTPS_KEY_FILENAME=my-cert.key \
--env PHPLDAPADMIN_HTTPS_CA_CRT_FILENAME=the-ca.crt \
--detach osixia/phpldapadmin:0.8.0
--detach osixia/phpldapadmin:0.9.0

Other solutions are available please refer to the [Advanced User Guide](#advanced-user-guide)

#### Disable HTTPS
Add --env PHPLDAPADMIN_HTTPS=false to the run command :

docker run --env PHPLDAPADMIN_HTTPS=false --detach osixia/phpldapadmin:0.8.0
docker run --env PHPLDAPADMIN_HTTPS=false --detach osixia/phpldapadmin:0.9.0

### Fix docker mounted file problems

You may have some problems with mounted files on some systems. The startup script try to make some file adjustment and fix files owner and permissions, this can result in multiple errors. See [Docker documentation](https://docs.docker.com/v1.4/userguide/dockervolumes/#mount-a-host-file-as-a-data-volume).

To fix that run the container with `--copy-service` argument :

docker run [your options] osixia/phpldapadmin:0.8.0 --copy-service
docker run [your options] osixia/phpldapadmin:0.9.0 --copy-service

### Debug

Expand All @@ -111,11 +111,11 @@ Available levels are: `none`, `error`, `warning`, `info`, `debug` and `trace`.

Example command to run the container in `debug` mode:

docker run --detach osixia/phpldapadmin:0.8.0 --loglevel debug
docker run --detach osixia/phpldapadmin:0.9.0 --loglevel debug

See all command line options:

docker run osixia/phpldapadmin:0.8.0 --help
docker run osixia/phpldapadmin:0.9.0 --help

## Environment Variables

Expand Down Expand Up @@ -168,7 +168,7 @@ See how to [set your own environment variables](#set-your-own-environment-variab

If you want to set this variable at docker run command add the tag `#PYTHON2BASH:` and convert the yaml in python:

docker run --env PHPLDAPADMIN_LDAP_HOSTS="#PYTHON2BASH:[{'ldap.example.org': [{'server': [{'tls': True}]},{'login': [{'bind_id': 'cn=admin,dc=example,dc=org'}]}]}, 'ldap2.example.org', 'ldap3.example.org']" --detach osixia/phpldapadmin:0.8.0
docker run --env PHPLDAPADMIN_LDAP_HOSTS="#PYTHON2BASH:[{'ldap.example.org': [{'server': [{'tls': True}]},{'login': [{'bind_id': 'cn=admin,dc=example,dc=org'}]}]}, 'ldap2.example.org', 'ldap3.example.org']" --detach osixia/phpldapadmin:0.9.0

To convert yaml to python online: http://yaml-online-parser.appspot.com/

Expand Down Expand Up @@ -215,14 +215,14 @@ Other environment variables:
Environment variables can be set by adding the --env argument in the command line, for example:

docker run --env PHPLDAPADMIN_LDAP_HOSTS="ldap.example.org" \
--detach osixia/phpldapadmin:0.8.0
--detach osixia/phpldapadmin:0.9.0

#### Link environment file

For example if your environment file is in : /data/environment/my-env.yaml

docker run --volume /data/environment/my-env.yaml:/container/environment/01-custom/env.yaml \
--detach osixia/phpldapadmin:0.8.0
--detach osixia/phpldapadmin:0.9.0

Take care to link your environment file to `/container/environment/XX-somedir` (with XX < 99 so they will be processed before default environment files) and not directly to `/container/environment` because this directory contains predefined baseimage environment files to fix container environment (INITRD, LANG, LANGUAGE and LC_CTYPE).

Expand All @@ -232,13 +232,13 @@ This is the best solution if you have a private registry. Please refer to the [A

## Advanced User Guide

### Extend osixia/phpldapadmin:0.8.0 image
### Extend osixia/phpldapadmin:0.9.0 image

If you need to add your custom TLS certificate, bootstrap config or environment files the easiest way is to extends this image.

Dockerfile example:

FROM osixia/phpldapadmin:0.8.0
FROM osixia/phpldapadmin:0.9.0
MAINTAINER Your Name <[email protected]>

ADD https-certs /container/service/phpldapadmin/assets/apache2/certs
Expand All @@ -260,7 +260,7 @@ Clone this project :
Adapt Makefile, set your image NAME and VERSION, for example :

NAME = osixia/phpldapadmin
VERSION = 0.7.0
VERSION = 0.9.0

becomes :
NAME = billy-the-king/phpldapadmin
Expand Down
2 changes: 1 addition & 1 deletion example/kubernetes/phpldapadmin-rc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: phpldapadmin
image: osixia/phpldapadmin:0.8.0
image: osixia/phpldapadmin:0.9.0
volumeMounts:
- name: phpldapadmin-certs
mountPath: /container/service/phpldapadmin/assets/apache2/certs
Expand Down
16 changes: 8 additions & 8 deletions image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
FROM osixia/web-baseimage:1.1.2
FROM osixia/web-baseimage:release-1.2.0-dev

# phpLDAPadmin version
ARG PHPLDAPADMIN_VERSION=1.2.4
ARG PHPLDAPADMIN_VERSION=1.2.5

# Add multiple process stack to supervise apache2 and php7.0-fpm
# Add multiple process stack to supervise apache2 and php7.3-fpm
# sources: https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/add-multiple-process-stack
# https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/add-service-available
#  https://github.com/osixia/docker-web-baseimage/blob/stable/image/service-available/:apache2/download.sh
# https://github.com/osixia/docker-web-baseimage/blob/stable/image/service-available/:php7.0-fpm/download.sh
# https://github.com/osixia/docker-web-baseimage/blob/stable/image/service-available/:php7.3-fpm/download.sh
# https://github.com/osixia/light-baseimage/blob/stable/image/service-available/:ssl-tools/download.sh
# Install ca-certificates, curl and php dependencies
# Download phpLDAPadmin, check file integrity, and unzip phpLDAPadmin to /var/www/phpldapadmin_bootstrap
# Remove curl
RUN apt-get update \
&& /container/tool/add-multiple-process-stack \
&& /container/tool/add-service-available :apache2 :php7.0-fpm :ssl-tools \
&& /container/tool/add-service-available :apache2 :php7.3-fpm :ssl-tools \
&& LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
curl \
php7.0-ldap \
php7.0-readline \
php7.0-xml \
php7.3-ldap \
php7.3-readline \
php7.3-xml \
&& curl -o phpldapadmin.tar.gz -SL https://github.com/leenooks/phpLDAPadmin/archive/${PHPLDAPADMIN_VERSION}.tar.gz \
&& mkdir -p /var/www/phpldapadmin_bootstrap /var/www/phpldapadmin \
&& tar -xzf phpldapadmin.tar.gz --strip 1 -C /var/www/phpldapadmin_bootstrap \
Expand Down
2 changes: 1 addition & 1 deletion image/environment/default.startup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ PHPLDAPADMIN_LDAP_CLIENT_TLS_KEY_FILENAME: ldap-client.key
# ssl-helper environment variables prefix
LDAP_CLIENT_SSL_HELPER_PREFIX: ldap # ssl-helper first search config from LDAP_SSL_HELPER_* variables, before SSL_HELPER_* variables.

SSL_HELPER_AUTO_RENEW_SERVICES_IMPACTED: :apache2 :php7.0-fpm
SSL_HELPER_AUTO_RENEW_SERVICES_IMPACTED: :apache2 :php7.3-fpm
8 changes: 4 additions & 4 deletions image/service/phpldapadmin/install.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash -e
# this script is run during the image build

cat /container/service/phpldapadmin/assets/php7.0-fpm/pool.conf >> /etc/php/7.0/fpm/pool.d/www.conf
rm /container/service/phpldapadmin/assets/php7.0-fpm/pool.conf
cat /container/service/phpldapadmin/assets/php7.3-fpm/pool.conf >> /etc/php/7.3/fpm/pool.d/www.conf
rm /container/service/phpldapadmin/assets/php7.3-fpm/pool.conf

cp -f /container/service/phpldapadmin/assets/php7.0-fpm/opcache.ini /etc/php/7.0/fpm/conf.d/opcache.ini
rm /container/service/phpldapadmin/assets/php7.0-fpm/opcache.ini
cp -f /container/service/phpldapadmin/assets/php7.3-fpm/opcache.ini /etc/php/7.3/fpm/conf.d/opcache.ini
rm /container/service/phpldapadmin/assets/php7.3-fpm/opcache.ini

mkdir -p /var/www/tmp
chown www-data:www-data /var/www/tmp
Expand Down
13 changes: 10 additions & 3 deletions test/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ load test_helper
tmp_file="$BATS_TMPDIR/docker-test"

run_image
wait_process apache2 php-fpm7.0
wait_process apache2 php-fpm7.3

sleep 5

curl --silent --insecure https://$CONTAINER_IP >> $tmp_file
run grep -c "Use the menu to the left to navigate" $tmp_file
rm $tmp_file
Expand All @@ -29,7 +32,7 @@ load test_helper
tmp_file="$BATS_TMPDIR/docker-test"

# we start a new openldap container
LDAP_CID=$(docker run -d osixia/openldap:1.1.9)
LDAP_CID=$(docker run -d osixia/openldap)
LDAP_IP=$(get_container_ip_by_cid $LDAP_CID)

# we start the wordpress container and set DB_HOSTS
Expand All @@ -38,8 +41,12 @@ load test_helper
# wait openldap
wait_process_by_cid $LDAP_CID slapd

sleep 5

# wait phpLDAPadmin container apache2 service
wait_process apache2 php-fpm7.0
wait_process apache2 php-fpm7.3

sleep 5

curl -L --silent --insecure -c $BATS_TMPDIR/cookie.txt https://$CONTAINER_IP >> $tmp_file

Expand Down

0 comments on commit 6d1b92e

Please sign in to comment.