Sign inSign up

nathanvaughn/webtrees

By nathanvaughn

Updated 4 months ago

Up-to-date Docker image for webtrees with all the bells and whistles.

Image
Web servers
18

500K+

nathanvaughn/webtrees repository overview

Docker Image for webtrees

This is a multi-architecture, up-to-date, Docker image for webtrees served over HTTP or HTTPS. This can be put behind a reverse proxy such as CloudFlare or Traefik, or run standalone.

Usage

Quickstart

If you want to jump right in, take a look at the provided docker-compose.yml.

Environment Variables

There are many environment variables available to help automatically configure the container. For any environment variable you do not define, the default value will be used.

🚨 WARNING 🚨 These environment variables will be visible in the webtrees control panel under "Server information". Either lock down the control panel to administrators, or use the webtrees setup wizard.

Environment VariableRequiredDefaultNotes
PRETTY_URLSNoFalseSetting this to any truthy value (True, 1, yes) will enable pretty URLs. This can be toggled at any time, however you must go through initial setup at least once first.
HTTPS or SSLNoFalseSetting this to any truthy value (True, 1, yes) will enable HTTPS. If True, you must also fill out SSL_CERT_FILE and SSL_CERT_KEY_FILE
HTTPS_REDIRECT or SSL_REDIRECTNoFalseSetting this to any truthy value (True, 1, yes) will enable a permanent 301 redirect to HTTPS . Leaving this off will allow webtrees to be accessed over HTTP, but not automatically redirected to HTTPS.
SSL_CERT_FILENo/certs/webtrees.crtCertificate file to use for HTTPS. Can either be absolute, or relative to /var/www/webtrees/data/.
SSL_CERT_KEY_FILENo/certs/webtrees.keyCertificate key file to use for HTTPS. Can either be absolute, or relative to /var/www/webtrees/data/.
LANGYesen-uswebtrees localization setting. This takes a locale code. List: https://github.com/fisharebest/webtrees/tree/main/resources/lang/
BASE_URLYesNoneBase URL of the installation, with protocol. This needs to be in the form of http://webtrees.example.com
DB_TYPEYesmysqlDatabase server type. See below for valid values.
DB_HOSTYesNoneDatabase server host.
DB_PORTYes3306Database server port.
DB_USER or MYSQL_USER or MARIADB_USER or POSTGRES_USERYeswebtreesDatabase server username.
DB_PASS or MYSQL_PASSWORD or MARIADB_PASSWORD or POSTGRES_PASSWORDYesNoneDatabase server password.
DB_NAME or MYSQL_DATABASE or MARIADB_DATABASE or POSTGRES_DBYeswebtreesDatabase name.
DB_PREFIXYeswt_Prefix to give all tables in the database. Set this to a value of "" to have no table prefix.
DB_KEYNoNoneKey file used to verify the MySQL server. Only use with the mysql database driver. Relative to the /var/www/webtrees/data/ directory.
DB_CERTNoNoneCertificate file used to verify the MySQL server. Only use with the mysql database driver. Relative to the /var/www/webtrees/data/ directory.
DB_CANoNoneCertificate authority file used to verify the MySQL server. Only use with the mysql database driver. Relative to the /var/www/webtrees/data/ directory.
DB_VERIFYNoFalseWhether to verify the MySQL server. Only use with the mysql database driver. If True, you must also fill out DB_KEY, DB_CERT, and DB_CA.
WT_USERYesNoneFirst admin account username. Note, this is only used the first time the container is run, and the database is initialized.
WT_NAMEYesNoneFirst admin account full name. Note, this is only used the first time the container is run, and the database is initialized.
WT_PASSYesNoneFirst admin account password. Note, this is only used the first time the container is run, and the database is initialized.
WT_EMAILYesNoneFirst admin account email. Note, this is only used the first time the container is run, and the database is initialized.
PHP_MEMORY_LIMITNo1024MPHP memory limit. See the PHP documentation
PHP_MAX_EXECUTION_TIMENo90PHP max execution time for a request in seconds. See the PHP documentation
PHP_POST_MAX_SIZENo50MPHP POST request max size. See the PHP documentation
PHP_UPLOAD_MAX_FILE_SIZENo50MPHP max uploaded file size. See the PHP documentation
PUIDNo33See https://docs.linuxserver.io/general/understanding-puid-and-pgid/
PGIDNo33See https://docs.linuxserver.io/general/understanding-puid-and-pgid/

