DockerでTestLinkを動かす(samba-ad連携)
まったく需要はないと思うけれどもsamba-ad連携シリーズ、今回はTestLinkとかいうマニアックなツールです。よくSIerさんがEXCELで管理しているどうしようもないようなシステムテストの管理を効率化しようとするツールです。無料で一番いい感じのやつで今でも開発が続けられているということで、まぁ少し使い勝手を見てみようと思って、お手軽にDockerで試してみることにしました。
■過去のsamba-ad連携シリーズ(よろしければどうぞ)
https://ujimasayuruyuru.blogspot.com/2021/08/dockerad-samba2.html
https://ujimasayuruyuru.blogspot.com/2021/10/dockersamba-ad.html
https://ujimasayuruyuru.blogspot.com/2021/10/dockerwordpresssamba-ad.html
https://ujimasayuruyuru.blogspot.com/2021/09/dockeralfrescosamba-ad.html
スキルが低いので相変わらずほかのサイトのコピペつぎはぎで作り上げます。なんかLDAP連携できるらしいのでsamba-adと連携させてみることにします。
◆対象Version
Ubuntu20.04.3LTS Docker version 20.10.12, build e91ed57 docker-compose version 1.29.1, build c34c88b2
◆作業手順
1.事前準備
#IPアドレス追加 $ sudo vi /etc/netplan/00-installer-config.yaml ------------------------------------------------- # This is the network config written by 'subiquity' network: ethernets: eth0: addresses: - 192.168.0.40/24 - 192.168.0.41/24 - 192.168.0.42/24 - 192.168.0.43/24 gateway4: 192.168.0.1 nameservers: addresses: - 192.168.0.10 - 192.168.0.11 version: 2 ------------------------------------------------- $ sudo netplan apply #外部ボリューム使う場合はディレクトリ権限を変更しないと起動できない $ cd docker/ $ mkdir testlink $ mkdir mariadb_data $ sudo chown -R 1001:1001 mariadb_data $ mkdir testlink_data $ sudo chown -R 1001:1001 testlink_data
2.設定ファイル類
#APP_VERSION=testlink:latest APP_VERSION=testlink:1.9.19 APP_CONTAINER_NAME=testlink_app DB_USER=bn_testlink DB_PASSWORD=my_password DB_NAME=bitnami_testlink TESTLINK_USER=admin TESTLINK_PASSWORD=pass1234 EMAIL=youremail@yourdomain.com SMTP_HOST=yoursmtpserver SMTP_PORT=587 SMTP_USER=yourusername SMTP_PASSWORD=yourpassword HOST_TESTLINK=192.168.0.25 DB_VERSION=mariadb:10.3 DB_CONTAINER_NAME=testlink_db DB_ROOT_PASSWORD=master_root_password FORWARD_PORT=443 APP_PORT=443 #APP_PORT=8443 #for 1.9.20
version: '3.9' networks: testlink_net: name: testlink-networks services: # TestLink Apps testlink: image: 'bitnami/${APP_VERSION}' container_name: ${APP_CONTAINER_NAME} environment: - MARIADB_HOST=mariadb - MARIADB_PORT_NUMBER=3306 - TESTLINK_DATABASE_NAME=${DB_NAME} - TESTLINK_DATABASE_USER=${DB_USER} - TESTLINK_DATABASE_PASSWORD=${DB_PASSWORD} - TESTLINK_USERNAME=${TESTLINK_USER} - TESTLINK_PASSWORD=${TESTLINK_PASSWORD} - TESTLINK_LANGUAGE=ja_JP - SMTP_ENABLE=true - TESTLINK_EMAIL=${EMAIL} - SMTP_HOST=${SMTP_HOST} - SMTP_PORT=${SMTP_PORT} - SMTP_USER=${SMTP_USER} - SMTP_PASSWORD=${SMTP_PASSWORD} - SMTP_CONNECTION_MODE=tls ports: - ${HOST_TESTLINK}:${FORWARD_PORT}:${APP_PORT} volumes: - './testlink_data:/bitnami' networks: - testlink_net restart: always depends_on: - mariadb # MariaDB mariadb: image: 'bitnami/${DB_VERSION}' container_name: ${DB_CONTAINER_NAME} environment: - MARIADB_ROOT_PASSWORD=${DB_ROOT_PASSWORD} - MARIADB_DATABASE=${DB_NAME} - MARIADB_USER=${DB_USER} - MARIADB_PASSWORD=${DB_PASSWORD} volumes: - './mariadb_data:/bitnami' networks: - testlink_net restart: always
3.事後作業
## コンテナ内で作業 $ docker exec -u root -it testlink_app /bin/bash #php.iniのファイル編集(JSTの変更) root@XXXX:~# sed -i -e 's@UTC@"Asia/Tokyo"@g' /opt/bitnami/php/lib/php.ini #IPAフォントインストール root@XXXX:~# apt-get update root@XXXX:~# apt-get install -y fonts-ipafont fontconfig root@XXXX:~# fc-cache -fv root@XXXX:~# fc-list | grep -i ipa /usr/share/fonts/opentype/ipafont-mincho/ipam.ttf: IPAMincho,IPA明朝:style=Regular /usr/share/fonts/opentype/ipafont-gothic/ipagp.ttf: IPAPGothic,IPA Pゴシック:style=Regular /usr/share/fonts/opentype/ipafont-mincho/ipamp.ttf: IPAPMincho,IPA P明朝:style=Regular /usr/share/fonts/opentype/ipafont-gothic/ipag.ttf: IPAGothic,IPAゴシック:style=Regular /usr/share/fonts/truetype/fonts-japanese-mincho.ttf: IPAMincho,IPA明朝:style=Regular /usr/share/fonts/truetype/fonts-japanese-gothic.ttf: IPAGothic,IPAゴシック:style=Regular #インストールディレクトリ削除 root@XXXX:~# rm -Rf /opt/bitnami/testlink/install root@XXXX:~# exit ## Dockerホスト機で作業 #フォント設定 $ sudo vi testlink_data/testlink/custom_config.inc.php
------------------------------------------- $tlCfg->default_language = 'ja_JP'; //↓追記 $tlCfg->charts_font_path = "/usr/share/fonts/truetype/fonts-japanese-gothic.ttf"; ?> -------------------------------------------
#samba-ad連携 $ sudo vi testlink_data/testlink/config.inc.php
-------------------------------------------- ~略~ /** * LDAP authentication credentials, Multiple LDAP Servers can be used. * User will be authenticaded against each server (one after other using array index order) * till authentication succeed or all servers have been used. */ $tlCfg->authentication['ldap'] = array(); $tlCfg->authentication['ldap'][1]['ldap_server'] = '$AD Server IP'; //←書替 $tlCfg->authentication['ldap'][1]['ldap_port'] = '389'; $tlCfg->authentication['ldap'][1]['ldap_version'] = '3'; // could be '2' in some cases $tlCfg->authentication['ldap'][1]['ldap_root_dn'] = 'dc=yourdomain,dc=local'; //←書替 $tlCfg->authentication['ldap'][1]['ldap_bind_dn'] = 'administrator@yourdomain.local'; // ←書替 $tlCfg->authentication['ldap'][1]['ldap_bind_passwd'] = 'yourpassword'; // ←書替 $tlCfg->authentication['ldap'][1]['ldap_tls'] = false; // true -> use tls ~略~ // This can be used to manage situation like explained on post on forum: // ActiveDirectory + users in AD group // $tlCfg->authentication['ldap'][1]['ldap_organization'] = ''; // e.g. '(organizationname=*Traffic)' $tlCfg->authentication['ldap'][1]['ldap_uid_field'] = 'sAMAccountName'; // ←書替 // Configure following fields in custom_config.inc.php according your configuration $tlCfg->authentication['ldap'][1]['ldap_email_field'] = 'mail'; $tlCfg->authentication['ldap'][1]['ldap_firstname_field'] = 'givenname'; $tlCfg->authentication['ldap'][1]['ldap_surname_field'] = 'sn'; ~中略~ // name // surname $tlCfg->authentication['ldap_automatic_user_creation'] = true; //←書替 ~略~ ---------------------------
#Docker-compose再起動 $ docker-compose stop $ docker-compose start
◆参考サイト
・TestLink関連
https://qiita.com/shimizumasaru/items/6c7b3f55a2dd63d5252b
https://qiita.com/shimizumasaru/items/0fd6a271f123d77ee2ad
https://white-azalea.hatenablog.jp/entry/2018/07/15/220439
https://www.wenyanet.com/opensource/ja/60179c02d43ae3699d23f292.html
https://qiita.com/mima_ita/items/ed56fb1da1e340d397b9
https://qiita.com/shimizumasaru/items/a1de689866c3ee2a4de5
https://qiita.com/bakachou/items/0f4a4f875d7e452e5fb1
・TestLink ActiveDirectory連携
https://kuttsun.blogspot.com/2017/10/testlink-ldap.html
コメント