Skip to content

Commit bb70a46

Browse files
committed
Add back a /sessions volume for sessions persistence
Ref: #274 Ref: #198
1 parent 88f6d78 commit bb70a46

File tree

7 files changed

+35
-1
lines changed

7 files changed

+35
-1
lines changed

Dockerfile-alpine.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ RUN set -ex; \
4141
ENV MAX_EXECUTION_TIME 600
4242
ENV MEMORY_LIMIT 512M
4343
ENV UPLOAD_LIMIT 2048K
44+
ENV SESSION_SAVE_PATH /sessions
4445
RUN set -ex; \
4546
\
4647
{ \
@@ -63,6 +64,7 @@ RUN set -ex; \
6364
echo 'memory_limit=${MEMORY_LIMIT}'; \
6465
echo 'post_max_size=${UPLOAD_LIMIT}'; \
6566
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
67+
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
6668
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
6769

6870
# Calculate download URL
@@ -85,6 +87,9 @@ RUN set -ex; \
8587
apk add --no-cache --virtual .fetch-deps \
8688
gnupg \
8789
; \
90+
mkdir $SESSION_SAVE_PATH; \
91+
chmod 1777 $SESSION_SAVE_PATH; \
92+
chown www-data:www-data $SESSION_SAVE_PATH; \
8893
\
8994
export GNUPGHOME="$(mktemp -d)"; \
9095
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \

Dockerfile-debian.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ RUN set -ex; \
4343
ENV MAX_EXECUTION_TIME 600
4444
ENV MEMORY_LIMIT 512M
4545
ENV UPLOAD_LIMIT 2048K
46+
ENV SESSION_SAVE_PATH /sessions
4647
RUN set -ex; \
4748
\
4849
{ \
@@ -65,6 +66,7 @@ RUN set -ex; \
6566
echo 'memory_limit=${MEMORY_LIMIT}'; \
6667
echo 'post_max_size=${UPLOAD_LIMIT}'; \
6768
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
69+
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
6870
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
6971

7072
# Calculate download URL
@@ -92,6 +94,9 @@ RUN set -ex; \
9294
gnupg \
9395
dirmngr \
9496
; \
97+
mkdir $SESSION_SAVE_PATH; \
98+
chmod 1777 $SESSION_SAVE_PATH; \
99+
chown www-data:www-data $SESSION_SAVE_PATH; \
95100
\
96101
export GNUPGHOME="$(mktemp -d)"; \
97102
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ See the following links for config file information:
140140

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

143+
## Sessions persistence
144+
145+
In order to keep your sessions active between container updates you will need to mount the `/sessions` folder.
146+
147+
```sh
148+
-v /some/local/directory/sessions:/sessions:rw
149+
```
150+
143151
## Environment variables summary
144152

145153
* ``PMA_ARBITRARY`` - when set to 1 connection to the arbitrary server will be allowed

apache/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ RUN set -ex; \
4343
ENV MAX_EXECUTION_TIME 600
4444
ENV MEMORY_LIMIT 512M
4545
ENV UPLOAD_LIMIT 2048K
46+
ENV SESSION_SAVE_PATH /sessions
4647
RUN set -ex; \
4748
\
4849
{ \
@@ -65,6 +66,7 @@ RUN set -ex; \
6566
echo 'memory_limit=${MEMORY_LIMIT}'; \
6667
echo 'post_max_size=${UPLOAD_LIMIT}'; \
6768
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
69+
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
6870
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
6971

7072
# Calculate download URL
@@ -92,6 +94,9 @@ RUN set -ex; \
9294
gnupg \
9395
dirmngr \
9496
; \
97+
mkdir $SESSION_SAVE_PATH; \
98+
chmod 1777 $SESSION_SAVE_PATH; \
99+
chown www-data:www-data $SESSION_SAVE_PATH; \
95100
\
96101
export GNUPGHOME="$(mktemp -d)"; \
97102
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \

fpm-alpine/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ RUN set -ex; \
4141
ENV MAX_EXECUTION_TIME 600
4242
ENV MEMORY_LIMIT 512M
4343
ENV UPLOAD_LIMIT 2048K
44+
ENV SESSION_SAVE_PATH /sessions
4445
RUN set -ex; \
4546
\
4647
{ \
@@ -63,6 +64,7 @@ RUN set -ex; \
6364
echo 'memory_limit=${MEMORY_LIMIT}'; \
6465
echo 'post_max_size=${UPLOAD_LIMIT}'; \
6566
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
67+
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
6668
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
6769

6870
# Calculate download URL
@@ -85,6 +87,9 @@ RUN set -ex; \
8587
apk add --no-cache --virtual .fetch-deps \
8688
gnupg \
8789
; \
90+
mkdir $SESSION_SAVE_PATH; \
91+
chmod 1777 $SESSION_SAVE_PATH; \
92+
chown www-data:www-data $SESSION_SAVE_PATH; \
8893
\
8994
export GNUPGHOME="$(mktemp -d)"; \
9095
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \

fpm/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ RUN set -ex; \
4343
ENV MAX_EXECUTION_TIME 600
4444
ENV MEMORY_LIMIT 512M
4545
ENV UPLOAD_LIMIT 2048K
46+
ENV SESSION_SAVE_PATH /sessions
4647
RUN set -ex; \
4748
\
4849
{ \
@@ -65,6 +66,7 @@ RUN set -ex; \
6566
echo 'memory_limit=${MEMORY_LIMIT}'; \
6667
echo 'post_max_size=${UPLOAD_LIMIT}'; \
6768
echo 'upload_max_filesize=${UPLOAD_LIMIT}'; \
69+
echo 'session.save_path=${SESSION_SAVE_PATH}'; \
6870
} > $PHP_INI_DIR/conf.d/phpmyadmin-misc.ini
6971

7072
# Calculate download URL
@@ -92,6 +94,9 @@ RUN set -ex; \
9294
gnupg \
9395
dirmngr \
9496
; \
97+
mkdir $SESSION_SAVE_PATH; \
98+
chmod 1777 $SESSION_SAVE_PATH; \
99+
chown www-data:www-data $SESSION_SAVE_PATH; \
95100
\
96101
export GNUPGHOME="$(mktemp -d)"; \
97102
export GPGKEY="3D06A59ECE730EB71B511C17CE752F178259BD92"; \

testing/phpmyadmin_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,15 @@ def test_php_ini(url, username, password, server):
104104
assert(b'upload_max_filesize' in response)
105105
assert(b'post_max_size' in response)
106106
assert(b'expose_php' in response)
107+
assert(b'session.save_path' in response)
107108

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

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

113114
assert(b'<tr><td class="e">expose_php</td><td class="v">Off</td><td class="v">Off</td></tr>' in response)
114-
115+
assert(b'<tr><td class="e">session.save_path</td><td class="v">/sessions</td><td class="v">/sessions</td></tr>' in response)
115116

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

0 commit comments

Comments
 (0)