Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ LABKEY_VERSION ?= 21.5-SNAPSHOT
LABKEY_DISTRIBUTION ?= community
LABKEY_EK ?= 123abc456

LIMS_MANIFEST_BUCKET ?= labkey-lims-manifests
FETCH_LIMS_MANIFEST ?=

# When running with SSM credentials, seed postgres with the same DB user/password
# that LabKey will fetch from SSM — otherwise the pg container initializes with
# its defaults (postgres/localdevpassword) and auth fails.
Expand Down Expand Up @@ -70,14 +73,39 @@ define tc
$(shell printf "%steamcity[progressMessage '%s%n']" '##' '$1' ; )
endef

.PHONY: all build tag login push up up-build down clean
.PHONY: all build fetch-manifest tag login push up up-build down clean

.EXPORT_ALL_VARIABLES:

# default actions are: login, build, tag, then push
all: login build tag push

build:
# only runs inside LabKey's own TeamCity builds (this is a public repo - a community/external
# build has no access to, and no use for, our internal LIMS manifest bucket) - set
# FETCH_LIMS_MANIFEST=1 to opt in from a local build too (e.g. testing against a real manifest).
# Also a no-op for any LABKEY_DISTRIBUTION with no manifest published (community, enterprise,
# allpg, etc.) - no allowlist needed, absence of a matching S3 object is just "not applicable".
fetch-manifest:
$(call tc,checking for a LIMS product manifest)
@if [ -z "$(TEAMCITY_VERSION)$(FETCH_LIMS_MANIFEST)" ]; then \
echo "not running under TeamCity and FETCH_LIMS_MANIFEST not set - skipping LIMS manifest fetch"; \
else \
version_pattern=$$(echo '$(LABKEY_VERSION)' | grep -oE '^[0-9]+\.[0-9]+' | sed 's/\./\\./g'); \
manifest_list=$$(aws s3api list-objects-v2 --bucket $(LIMS_MANIFEST_BUCKET) --prefix "$(BUILD_DISTRIBUTION)/" --output json) || exit 1; \
manifest_keys=$$(echo "$$manifest_list" | jq -r '.Contents[]?.Key // empty' | grep -E "/LabKey$${version_pattern}([^0-9]|$$)" || true); \
manifest_count=$$(echo "$$manifest_keys" | grep -c . || true); \
if [ "$$manifest_count" -eq 0 ]; then \
echo "no LIMS manifest found for distribution '$(BUILD_DISTRIBUTION)' version '$(LABKEY_VERSION)' - leaving startup/manifest.properties as-is"; \
elif [ "$$manifest_count" -gt 1 ]; then \
echo "expected exactly one manifest under s3://$(LIMS_MANIFEST_BUCKET)/$(BUILD_DISTRIBUTION)/ for version '$(LABKEY_VERSION)', found $$manifest_count: $$manifest_keys" >&2; \
exit 1; \
else \
echo "fetching $$manifest_keys"; \
aws s3 cp "s3://$(LIMS_MANIFEST_BUCKET)/$$manifest_keys" startup/manifest.properties; \
fi; \
fi

build: fetch-manifest
$(call tc,building docker container)
docker build \
--rm \
Expand Down
88 changes: 88 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,94 @@ services:
ports:
- ${PG_PORT:-54321}:5432

lksm_professional:
image: ${COMPOSE_IMAGE:-labkey/community}
container_name: lksm_professional
depends_on:
- pg-lksm_professional
ports:
- ${HOST_PORT:-8443}:8443
- 7199:7199
volumes:
- ./mounts/logs:/labkey/logs
environment:
- LOG_LEVEL_SPRING_WEB=INFO
- LOG_LEVEL_TOMCAT=DEBUG
- LOG_LEVEL_DEFAULT=DEBUG
- LOG_LEVEL_LABKEY_DEFAULT=DEBUG
- LOG_LEVEL_API_SETTINGS=DEBUG
- LOG_LEVEL_API_MODULELOADER=DEBUG

- LOGGER_PATTERN=%-80.80logger{79}

