mirror of
https://github.com/phpmyadmin/docker.git
synced 2026-08-24 10:13:22 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17003ccf85 | ||
|
|
7a1cbfd6a3 | ||
|
|
25dde22ee9 | ||
|
|
f0ebd7aec5 | ||
|
|
98aa7b80c8 | ||
|
|
2d6fd72542 | ||
|
|
c706c520ef | ||
|
|
8269a39bfa | ||
|
|
c625c70fde | ||
|
|
2608fbd118 | ||
|
|
df45b3f76c | ||
|
|
edf7b2a375 | ||
|
|
b369d770dd | ||
|
|
e831e55d59 | ||
|
|
7a5f742d7d | ||
|
|
316a237509 | ||
|
|
44a266c45d | ||
|
|
2fe5947116 | ||
|
|
92a5a76a26 | ||
|
|
5dd9a0f015 | ||
|
|
f18aca104e | ||
|
|
d42e7c8a7d | ||
|
|
ca768f47fc | ||
|
|
c6aee5664c | ||
|
|
93e2be73ec | ||
|
|
85198de04f | ||
|
|
b024df6c3c | ||
|
|
ffedad4cdf | ||
|
|
c5d83d0fba | ||
|
|
d5f2f27d37 | ||
|
|
d53771b561 | ||
|
|
3bd49fb1ef | ||
|
|
d9236dfdad | ||
|
|
5e02108932 | ||
|
|
3a01bacb26 | ||
|
|
c09ec0fda8 | ||
|
|
621e3ad755 | ||
|
|
c03fa82b56 | ||
|
|
f5644c53c8 | ||
|
|
45873ade6a | ||
|
|
7aa164f6e1 | ||
|
|
c086bcea60 | ||
|
|
885eb78b98 | ||
|
|
686bf94364 | ||
|
|
ade6f52350 | ||
|
|
c29aadee1b | ||
|
|
30857caf5c | ||
|
|
2c92dfa55c | ||
|
|
a576282372 | ||
|
|
c4abbbaa35 | ||
|
|
15e82b23d2 | ||
|
|
ff2edd1f87 | ||
|
|
275b59e3dd | ||
|
|
a18b6e3842 | ||
|
|
524e669ce9 | ||
|
|
8884f19c18 | ||
|
|
1cfae7dbf6 | ||
|
|
24fd978c91 | ||
|
|
77d49d4d88 | ||
|
|
76631a48de | ||
|
|
6f28900cf9 | ||
|
|
3febe28134 | ||
|
|
1bcaeb5fec | ||
|
|
1204bcd696 | ||
|
|
447c731aaa | ||
|
|
69a0e832d9 | ||
|
|
0fb67d3437 | ||
|
|
331c3452f4 | ||
|
|
942a0dd5ff | ||
|
|
c76721ba8b | ||
|
|
554e98df45 | ||
|
|
5646cff98e | ||
|
|
382f9b9489 | ||
|
|
70b6297233 | ||
|
|
6314b17ebd | ||
|
|
63fd59434e | ||
|
|
a2782dd8f6 | ||
|
|
61bc237761 | ||
|
|
6736b49f7a | ||
|
|
b5305971ba | ||
|
|
2ebc458766 | ||
|
|
21b0804166 | ||
|
|
b35554203c | ||
|
|
e5a78047b2 | ||
|
|
a7aa88b4c6 | ||
|
|
b45585ea00 | ||
|
|
5d3536c381 | ||
|
|
24679b0c0b | ||
|
|
f5c3a1b628 | ||
|
|
d79872987d | ||
|
|
ed5d9c5fc9 | ||
|
|
446ed9e0d0 | ||
|
|
4ddc41bc29 | ||
|
|
ec28d93349 | ||
|
|
0ac5c9516c | ||
|
|
a1270dc0d5 | ||
|
|
73ea59e04b | ||
|
|
54a5953b37 | ||
|
|
d07907e15d | ||
|
|
e2f38b46ab | ||
|
|
cbcd23494f | ||
|
|
4432177a0a | ||
|
|
e2052a2066 | ||
|
|
6e3955516f | ||
|
|
29d69f34ad | ||
|
|
ddfe8e2b1c | ||
|
|
facd453fc2 |
+1
-4
@@ -4,7 +4,4 @@ docker-compose.testing.yml
|
||||
README.md
|
||||
LICENSE
|
||||
Makefile
|
||||
world.sql
|
||||
test-docker.sh
|
||||
phpmyadmin_test.py
|
||||
config.test.inc.php
|
||||
testing
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||
daysUntilStale: 60
|
||||
# Number of days of inactivity before a stale Issue or Pull Request is closed
|
||||
daysUntilClose: 7
|
||||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
# Label to use when marking as stale
|
||||
staleLabel: wontfix
|
||||
# Comment to post when marking as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when removing the stale label. Set to `false` to disable
|
||||
unmarkComment: false
|
||||
# Comment to post when closing a stale Issue or Pull Request. Set to `false` to disable
|
||||
closeComment: false
|
||||
# Limit to only `issues` or `pulls`
|
||||
only: pulls
|
||||
+22
-8
@@ -1,31 +1,45 @@
|
||||
dist: trusty
|
||||
|
||||
sudo: required
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- DB=mysql:latest
|
||||
- DB=mariadb:latest
|
||||
- DB=mariadb:10.2
|
||||
|
||||
before_install:
|
||||
- docker run --name db_server -e MYSQL_ROOT_PASSWORD=my-secret-pw -d $DB
|
||||
- export TESTSUITE_PASSWORD=`openssl rand -base64 30`
|
||||
- docker run --name db_server -e MYSQL_ROOT_PASSWORD=$TESTSUITE_PASSWORD -v $PWD/testing/testing.cnf:/etc/mysql/conf.d/testing.cnf:ro -d $DB
|
||||
|
||||
install:
|
||||
- pip install mechanize
|
||||
- pip install mechanize html5lib
|
||||
|
||||
script:
|
||||
# Build image
|
||||
- docker build -t phpmyadmin/phpmyadmin .
|
||||
# Test for single database
|
||||
- docker run --name testadmin -d --link db_server:db -p 9090:80 phpmyadmin/phpmyadmin
|
||||
- ./test-docker.sh testadmin 9090
|
||||
- ./testing/test-docker.sh testadmin 9090
|
||||
# Test for single database using env
|
||||
- docker run --name envadmin -d --link db_server:db2 -e PMA_HOST=db2 -p 6060:80 phpmyadmin/phpmyadmin
|
||||
- ./test-docker.sh envadmin 6060
|
||||
- ./testing/test-docker.sh envadmin 6060
|
||||
# Test for arbitrary database
|
||||
- docker run --name arbitraryadmin -d --link db_server:db3 -e PMA_ARBITRARY=1 -p 7070:80 phpmyadmin/phpmyadmin
|
||||
- ./test-docker.sh arbitraryadmin 7070 db3
|
||||
- ./testing/test-docker.sh arbitraryadmin 7070 db3
|
||||
# Test for arbitrary database with user config
|
||||
- docker run --name userconfigadmin -d --link db_server:db3 -v `readlink -f ./config.test.inc.php`:/etc/phpmyadmin/config.user.inc.php -p 7080:80 phpmyadmin/phpmyadmin
|
||||
- ./test-docker.sh userconfigadmin 7080 db3
|
||||
- docker run --name userconfigadmin -d --link db_server:db3 -v `readlink -f ./testing/config.test.inc.php`:/etc/phpmyadmin/config.user.inc.php -p 7080:80 phpmyadmin/phpmyadmin
|
||||
- ./testing/test-docker.sh userconfigadmin 7080 db3
|
||||
# Test docker-compose
|
||||
- docker-compose -f docker-compose.yml -f docker-compose.db.yml up -d
|
||||
- ./testing/test-docker.sh phpmyadmin 8080 db_server
|
||||
- docker-compose stop
|
||||
# Run tests in testing container
|
||||
- docker-compose -f docker-compose.testing.yml up -d phpmyadmin
|
||||
- ./testing/wait-for-testing.sh
|
||||
|
||||
+65
-39
@@ -1,52 +1,78 @@
|
||||
FROM alpine:3.5
|
||||
FROM php:7.2-fpm-alpine
|
||||
|
||||
RUN apk add --no-cache \
|
||||
nginx \
|
||||
supervisor
|
||||
|
||||
# Install dependencies
|
||||
RUN apk add --no-cache php7-session php7-mysqli php7-mbstring php7-xml php7-gd php7-zlib php7-bz2 php7-zip php7-openssl php7-curl php7-opcache php7-json nginx php7-fpm supervisor
|
||||
|
||||
# Include keyring to verify download
|
||||
COPY phpmyadmin.keyring /
|
||||
|
||||
# Copy configuration
|
||||
COPY etc /etc/
|
||||
|
||||
# Copy main script
|
||||
COPY run.sh /run.sh
|
||||
RUN chmod u+rwx /run.sh
|
||||
RUN set -ex; \
|
||||
\
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
bzip2-dev \
|
||||
freetype-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libwebp-dev \
|
||||
libxpm-dev \
|
||||
; \
|
||||
\
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-webp-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr; \
|
||||
docker-php-ext-install bz2 gd mysqli opcache zip; \
|
||||
\
|
||||
runDeps="$( \
|
||||
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
|
||||
| tr ',' '\n' \
|
||||
| sort -u \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)"; \
|
||||
apk add --virtual .phpmyadmin-phpexts-rundeps $runDeps; \
|
||||
apk del .build-deps
|
||||
|
||||
# Calculate download URL
|
||||
ENV VERSION 4.6.6
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.gz
|
||||
ENV VERSION 4.8.3
|
||||
ENV URL https://files.phpmyadmin.net/phpMyAdmin/${VERSION}/phpMyAdmin-${VERSION}-all-languages.tar.xz
|
||||
LABEL version=$VERSION
|
||||
|
||||
# Download tarball, verify it using gpg and extract
|
||||
RUN set -x \
|
||||
&& GNUPGHOME="$(mktemp -d)" \
|
||||
&& export GNUPGHOME \
|
||||
&& apk add --no-cache curl gnupg \
|
||||
&& curl --output phpMyAdmin.tar.gz --location $URL \
|
||||
&& curl --output phpMyAdmin.tar.gz.asc --location $URL.asc \
|
||||
&& gpgv --keyring /phpmyadmin.keyring phpMyAdmin.tar.gz.asc phpMyAdmin.tar.gz \
|
||||
&& apk del --no-cache curl gnupg \
|
||||
&& rm -rf "$GNUPGHOME" \
|
||||
&& tar xzf phpMyAdmin.tar.gz \
|
||||
&& rm -f phpMyAdmin.tar.gz phpMyAdmin.tar.gz.asc \
|
||||
&& mv phpMyAdmin-$VERSION-all-languages /www \
|
||||
&& mv /www/doc/html /www/htmldoc \
|
||||
&& rm -rf /www/doc \
|
||||
&& mkdir /www/doc \
|
||||
&& mv /www/htmldoc /www/doc/html \
|
||||
&& rm /www/doc/html/.buildinfo /www/doc/html/objects.inv \
|
||||
&& rm -rf /www/js/jquery/src/ /www/js/openlayers/src/ /www/setup/ /www/examples/ /www/test/ /www/po/ /www/templates/test/ /www/phpunit.xml.* /www/build.xml /www/composer.json /www/RELEASE-DATE-$VERSION \
|
||||
&& sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /www/libraries/vendor_config.php \
|
||||
&& chown -R root:nobody /www \
|
||||
&& find /www -type d -exec chmod 750 {} \; \
|
||||
&& find /www -type f -exec chmod 640 {} \;
|
||||
RUN set -ex; \
|
||||
apk add --no-cache --virtual .fetch-deps \
|
||||
gnupg \
|
||||
; \
|
||||
\
|
||||
export GNUPGHOME="$(mktemp -d)"; \
|
||||
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
|
||||
curl --output phpMyAdmin.tar.xz --location $URL; \
|
||||
curl --output phpMyAdmin.tar.xz.asc --location $URL.asc; \
|
||||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --keyserver ipv4.pool.sks-keyservers.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --keyserver keys.gnupg.net --recv-keys "$GPGKEY" \
|
||||
|| gpg --keyserver pgp.mit.edu --recv-keys "$GPGKEY" \
|
||||
|| gpg --keyserver keyserver.pgp.com --recv-keys "$GPGKEY"; \
|
||||
gpg --batch --verify phpMyAdmin.tar.xz.asc phpMyAdmin.tar.xz; \
|
||||
tar -xf phpMyAdmin.tar.xz; \
|
||||
gpgconf --kill all; \
|
||||
rm -r "$GNUPGHOME" phpMyAdmin.tar.xz phpMyAdmin.tar.xz.asc; \
|
||||
mv phpMyAdmin-$VERSION-all-languages /www; \
|
||||
rm -rf /www/setup/ /www/examples/ /www/test/ /www/po/ /www/composer.json /www/RELEASE-DATE-$VERSION; \
|
||||
sed -i "s@define('CONFIG_DIR'.*@define('CONFIG_DIR', '/etc/phpmyadmin/');@" /www/libraries/vendor_config.php; \
|
||||
chown -R nobody:nogroup /www; \
|
||||
find /www -type d -exec chmod 750 {} \; ; \
|
||||
find /www -type f -exec chmod 640 {} \; ; \
|
||||
# Add directory for sessions to allow session persistence
|
||||
mkdir /sessions; \
|
||||
mkdir -p /www/tmp; \
|
||||
chmod -R 777 /www/tmp; \
|
||||
apk del .fetch-deps
|
||||
|
||||
# Add volume for sessions to allow session persistence
|
||||
VOLUME /sessions
|
||||
# Copy configuration
|
||||
COPY etc /etc/
|
||||
COPY php.ini /usr/local/etc/php/conf.d/php-phpmyadmin.ini
|
||||
|
||||
# Copy main script
|
||||
COPY run.sh /run.sh
|
||||
|
||||
# We expose phpMyAdmin on port 80
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT [ "/run.sh" ]
|
||||
CMD ["phpmyadmin"]
|
||||
CMD ["supervisord", "-n"]
|
||||
|
||||
@@ -28,7 +28,10 @@ You can use following tags on Docker hub:
|
||||
|
||||
* `latest` - latest stable release
|
||||
* `4.6` - latest stable release from the 4.6 branch
|
||||
* `4.7` - latest stable release from the 4.7 branch
|
||||
* `edge` - bleeding edge docker image (contains stable phpMyAdmin, but the Docker image changes might not yet be fully tested)
|
||||
* `edge-4.7` - bleeding edge docker image + latest snapshots from 4.7 branch
|
||||
* `edge-4.8` - bleeding edge docker image + latest snapshots from 4.8 branch (currently master)
|
||||
|
||||
## Usage with linked server
|
||||
|
||||
@@ -53,7 +56,7 @@ docker run --name myadmin -d -e PMA_HOST=dbhost -p 8080:80 phpmyadmin/phpmyadmin
|
||||
You can use arbitrary servers by adding ENV variable `PMA_ARBITRARY=1` to the startup command:
|
||||
|
||||
```
|
||||
docker run --name myadmin -d --link mysql_db_server:db -p 8080:80 -e PMA_ARBITRARY=1 phpmyadmin/phpmyadmin
|
||||
docker run --name myadmin -d -e PMA_ARBITRARY=1 -p 8080:80 phpmyadmin/phpmyadmin
|
||||
```
|
||||
|
||||
## Usage with docker-compose and arbitrary server
|
||||
@@ -67,6 +70,16 @@ Using the docker-compose.yml from https://github.com/phpmyadmin/docker
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Run the E2E tests with docker-compose
|
||||
|
||||
You can run the E2E tests with the local test environment by running MariaDB/MySQL databases. Adding ENV variable `PHPMYADMIN_RUN_TEST=true` already added on docker-compose file. Simply run:
|
||||
|
||||
Using the docker-compose.testing.yml from https://github.com/phpmyadmin/docker
|
||||
|
||||
```
|
||||
docker-compose -f docker-compose.testing.yml up phpmyadmin
|
||||
```
|
||||
|
||||
## Adding Custom Configuration
|
||||
|
||||
You can add your own custom config.inc.php settings (such as Configuration Storage setup)
|
||||
@@ -97,6 +110,7 @@ Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma
|
||||
* ``PMA_PORT`` - define port of the MySQL server
|
||||
* ``PMA_HOSTS`` - define comma separated list of address/host names of the MySQL servers
|
||||
* ``PMA_VERBOSES`` - define comma separated list of verbose names of the MySQL servers
|
||||
* ``PMA_PORTS`` - define comma separated list of ports of the MySQL servers
|
||||
* ``PMA_USER`` and ``PMA_PASSWORD`` - define username to use for config authentication method
|
||||
* ``PMA_ABSOLUTE_URI`` - define user-facing URI
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
phpmyadmin:
|
||||
external_links:
|
||||
- db_server:db
|
||||
@@ -1,8 +1,24 @@
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin:testing
|
||||
container_name: myadmin
|
||||
version: '2'
|
||||
|
||||
services:
|
||||
db_server:
|
||||
image: ${DB}
|
||||
container_name: phpmyadmin_testing_mariadb
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
restart: always
|
||||
- MYSQL_ROOT_PASSWORD=test123
|
||||
volumes:
|
||||
- ./testing/testing.cnf:/etc/mysql/conf.d/testing.cnf:ro
|
||||
|
||||
phpmyadmin:
|
||||
build:
|
||||
context: testing/
|
||||
container_name: phpmyadmin_testing
|
||||
volumes:
|
||||
- /sessions
|
||||
ports:
|
||||
- 8090:80
|
||||
- 8090:80
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
||||
- TESTSUITE_PASSWORD=test123
|
||||
depends_on:
|
||||
- db_server
|
||||
|
||||
+4
-2
@@ -1,4 +1,4 @@
|
||||
user nobody;
|
||||
user nobody nogroup;
|
||||
worker_processes 4;
|
||||
|
||||
daemon off;
|
||||
@@ -86,8 +86,10 @@ http {
|
||||
set $path_info $fastcgi_path_info;
|
||||
fastcgi_param PATH_INFO $path_info;
|
||||
|
||||
fastcgi_read_timeout 600;
|
||||
fastcgi_read_timeout 1200;
|
||||
fastcgi_buffering off;
|
||||
fastcgi_buffers 16 16k;
|
||||
fastcgi_buffer_size 32k;
|
||||
|
||||
fastcgi_index index.php;
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ log_level = warning
|
||||
|
||||
[www]
|
||||
user = nobody
|
||||
group = nobody
|
||||
group = nogroup
|
||||
listen = /var/run/php/php-fpm.sock
|
||||
listen.mode = 0660
|
||||
chdir = /www
|
||||
|
||||
-1953
File diff suppressed because it is too large
Load Diff
@@ -10,15 +10,26 @@ $vars = array(
|
||||
'PMA_VERBOSE',
|
||||
'PMA_VERBOSES',
|
||||
'PMA_PORT',
|
||||
'PMA_PORTS',
|
||||
'PMA_USER',
|
||||
'PMA_PASSWORD',
|
||||
'PMA_ABSOLUTE_URI'
|
||||
'PMA_ABSOLUTE_URI',
|
||||
'PMA_CONTROLHOST',
|
||||
'PMA_CONTROLPORT',
|
||||
'PMA_PMADB',
|
||||
'PMA_CONTROLUSER',
|
||||
'PMA_CONTROLPASS',
|
||||
'PMA_QUERYHISTORYDB'
|
||||
);
|
||||
foreach ($vars as $var) {
|
||||
if (!isset($_ENV[$var]) && getenv($var)) {
|
||||
$_ENV[$var] = getenv($var);
|
||||
$env = getenv($var);
|
||||
if (!isset($_ENV[$var]) && $env !== false) {
|
||||
$_ENV[$var] = $env;
|
||||
}
|
||||
}
|
||||
if (isset($_ENV['PMA_QUERYHISTORYDB'])) {
|
||||
$cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']);
|
||||
}
|
||||
|
||||
/* Arbitrary server connection */
|
||||
if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') {
|
||||
@@ -39,9 +50,11 @@ $hosts = array('db');
|
||||
if (!empty($_ENV['PMA_HOST'])) {
|
||||
$hosts = array($_ENV['PMA_HOST']);
|
||||
$verbose = array($_ENV['PMA_VERBOSE']);
|
||||
$ports = array($_ENV['PMA_PORT']);
|
||||
} elseif (!empty($_ENV['PMA_HOSTS'])) {
|
||||
$hosts = explode(',', $_ENV['PMA_HOSTS']);
|
||||
$verbose = explode(',', $_ENV['PMA_VERBOSES']);
|
||||
$ports = explode(',', $_ENV['PMA_PORTS']);
|
||||
}
|
||||
|
||||
/* Server settings */
|
||||
@@ -50,20 +63,58 @@ for ($i = 1; isset($hosts[$i - 1]); $i++) {
|
||||
if (isset($verbose[$i - 1])) {
|
||||
$cfg['Servers'][$i]['verbose'] = $verbose[$i - 1];
|
||||
}
|
||||
if (isset($_ENV['PMA_PORT'])) {
|
||||
$cfg['Servers'][$i]['port'] = $_ENV['PMA_PORT'];
|
||||
if (isset($ports[$i - 1])) {
|
||||
$cfg['Servers'][$i]['port'] = $ports[$i - 1];
|
||||
}
|
||||
if (isset($_ENV['PMA_USER'])) {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'config';
|
||||
$cfg['Servers'][$i]['user'] = $_ENV['PMA_USER'];
|
||||
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : null;
|
||||
$cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : '';
|
||||
} else {
|
||||
$cfg['Servers'][$i]['auth_type'] = 'cookie';
|
||||
}
|
||||
$cfg['Servers'][$i]['connect_type'] = 'tcp';
|
||||
if (isset($_ENV['PMA_PMADB'])) {
|
||||
$cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB'];
|
||||
$cfg['Servers'][$i]['relation'] = 'pma__relation';
|
||||
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
|
||||
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
|
||||
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
|
||||
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
|
||||
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
|
||||
$cfg['Servers'][$i]['history'] = 'pma__history';
|
||||
$cfg['Servers'][$i]['recent'] = 'pma__recent';
|
||||
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
|
||||
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
|
||||
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
|
||||
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
|
||||
$cfg['Servers'][$i]['users'] = 'pma__users';
|
||||
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
|
||||
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
|
||||
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
|
||||
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
|
||||
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
|
||||
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLHOST'])) {
|
||||
$cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLPORT'])) {
|
||||
$cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLUSER'])) {
|
||||
$cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER'];
|
||||
}
|
||||
if (isset($_ENV['PMA_CONTROLPASS'])) {
|
||||
$cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS'];
|
||||
}
|
||||
$cfg['Servers'][$i]['compress'] = false;
|
||||
$cfg['Servers'][$i]['AllowNoPassword'] = true;
|
||||
}
|
||||
/*
|
||||
* Revert back to last configured server to make
|
||||
* it easier in config.user.inc.php
|
||||
*/
|
||||
$i--;
|
||||
|
||||
/* Uploads setup */
|
||||
$cfg['UploadDir'] = '';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[program:php-fpm]
|
||||
command=php-fpm7 --nodaemonize --fpm-config /etc/php-fpm.conf -c /etc/php.ini
|
||||
command=php-fpm --nodaemonize --fpm-config /etc/php-fpm.conf
|
||||
user=nobody
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
[PHP]
|
||||
allow_url_fopen = Off
|
||||
max_execution_time = 600
|
||||
memory_limit = 512M
|
||||
open_basedir = /www/:/tmp/:/etc/phpmyadmin/
|
||||
post_max_size = 512M
|
||||
upload_max_filesize = 512M
|
||||
|
||||
[Session]
|
||||
session.cookie_httponly = 1
|
||||
session.hash_function = 1
|
||||
session.save_path = "/sessions"
|
||||
session.use_strict_mode = 1
|
||||
|
||||
[opcache]
|
||||
opcache.fast_shutdown = 1
|
||||
opcache.restrict_api = /disabled/
|
||||
opcache.save_comments = 0
|
||||
opcache.use_cwd = 0
|
||||
opcache.validate_timestamps = 0
|
||||
Binary file not shown.
@@ -1,22 +1,20 @@
|
||||
#!/bin/sh
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ] ; then
|
||||
if [ ! -f /etc/phpmyadmin/config.secret.inc.php ]; then
|
||||
cat > /etc/phpmyadmin/config.secret.inc.php <<EOT
|
||||
<?php
|
||||
\$cfg['blowfish_secret'] = '$(tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1)';
|
||||
EOT
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/phpmyadmin/config.user.inc.php ] ; then
|
||||
touch /etc/phpmyadmin/config.user.inc.php
|
||||
if [ ! -f /etc/phpmyadmin/config.user.inc.php ]; then
|
||||
touch /etc/phpmyadmin/config.user.inc.php
|
||||
fi
|
||||
|
||||
mkdir -p /var/nginx/client_body_temp
|
||||
chown nobody:nobody /sessions /var/nginx/client_body_temp
|
||||
chown nobody:nogroup /sessions /var/nginx/client_body_temp
|
||||
mkdir -p /var/run/php/
|
||||
chown nobody:nobody /var/run/php/
|
||||
chown nobody:nogroup /var/run/php/
|
||||
touch /var/log/php-fpm.log
|
||||
chown nobody:nobody /var/log/php-fpm.log
|
||||
chown nobody:nogroup /var/log/php-fpm.log
|
||||
|
||||
if [ "$1" = 'phpmyadmin' ]; then
|
||||
exec supervisord --nodaemon --configuration="/etc/supervisord.conf" --loglevel=info
|
||||
fi
|
||||
exec "$@"
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
|
||||
NAME="$1"
|
||||
PORT="$2"
|
||||
if [ -n "$3" ] ; then
|
||||
SERVER="--server $3"
|
||||
else
|
||||
SERVER=''
|
||||
fi
|
||||
|
||||
URL=http://127.0.0.1:$PORT/
|
||||
|
||||
# Wait for container to start
|
||||
ret=0
|
||||
TIMEOUT=0
|
||||
while ! docker exec "$NAME" ps aux | grep -q nginx ; do
|
||||
echo 'Waiting for start...'
|
||||
sleep 1
|
||||
TIMEOUT=$((TIMEOUT + 1))
|
||||
if [ $TIMEOUT -gt 10 ] ; then
|
||||
echo "Failed to wait!"
|
||||
ret=1
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Perform tests
|
||||
if [ $ret -eq 0 ] ; then
|
||||
python phpmyadmin_test.py --url "$URL" --username root --password my-secret-pw $SERVER
|
||||
ret=$?
|
||||
fi
|
||||
|
||||
# Show debug output in case of failure
|
||||
if [ $ret -ne 0 ] ; then
|
||||
curl "$URL"
|
||||
docker ps -a
|
||||
docker exec "$NAME" ps faux
|
||||
docker exec "$NAME" cat /var/log/php-fpm.log
|
||||
docker exec "$NAME" cat /var/log/nginx-error.log
|
||||
docker exec "$NAME" cat /var/log/supervisord.log
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
# List processes
|
||||
docker exec "$NAME" ps faux
|
||||
@@ -0,0 +1,10 @@
|
||||
# Testing image for phpMyAdmin
|
||||
|
||||
FROM phpmyadmin/phpmyadmin
|
||||
|
||||
# Install test dependencies
|
||||
RUN apk add --no-cache curl py2-pip
|
||||
RUN pip install mechanize html5lib
|
||||
|
||||
COPY test.ini /etc/supervisor.d/
|
||||
COPY phpmyadmin_test.py test-docker.sh world.sql /
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
@@ -8,11 +9,18 @@ import mechanize
|
||||
|
||||
def test_content(match, content):
|
||||
if not match in content:
|
||||
print content
|
||||
print(content)
|
||||
raise Exception('{0} not found in content!'.format(match))
|
||||
|
||||
|
||||
def test_phpmyadmin(url, username, password, server=None, sqlfile='world.sql'):
|
||||
def test_phpmyadmin(url, username, password, server=None, sqlfile=None):
|
||||
if sqlfile is None:
|
||||
if os.path.exists('/world.sql'):
|
||||
sqlfile = '/world.sql'
|
||||
elif os.path.exists('./world.sql'):
|
||||
sqlfile = './world.sql'
|
||||
else:
|
||||
sqlfile = './testing/world.sql'
|
||||
br = mechanize.Browser()
|
||||
|
||||
# Ignore robots.txt
|
||||
@@ -49,10 +57,16 @@ def main():
|
||||
parser.add_argument('--username', required=True)
|
||||
parser.add_argument('--password', required=True)
|
||||
parser.add_argument('--server')
|
||||
parser.add_argument('--sqlfile', default='world.sql')
|
||||
parser.add_argument('--sqlfile', default=None)
|
||||
args = parser.parse_args()
|
||||
|
||||
test_phpmyadmin(args.url, args.username, args.password, args.server, args.sqlfile)
|
||||
test_phpmyadmin(
|
||||
args.url,
|
||||
args.username,
|
||||
args.password,
|
||||
args.server,
|
||||
args.sqlfile
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
Executable
+94
@@ -0,0 +1,94 @@
|
||||
#!/bin/sh
|
||||
|
||||
NAME="$1"
|
||||
|
||||
if [ -n "$2" ] ; then
|
||||
PORT="$2"
|
||||
TESTSUITE_PORT=$2
|
||||
fi
|
||||
|
||||
if [ -n "$3" ] ; then
|
||||
SERVER="--server $3"
|
||||
PMA_HOST=$3
|
||||
else
|
||||
SERVER=''
|
||||
fi
|
||||
|
||||
# Set PHPMyAdmin environment
|
||||
PHPMYADMIN_HOSTNAME=${TESTSUITE_HOSTNAME:=localhost}
|
||||
PHPMYADMIN_PORT=${TESTSUITE_PORT:=80}
|
||||
PHPMYADMIN_URL=http://$PHPMYADMIN_HOSTNAME:$PORT/
|
||||
|
||||
# Color text output
|
||||
GREEN="\033[0;32m"
|
||||
RED="\033[0;31m"
|
||||
NC="\033[0m" # No Color
|
||||
|
||||
ret=0
|
||||
# Check if script is running inside container
|
||||
if [ -f /.dockerenv ] ; then
|
||||
echo "Tests running inside container..."
|
||||
|
||||
# Set database environment
|
||||
PHPMYADMIN_DB_HOSTNAME=${PMA_HOST:=localhost}
|
||||
PHPMYADMIN_DB_PORT=${PMA_PORT:=3306}
|
||||
PHPMYADMIN_DB_URL=http://$PHPMYADMIN_DB_HOSTNAME:$PHPMYADMIN_DB_PORT/
|
||||
|
||||
# Wait for database to start
|
||||
TIMEOUT=0
|
||||
while ! curl "$PHPMYADMIN_DB_URL" &>/dev/null; do
|
||||
echo "Waiting for ${PHPMYADMIN_DB_HOSTNAME} database start..."
|
||||
sleep 10
|
||||
TIMEOUT=$((TIMEOUT + 1))
|
||||
if [ $TIMEOUT -gt 3 ] ; then
|
||||
echo "Failed to connect ${PHPMYADMIN_DB_HOSTNAME} database!"
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
|
||||
ret=1
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Tests running outside container..."
|
||||
docker ps -a
|
||||
COMMAND_HOST="docker exec ${NAME}"
|
||||
fi
|
||||
|
||||
# Wait for container to start
|
||||
TIMEOUT=0
|
||||
while ! $COMMAND_HOST ps aux | grep -q nginx ; do
|
||||
echo "Waiting for PHPMyAdmin start..."
|
||||
sleep 1
|
||||
TIMEOUT=$((TIMEOUT + 1))
|
||||
if [ $TIMEOUT -gt 10 ] ; then
|
||||
echo "Failed to connect PHPMyAdmin!"
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
|
||||
ret=1
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Perform tests
|
||||
if [ $ret -eq 0 ] ; then
|
||||
if [ -f /phpmyadmin_test.py ] ; then
|
||||
FILENAME=/phpmyadmin_test.py
|
||||
elif [ -f ./phpmyadmin_test.py ] ; then
|
||||
FILENAME=./phpmyadmin_test.py
|
||||
else
|
||||
FILENAME=./testing/phpmyadmin_test.py
|
||||
fi
|
||||
python $FILENAME --url "$PHPMYADMIN_URL" --username root --password $TESTSUITE_PASSWORD $SERVER
|
||||
ret=$?
|
||||
fi
|
||||
|
||||
# Show debug output in case of failure
|
||||
if [ $ret -ne 0 ] ; then
|
||||
curl "$PHPMYADMIN_URL"
|
||||
$COMMAND_HOST ps faux
|
||||
$COMMAND_HOST cat /var/log/php-fpm.log
|
||||
$COMMAND_HOST cat /var/log/nginx-error.log
|
||||
$COMMAND_HOST cat /var/log/supervisord.log
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${RED}FAILED${NC}"
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
echo "Result of ${PHPMYADMIN_DB_HOSTNAME} tests: ${GREEN}SUCCESS${NC}"
|
||||
@@ -0,0 +1,11 @@
|
||||
[program:test-mariadb]
|
||||
command=/test-docker.sh test 80 mariadb
|
||||
autostart=true
|
||||
autorestart=false
|
||||
priority=3
|
||||
startretries=1
|
||||
stopwaitsecs=20
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
@@ -0,0 +1,11 @@
|
||||
[program:test-mysql]
|
||||
command=/test-docker.sh test 80 db_server
|
||||
autostart=true
|
||||
autorestart=false
|
||||
priority=3
|
||||
startretries=1
|
||||
stopwaitsecs=20
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
@@ -0,0 +1,2 @@
|
||||
[mysqld]
|
||||
default_authentication_plugin = mysql_native_password
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Helper script to wait for testing inside container completes
|
||||
# Needs running docker-compose container based on docker-compose.testing.yml
|
||||
|
||||
GREEN="\033[0;32m"
|
||||
RED="\033[0;31m"
|
||||
NC="\033[0m" # No Color
|
||||
|
||||
TIMEOUT=0
|
||||
|
||||
sleep 5
|
||||
|
||||
while [ `docker-compose -f docker-compose.testing.yml logs phpmyadmin | grep -c 'Result of db_server tests'` -lt 1 ] ; do
|
||||
sleep 1
|
||||
TIMEOUT=$(($TIMEOUT + 1))
|
||||
if [ $TIMEOUT -gt 20 ] ; then
|
||||
docker-compose -f docker-compose.testing.yml logs phpmyadmin
|
||||
echo "${RED}Timeout!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ `docker-compose -f docker-compose.testing.yml logs phpmyadmin | grep -c 'Result of db_server tests.*SUCCESS'` -lt 1 ] ; then
|
||||
docker-compose -f docker-compose.testing.yml logs phpmyadmin
|
||||
echo "${RED}Failed${NC}"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
docker-compose -f docker-compose.testing.yml logs phpmyadmin
|
||||
echo "${GREEN}Success${NC}"
|
||||
exit 0
|
||||
+748
-748
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user