This git project contains everything required to start labkey as a docker container.
dockerlabkey with docker privileges sudo adduser labkey
sudo usermod -G docker labkey
sudo su labkey
cd
git clone https://git0.fmf.uni-lj.si/studen/labkeyDocker.git
Set path as POSTGRES_DIR in labkeyDocker/bin/env.sh, see below. If you don't have an existing database, it is
enough to create the directory PGPASS from env.sh and postgresql container will create one.
EXPERT USE: To use existing database, make sure the version of the database match the container. Container versions
are set in corresponding Dockerfiles, check the one COMPOSE in env.sh points to. Adjust PGPASS and password
in env.sh and labkey.xml accordingly.
Check if database runs:
labkeyDocker/bin/startPGonly.sh
docker logs config-labkey-db-1
labkeyDocker/bin/stopLabkey.sh
The files and externalModules locations are set in bin/env.sh, see bin/env.sh.sample:
export EXTERNAL_MODULES=$HOME/externalModules
export LABKEY_FILES=/data/labkey/files
Best practice is to have labkey own this paths.
Copy target binaries from LabKey or legacy repository to $HOME/packages. Uninstall and (re)install target binaries:
labkeyDocker/bin/uninstallLabkey.sh
labkeyDocker/bin/installLabkey.sh X
Copy labkeyDocker/bin/env.sh.sample to labkeyDocker/bin/env.sh and update enviorment variables:
POSTGRES_DIR for location of database (on host system)PGPASS, should match the one used in database creation if database already existsEXTERNAL_MODULES, LABKEY_FILESEXTERNAL_MODULES as well as LABKEY_FILES should be owned by labkey user.DOCKERCOMPOSE, normally default docker compose is OK, but older docker version shipped compose separately as docker-compose.COMPOSE points to the right .yaml file, where versions of labkey and compose match.hidden compose files are available, where access ports (8080, 8443) are not shared by the host. Use a reverse proxy, like
this one to terminate SSL connection.labkey.xml)Copy labkeyDocker/tomcat/conf/Catalina/localhost/labkey.xml.temp to labkey.xml in the same directory.
env.sh:PGPASS as password in labkey.xmlEXPERT USE: In labkey.xml one can adjust the postgresl ports and/or server if other than dedicated server is used.
Docker will also map labkeyDocker/tomcat/bin/setenv.sh to container space, which gives some global settings to the
tomcat engine of LabKey.
EXPERT USE: In setenv.sh one can adjust java settings, for example add-exports to expose internal Java implementations, ie. for
direct WebSocket use.
Run bin/startLabkey.sh. This will do several things:
In principle, the service should be running at http://localhost:8080/labkey. Check output of inidividual
components by:
docker logs config-labkey-db-1
docker logs config-labkey-web-1
docker exec -it config-labkey-db-1 bash
docker exec -it config-labkey-web-1 bash
The appropriate Dockerfile (see section on prebuilt images below) should add typicall libraries to container. Should you find a further library
you should need, contact me or update your dockerfile similarly to examples in Dockerfile21.
In the latest version, images can be pre-built using docker hub as a repository for such images lacking adaptation to individual working environment.
To create such images, do
$ docker build -f config/web/Dockerfile21 -t andrejstuden/nix:x21 config/web
$ docker login -u andrejstuden docker.io
$ docker push andrejstuden/nix:x21