- POSTGRES_HOST=pg-lksm_professional

- MAX_JVM_RAM_PERCENT=${MAX_JVM_RAM_PERCENT:-75.0}
- JAVA_PRE_JAR_EXTRA=-XX:+UseSerialGC -Xss512k

- SMTP_HOST=${SMTP_HOST}
- SMTP_AUTH=true
- SMTP_PORT=587
- SMTP_STARTTLS=true

- LABKEY_SYSTEM_EMAIL_ADDRESS=${SMTP_FROM}

- LABKEY_SSM_PREFIX=${LABKEY_SSM_PREFIX}
- LABKEY_VPC_SSM_PREFIX=${LABKEY_VPC_SSM_PREFIX}
- AWS_REGION=${AWS_REGION}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- AWS_SESSION_TOKEN=${AWS_SESSION_TOKEN}
# non-AWS: set these to supply credentials directly instead of via SSM
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-localdevpassword}
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- LABKEY_EK=${LABKEY_EK:-}
- SMTP_USER=${SMTP_USER:-}
- SMTP_PASSWORD=${SMTP_PASSWORD:-}

# If these parameters are set or set to null use provided; else set values to create initial user
- LABKEY_CREATE_INITIAL_USER=${LABKEY_CREATE_INITIAL_USER-1}
- LABKEY_CREATE_INITIAL_USER_APIKEY=${LABKEY_CREATE_INITIAL_USER_APIKEY-1}

- POSTGRES_MAX_TOTAL_CONNECTIONS=${POSTGRES_MAX_TOTAL_CONNECTIONS:-50}
- POSTGRES_MAX_IDLE_CONNECTIONS=${POSTGRES_MAX_IDLE_CONNECTIONS:-10}
- POSTGRES_MAX_WAIT_MILLIS=${POSTGRES_MAX_WAIT_MILLIS:-120000}
- POSTGRES_ACCESS_UNDERLYING_CONNECTIONS=${POSTGRES_ACCESS_UNDERLYING_CONNECTIONS:-true}
- POSTGRES_VALIDATION_QUERY=${POSTGRES_VALIDATION_QUERY:-SELECT 1}

- LABKEY_CUSTOM_PROPERTIES_S3_URI=${LABKEY_CUSTOM_PROPERTIES_S3_URI}
- LABKEY_OPTIONAL_APP_PROPERTIES_S3_URI=${LABKEY_OPTIONAL_APP_PROPERTIES_S3_URI}
- LABKEY_DEFAULT_PROPERTIES_S3_URI=${LABKEY_DEFAULT_PROPERTIES_S3_URI}
- LOG4J_CONFIG_FILE=${LOG4J_CONFIG_FILE-log4j2.xml}
- LOG4J_CONFIG_OVERRIDE=${LOG4J_CONFIG_OVERRIDE}
- JSON_OUTPUT=${JSON_OUTPUT-false}
- DD_COLLECT_APM=${DD_COLLECT_APM-false}
- SLEEP=${SLEEP:-0}
- PURGE_HEAP_AND_ERROR_LOGS_OLDER_THAN_DAYS=${PURGE_HEAP_AND_ERROR_LOGS_OLDER_THAN_DAYS:-90}
- PURGE_MTNC_LOGS_OLDER_THAN_DAYS=${PURGE_MTNC_LOGS_OLDER_THAN_DAYS:-90}
- LABKEY_EXTERNAL_MODULES=${LABKEY_EXTERNAL_MODULES:-/labkey/files/externalModules}

pg-lksm_professional:
image: postgres:${PG_VERSION:-18}
entrypoint:
- "/bin/bash"
- "-c"
- "docker-entrypoint.sh postgres"
environment:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-localdevpassword}
- PGDATA=/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
volumes:
- ./pgdata/${IDENT:-postgres}-${PG_VERSION:-18}-data:/var/lib/postgresql/data
ports:
- ${PG_PORT:-54321}:5432


# below can optionally be added to services above as needed

Expand Down
Loading