Skip to content

Commit

Permalink
Add back a /sessions volume for sessions persistence
Browse files Browse the repository at this point in the history
Ref: #274
Ref: #198
  • Loading branch information
williamdes committed Mar 11, 2023
1 parent 88f6d78 commit bb70a46
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Dockerfile-alpine.template
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ RUN set -ex; \
ENV MAX_EXECUTION_TIME 600
ENV MEMORY_LIMIT 512M
ENV UPLOAD_LIMIT 2048K
ENV SESSION_SAVE_PATH /sessions
RUN set -ex; \
\
{ \
Expand All @@ -63,6 +64,7 @@ RUN set -ex; \
echo 'memory_limit=${MEMORY_LIMIT}'; \
echo 'post_max_size=${UPLOAD_LIMIT}'; \
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini

# Calculate download URL
Expand All @@ -85,6 +87,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 @@ -43,6 +43,7 @@ RUN set -ex; \
ENV MAX_EXECUTION_TIME 600
ENV MEMORY_LIMIT 512M
ENV UPLOAD_LIMIT 2048K
ENV SESSION_SAVE_PATH /sessions
RUN set -ex; \
\
{ \
Expand All @@ -65,6 +66,7 @@ RUN set -ex; \
echo 'memory_limit=${MEMORY_LIMIT}'; \
echo 'post_max_size=${UPLOAD_LIMIT}'; \
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini

# Calculate download URL
Expand Down Expand Up @@ -92,6 +94,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 @@ -43,6 +43,7 @@ RUN set -ex; \
ENV MAX_EXECUTION_TIME 600
ENV MEMORY_LIMIT 512M
ENV UPLOAD_LIMIT 2048K
ENV SESSION_SAVE_PATH /sessions
RUN set -ex; \
\
{ \
Expand All @@ -65,6 +66,7 @@ RUN set -ex; \
echo 'memory_limit=${MEMORY_LIMIT}'; \
echo 'post_max_size=${UPLOAD_LIMIT}'; \
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini

# Calculate download URL
Expand Down Expand Up @@ -92,6 +94,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 @@ -41,6 +41,7 @@ RUN set -ex; \
ENV MAX_EXECUTION_TIME 600
ENV MEMORY_LIMIT 512M
ENV UPLOAD_LIMIT 2048K
ENV SESSION_SAVE_PATH /sessions
RUN set -ex; \
\
{ \
Expand All @@ -63,6 +64,7 @@ RUN set -ex; \
echo 'memory_limit=${MEMORY_LIMIT}'; \
echo 'post_max_size=${UPLOAD_LIMIT}'; \
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini

# Calculate download URL
Expand All @@ -85,6 +87,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 @@ -43,6 +43,7 @@ RUN set -ex; \
ENV MAX_EXECUTION_TIME 600
ENV MEMORY_LIMIT 512M
ENV UPLOAD_LIMIT 2048K
ENV SESSION_SAVE_PATH /sessions
RUN set -ex; \
\
{ \
Expand All @@ -65,6 +66,7 @@ RUN set -ex; \
echo 'memory_limit=${MEMORY_LIMIT}'; \
echo 'post_max_size=${UPLOAD_LIMIT}'; \
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini

# Calculate download URL
Expand Down Expand Up @@ -92,6 +94,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 bb70a46

Please sign in to comment.