Additionally, you can add _FILE to the end of any environment variable name, and instead that will read the value in from the given filename. For example, setting DB_PASS_FILE=/run/secrets/my_db_secret will read the contents of that file into DB_PASS.

If you don't want the container to be configured automatically (if you're migrating from an existing webtrees installation for example), simply leave the database (DB_) and webtrees (WT_) variables blank, and you can complete the setup wizard like normal.

Database

webtrees recommends a MySQL (or compatible equivalent) database. You will need a separate container for this.

PostgreSQL (pgsql) and SQLite (sqlite) are additionally both supported by webtrees and this image, but are not recommended. This image does not support Microsoft SQL Server, in order to support multiple architectures. See issue: microsoft/msphpsql#441

SQLite Values

If you want to use a SQLite database, set the following values:

  • DB_TYPE to sqlite
  • DB_NAME to desiredfilename. Do not include any extension.
PostgreSQL Values

If you want to use a PostreSQL database, set the following values:

  • DB_TYPE to pgsql
  • DB_PORT to 5432

All other values are just like a MySQL database.

Volumes

The image mounts:

  • /var/www/webtrees/data/

(media is stored in the media subfolder)

If you want to add custom themes or modules, you can also mount the /var/www/webtrees/modules_v4/ directory.

Example docker-compose:

volumes:
  - app_data:/var/www/webtrees/data/
  - app_themes:/var/www/webtrees/modules_v4/
---
volumes:
  app_data:
    driver: local
  app_themes:
    driver: local

See the link above for information about v1.7 webtrees.

To install a custom theme or module, the process is generally as follows:

docker exec -it webtrees_app_1 bash   # connect to the running container
cd /var/www/webtrees/modules_v4/      # move into the modules directory
curl -L <download url> -o <filename>  # download the file

# if module is a .tar.gz file
tar -xf <filename.tar.gz>             # extract the tar archive https://xkcd.com/1168/
rm <filename.tar.gz>                  # remove the tar archive

# if module is a .zip file
apt update && apt install unzip       # install the unzip package
unzip <filename.zip>                  # extract the zip file
rm <filename.zip>                     # remove the zip file

exit                                  # disconnect from the container
Network

The image exposes port 80 and 443.

Example docker-compose:

ports:
  - 80:80
  - 443:443

If you have the HTTPS redirect enabled, you still need to expose port 80. If you're not using HTTPS at all, you don't need to expose port 443.

ImageMagick

ImageMagick is included in this image to speed up thumbnail creation. webtrees will automatically prefer it over gd with no configuration.

Tags

Specific Versions

Each stable, legacy, beta, and alpha release version of webtrees produces a version-tagged build of the Docker container.

Example:

image: ghcr.io/nathanvaughn/webtrees:2.1.2
Latest

Currently, the tags latest, latest-alpha, latest-beta and latest-legacy are available for the latest stable, alpha, beta and legacy versions of webtrees, respectively.

Example:

image: ghcr.io/nathanvaughn/webtrees:latest

Note Legacy versions of webtrees are no longer supported.

Issues

New releases of the Dockerfile are automatically generated from upstream webtrees versions. This means a human does not vette every release. While I try to stay on top of things, sometimes breaking issues do occur. If you have any, please feel free to fill out an issue.

Reverse Proxy Issues

webtrees does not like running behind a reverse proxy, and depending on your setup, you may need to adjust some database values manually.

For example, if you are accessing webtrees via a reverse proxy serving content over HTTPS, but using this container with HTTP, you might need to make the following changes in your database:

mysql -u webtrees -p

use webtrees;
update wt_site_setting set setting_value='https://example.com/login' where setting_name='LOGIN_URL';
update wt_site_setting set setting_value='https://example.com/' where setting_name='SERVER_URL';
quit;

For more info, see this.

Registry

This image is available from 2 different registries. Choose whichever you want:

Tag summary

Content type

Image

Digest

sha256:034151b61

Size

305.1 MB

Last updated

4 months ago

docker pull nathanvaughn/webtrees