Skip to content

Commit

Permalink
Keep all upload data persistent and advice on redirections issues (#202)
Browse files Browse the repository at this point in the history
* Added ServerName to example apache config

ServerName helps when the cannonical redirections from Apache
use a port the front proxy doesn't listen on - see #196

* Mount volume for the whole upload directory

All subdirectories are used for persistent storage, keeping e.g. themes, plugins and survey uploads.

---------

Co-authored-by: Markus Opolka <[email protected]>
  • Loading branch information
kamil-certat and martialblog authored Jan 29, 2025
1 parent 1984086 commit 13afc66
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ LimeSurvey requires an external database (MySQL, PostgreSQL) to run. See *docker

To preserve the uploaded files assign the upload folder into a volume. See *docker-compose.yml* for example.

Path: `/var/www/html/upload/surveys`
Path: `/var/www/html/upload`

**Hint**: The mounted directory must be owned by the webserver user (e.g. www-data)

Expand Down Expand Up @@ -222,6 +222,26 @@ This might be fixed by setting the HTTP Host Header in the reverse proxy explici
See:
- https://github.com/martialblog/docker-limesurvey/issues/127

## Updating or rebuilding container removes themes/plugins/...

The `/var/www/html/upload` directory contains multiple subdirectories for different kind of persistent data,
e.g. themes, plugins and survey uploads. In past, the example configuration recommended only the persistent
volume for survey uploads. In such a situation, any rebuild of the container will remove other stored data.
To keep them persistent, you need to ensure that all subdirectories of `upload` are stored in a volume.

The easiest way is to mount the whole `/var/www/html/upload`. If you want to update an existing deployment
from previous configuration, please keep in mind that just changing the mount path may cause data loss
(e.g. already uploaded themes). Please backup your data from the container before any modifications.
You may also consider separated volumes for each subdirectory.

## Apache generates redirects with internal port / URLs don't work without trailing slash

If your deployment is behind an additional proxy that listens on a different port than the Apache in the
container, you may notice some issues with redirects generated from Apache, e.g. when redirecting
URLs to the cannonical version. Apache will try to add the port it's listening on to the URL.
To prevent this, you may edit the Apache configuration and add the `ServerName` directive with your
domain. In this case, Apache won't try to construct it automatically and use the configured value.

# References

- https://www.limesurvey.org/
Expand Down
4 changes: 3 additions & 1 deletion docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ services:
- [email protected]
- PUBLIC_URL=foobar.com
volumes:
- limesurvey:/var/www/html/upload/surveys
# All subdirectories of the upload may contain
# data intended to be persistent (e.g. themes)
- limesurvey:/var/www/html/upload
ports:
- 8080:8080
depends_on:
Expand Down
2 changes: 2 additions & 0 deletions examples/apache-example.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<VirtualHost *:8080>
ServerAdmin [email protected]
DocumentRoot /var/www/html
# ServerName may help with issues with redirections - see #196
# ServerName your-domain.com
Alias /limesurvey "/var/www/html"

<Directory />
Expand Down

0 comments on commit 13afc66

Please sign in to comment.