-
Notifications
You must be signed in to change notification settings - Fork 2
Sys Admin Guide ‐ Docker Install
In 2026, the Ecotrust Software team added support for installing the TEK DB project with Docker. Below is a guide for System Admins on how to maintain their Docker deployed instance.
- Operating System (pick 1):
- Ubuntu 24.04 LTS (recommended/supported, 26.04 and newer LTS)
- Other Linux Server distributions
- Windows Server
- Docker Engine (pick 1):
- Docker Engine for Linux (Docker CE)
- Docker Desktop
All code and documentation is available for free (under the MIT license) on Github: https://github.com/Ecotrust/TEKDB
If you are reinstalling the tool and need to preserve or migrate your data you can create a 'fixture' (a backup file) that can be imported into new instances of the TEK DB.
In 2022, a new feature was added to simplify the process below – it allows users with administrative privileges to export a zipped archive file containing a 'fixture' file to restore database records, as well as a folder containing all relevant media files (videos, photos, audio, pdfs, etc…) supported by the database.
- Log in to with admin credentials.
- In the top right corner, select the dropdown and click 'administration' to navigate to the Django Administration dashboard.
Warning: the following step downloads all of the traditional knowledge that has been accumulated into the database thus far, captured in a single, unencrypted file.
- Click the 'Export to .zip' button
- Determine a safe place to write the file
- Determine a meaningful name for the file, such as
tek_db_fixture_YYYYMMDD.json, with YYYYMMDD being today's date - Navigate to your project where you have Docker running and run the following command:
docker exec tekdb_web python manage.py dumpdata --indent=2 auth.Group Lookup.LookupPlanningUnit Lookup.LookupTribe Lookup.LookupHabitat TEKDB.Places Lookup.LookupResourceGroup TEKDB.Resources Lookup.LookupPartUsed Lookup.LookupCustomaryUse Lookup.LookupSeason Lookup.LookupTiming Relationships.PlacesResourceEvents Lookup.LookupParticipants Lookup.LookupTechniques Lookup.LookupActivity TEKDB.ResourcesActivityEvents Lookup.People Lookup.LookupReferenceType Lookup.LookupAuthorType TEKDB.Citations Relationships.PlacesCitationEvents Lookup.CurrentVersion Lookup.LookupLocalityType TEKDB.Locality Relationships.LocalityGISSelections Relationships.LocalityPlaceResourceEvent Lookup.LookupMediaType Lookup.LookupUserInfo TEKDB.Media Relationships.MediaCitationEvents Relationships.PlaceAltIndigenousName Relationships.PlaceGISSelections Relationships.PlacesMediaEvents Relationships.PlacesResourceCitationEvents Relationships.PlacesResourceMediaEvents Relationships.ResourceActivityCitationEvents Relationships.ResourceActivityMediaEvents Relationships.ResourceAltIndigenousName Relationships.ResourceResourceEvents Relationships.ResourcesCitationEvents Relationships.ResourcesMediaEvents Accounts.UserAccess Accounts.Users explore.PageContent > /path/to/your/file.jsonWe have developed a bash script to run to install Docker, checkout this Git repository, use your environment variables and start the Docker containers using docker-compose.
- Create a
.env.prodfile with your environment variables in an accessible location on your Linux instance.
.env.prod should contain the following environment variables:
SECRET_KEY= # a random 50+ character string used for Django.You can generate this yourself or use a tool like [this](https://builtwithdjango.com/tools/django-secret/) to generate one for you.
ALLOWED_HOSTS= # IP address you want the app to run on
SQL_ENGINE=django.contrib.gis.db.backends.postgis
SQL_DATABASE= # database name, ex: tekdb
SQL_USER= #database user, ex: postgres
SQL_PASSWORD= # database password
SQL_HOST=db
SQL_PORT=5432
WEB_IMAGE=ghcr.io/ecotrust/tekdb/web
CELERY_BROKER_URL=redis://redis:6379/0
GIS_USER_PASSWORD= # password for user named ‘gis’ which has permissions for accessing tables with spatial data- Download the script onto your instance with curl:
curl -L -o install-docker-env.sh https://github.com/Ecotrust/TEKDB/raw/refs/heads/docker-install-script/scripts/Linux/install-docker-env.sh
- Ensure the script is executable:
chmod +x install-docker-env.sh
- Run the script:
./install-docker-env.sh <file path to env.prod file>
- View the TEKDB project at the IP address you specified in
ALLOWED_HOSTS!
If you would like to take down the TEKDB project, we have a script to help with this.
- From the instance that the TEKDB project is running on, copy the tear down script with curl:
curl -L -o teardown-docker-env.sh https://raw.githubusercontent.com/Ecotrust/TEKDB/refs/heads/docker-install-script/scripts/Linux/teardown-docker-env.sh
- Ensure the script is executable:
chmod +x teardown-docker-env.sh
-
Locate your docker compose file. If you installed with the
install-docker-env.shscript, the file is likely at<where you ran the script>/tekdb/docker. The Docker compose file is calleddocker-compose.prod.local.yaml. -
Run the script:
./teardown-docker-env.sh <file path to .env.prod file> <file path to docker compose>
- If you would like to remove all of the data in the database with you tear down, add the flag
--volumes. Ensure you have a back up before doing this if you would like to persist your data.- If you would like to remove any Docker images that are build during the
docker-compose upin the install script, add--rmi-local