Skip to content

Commit

Permalink
Merge #399 - Add back a /sessions volume for sessions persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Jun 29, 2023
2 parents 948bf2d + bb70a46 commit d455a71
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased] - YYYY-MM-DD

- Add `TZ` env var to change PHP `date.timezone` (#133)
- Update to PHP 8.2
- Update to PHP 8.2 (#411)
- Add back a `/sessions` volume for sessions persistence (#399)

## [5.2.1] - 2023-02-08

Expand Down
5 changes: 5 additions & 0 deletions Dockerfile-alpine.template
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ ENV MAX_EXECUTION_TIME 600
ENV MEMORY_LIMIT 512M
ENV UPLOAD_LIMIT 2048K
ENV TZ UTC
ENV SESSION_SAVE_PATH /sessions
RUN set -ex; \
\
{ \
Expand All @@ -65,6 +66,7 @@ RUN set -ex; \
echo 'post_max_size=${UPLOAD_LIMIT}'; \
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
echo 'date.timezone=${TZ}'; \
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini

# Calculate download URL
Expand All @@ -87,6 +89,9 @@ RUN set -ex; \
apk add --no-cache --virtual .fetch-deps \
gnupg \
; \
mkdir $SESSION_SAVE_PATH; \
chmod 1777 $SESSION_SAVE_PATH; \
chown www-data:www-data $SESSION_SAVE_PATH; \
\
export GNUPGHOME="$(mktemp -d)"; \
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile-debian.template
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ENV MAX_EXECUTION_TIME 600
ENV MEMORY_LIMIT 512M
ENV UPLOAD_LIMIT 2048K
ENV TZ UTC
ENV SESSION_SAVE_PATH /sessions
RUN set -ex; \
\
{ \
Expand All @@ -67,6 +68,7 @@ RUN set -ex; \
echo 'post_max_size=${UPLOAD_LIMIT}'; \
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
echo 'date.timezone=${TZ}'; \
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini

# Calculate download URL
Expand Down Expand Up @@ -94,6 +96,9 @@ RUN set -ex; \
gnupg \
dirmngr \
; \
mkdir $SESSION_SAVE_PATH; \
chmod 1777 $SESSION_SAVE_PATH; \
chown www-data:www-data $SESSION_SAVE_PATH; \
\
export GNUPGHOME="$(mktemp -d)"; \
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ See the following links for config file information:

Set the variable ``PMA_ABSOLUTE_URI`` to the fully-qualified path (``https://pma.example.net/``) where the reverse proxy makes phpMyAdmin available.

## Sessions persistence

In order to keep your sessions active between container updates you will need to mount the `/sessions` folder.

```sh
-v /some/local/directory/sessions:/sessions:rw
```

## Environment variables summary

* ``PMA_ARBITRARY`` - when set to 1 connection to the arbitrary server will be allowed
Expand Down
5 changes: 5 additions & 0 deletions apache/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ENV MAX_EXECUTION_TIME 600
ENV MEMORY_LIMIT 512M
ENV UPLOAD_LIMIT 2048K
ENV TZ UTC
ENV SESSION_SAVE_PATH /sessions
RUN set -ex; \
\
{ \
Expand All @@ -67,6 +68,7 @@ RUN set -ex; \
echo 'post_max_size=${UPLOAD_LIMIT}'; \
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
echo 'date.timezone=${TZ}'; \
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini

# Calculate download URL
Expand Down Expand Up @@ -94,6 +96,9 @@ RUN set -ex; \
gnupg \
dirmngr \
; \
mkdir $SESSION_SAVE_PATH; \
chmod 1777 $SESSION_SAVE_PATH; \
chown www-data:www-data $SESSION_SAVE_PATH; \
\
export GNUPGHOME="$(mktemp -d)"; \
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
Expand Down
5 changes: 5 additions & 0 deletions fpm-alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ ENV MAX_EXECUTION_TIME 600
ENV MEMORY_LIMIT 512M
ENV UPLOAD_LIMIT 2048K
ENV TZ UTC
ENV SESSION_SAVE_PATH /sessions
RUN set -ex; \
\
{ \
Expand All @@ -65,6 +66,7 @@ RUN set -ex; \
echo 'post_max_size=${UPLOAD_LIMIT}'; \
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
echo 'date.timezone=${TZ}'; \
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini

# Calculate download URL
Expand All @@ -87,6 +89,9 @@ RUN set -ex; \
apk add --no-cache --virtual .fetch-deps \
gnupg \
; \
mkdir $SESSION_SAVE_PATH; \
chmod 1777 $SESSION_SAVE_PATH; \
chown www-data:www-data $SESSION_SAVE_PATH; \
\
export GNUPGHOME="$(mktemp -d)"; \
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
Expand Down
5 changes: 5 additions & 0 deletions fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ENV MAX_EXECUTION_TIME 600
ENV MEMORY_LIMIT 512M
ENV UPLOAD_LIMIT 2048K
ENV TZ UTC
ENV SESSION_SAVE_PATH /sessions
RUN set -ex; \
\
{ \
Expand All @@ -67,6 +68,7 @@ RUN set -ex; \
echo 'post_max_size=${UPLOAD_LIMIT}'; \
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
echo 'date.timezone=${TZ}'; \
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini

# Calculate download URL
Expand Down Expand Up @@ -94,6 +96,9 @@ RUN set -ex; \
gnupg \
dirmngr \
; \
mkdir $SESSION_SAVE_PATH; \
chmod 1777 $SESSION_SAVE_PATH; \
chown www-data:www-data $SESSION_SAVE_PATH; \
\
export GNUPGHOME="$(mktemp -d)"; \
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \
Expand Down
3 changes: 2 additions & 1 deletion testing/phpmyadmin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,15 @@ def test_php_ini(url, username, password, server):
assert(b'upload_max_filesize' in response)
assert(b'post_max_size' in response)
assert(b'expose_php' in response)
assert(b'session.save_path' in response)

assert(b'<tr><td class="e">max_execution_time</td><td class="v">125</td><td class="v">125</td></tr>' in response)

assert(b'<tr><td class="e">upload_max_filesize</td><td class="v">123M</td><td class="v">123M</td></tr>' in response)
assert(b'<tr><td class="e">post_max_size</td><td class="v">123M</td><td class="v">123M</td></tr>' in response)

assert(b'<tr><td class="e">expose_php</td><td class="v">Off</td><td class="v">Off</td></tr>' in response)

assert(b'<tr><td class="e">session.save_path</td><td class="v">/sessions</td><td class="v">/sessions</td></tr>' in response)

def test_import_from_folder(url, username, password, server, sqlfile):
upload_dir = os.environ.get('PMA_UPLOADDIR');
Expand Down

0 comments on commit d455a71

Please sign in to comment.