Skip to content

About

No description, website, or topics provided.

Resources

Stars

11 stars

Watchers

7 watching

Forks

Repository files navigation

Component DB

Documentation Status

Prerequisites:

In order to deploy or develop Component DB, you must have some support software installed. Follow the instructions below to achieve this.

# For red-hat based linux distribution run the following:
yum install -y gcc libgcc expect zlib-devel openssl-devel openldap-devel readline-devel git make cmake sed gawk autoconf automake wget mariadb mariadb-server curl unzip rsync
# For debian based linux distributions run the following:
apt-get install wget gcc git make cmake build-essential libcurses-ocaml-dev curl expect mariadb-client mariadb-server openssl libssl-dev libldap2-dev libsasl2-dev sed gawk unzip rsync

Versions used in production

  • mariadb: 10.5.22
  • Payara 7 (Jakarta EE 11) and Java 25 LTS (Eclipse Temurin) on Linux x86_64; macOS (Intel and Apple Silicon) is supported for development.
  • Other dependencies are automatically downloaded and installed when running make support command. Their versions are set in support/bin/versions.sh and can be overridden from the environment, e.g. PAYARA_VERSION=... make support.
  • support/ is the cdb-bely-support git submodule, shared with BELY. Clone with --recurse-submodules; otherwise make support fetches it itself (git submodule update --init in a clone, or a git clone of the tag in etc/support.version for a release tarball), which needs git and GitHub access.

Deployment

Below are the steps to be followed to deploy an installation of CDB. These steps are designed to be done as a standard non-root user account. Before starting ensure that you have set the root password for your mariadb installation (See Helpful Utility).

Deployment Procedure:

# Make a new directory to hold cdb and its support directories. (replace or set DESIRED_CDB_INSTALL_DIRECTORY var with a unix directory.)
mkdir $DESIRED_CDB_INSTALL_DIRECTORY
cd $DESIRED_CDB_INSTALL_DIRECTORY 
# get the distribution of Component DB (Alternativelly download a release zip and unzip it). 
git clone --recurse-submodules https://github.com/AdvancedPhotonSource/ComponentDB.git
# Navigate inside the distribution. 
cd ComponentDB
# Build support needed for the application (prompts for the Payara master and admin passwords)
make support
# load enviornment variables with new support built. 
source setup.sh    
# Create deployment configuration
make configuration
# Create a clean db for the distribution 
make clean-db
# Prepare web portal configuraiton
make configure-web-portal

# Deploy plugins if needed using `make deploy-cdb-plugin`
# See https://github.com/AdvancedPhotonSource/ComponentDB/wiki/Plugins

# Deploy web portal
make deploy-web-portal    

# All done... output of the command below should print url to the deployed portal. 
echo "https://`hostname`:8181/cdb"

# Valid SSL certificates can also be applied using the following command:
# ./sbin/cdb_update_glassfish_ssl.sh KEY_FILE CRT_FILE # NOTE, this will prompt for the master password set during the `make support` step. 

Payara admin password: make support saves the admin password to a per-deployment file, $CDB_INSTALL_DIR/etc/glassfish.admin.<short-hostname>.passwd (owner-only), and the make/sbin scripts pass it to asadmin. Nothing is stored in ~/.gfclient, so deployments sharing a home directory don't overwrite each other's login. To use a different location, export CDB_BELY_SUPPORT_GLASSFISH_ADMIN_PASSWORD_FILE before sourcing setup.sh and running make support.

Troubleshooting:

Managing Payara:

# Navigate to the ComponentDB distribution directory. 

# Viewing logs
tail -f ../support-`hostname -s`/payara/$CDB_HOST_ARCH/glassfish/domains/production/logs/server.log

# Restart payara server
./etc/init.d/cdb-glassfish restart

Other notes:

Setting Project:

The item project has been mostly static attribute, therefore there is no UI. Currently this can only be done within SQL.

-- Log into the mariadb shell with cdb database. 
use cdb;
-- Override the default project
update item_project set name='OPS' where id = 1;
-- Adding additional projects 
insert into item_project(name) values ('Upgrade');

Restart application to reset any caches for item_project.

# Navigate to the ComponentDB distribution directory. 
./etc/init.d/cdb-glassfish restart

Deployment Upgrade

See docs/update/README.md for the full procedure, including how to skip multiple releases at once.

Upgrading from 3.18.x or earlier to 3.19.0 or later: the platform moved to Payara 7 and Java 25. Rebuild the support software first and reconfigure the new Payara domain; see docs/update/v3.19.x.md.

Summary, upgrading to 3.18.0:

cd $CDB_INSTALL_DIR
wget https://github.com/AdvancedPhotonSource/ComponentDB/archive/v3.18.0.tar.gz
tar -xvf v3.18.0.tar.gz
rm v3.18.0.tar.gz
cd ComponentDB-3.18.0
source setup.sh

# Backup, then stash it as a pre-change snapshot -- backups are date-stamped to the
# day, so without this a later backup below would overwrite it.
make backup
cp -r $CDB_INSTALL_DIR/backup/cdb/`date +%Y%m%d` $CDB_INSTALL_DIR/backup/cdb/`date +%Y%m%d`-pre-change

# Apply any db/sql/updates/updateTo<VERSION>.sql scripts between the old and new
# version, in order.
cd db/sql/updates
# mysql $CDB_DB_NAME --host=127.0.0.1 --user=cdb -p < updateTo<VERSION>.sql
cd ../../../

# Only needed if an update script's header says to rebuild the db -- recent scripts
# are self-contained, so this is normally skipped to save time.
# make backup
# mkdir -p ../db/cdb/
# cp ../backup/cdb/`date +%Y%m%d`/populate* ../db/cdb
# make db

# Deploy plugins if needed: make deploy-cdb-plugin
# See https://github.com/AdvancedPhotonSource/ComponentDB/wiki/Plugins

# make configure-web-portal   # only if generated config templates changed -- rare
make deploy-web-portal

Development

For detailed development instructions please refer to our developers guide.

Getting Started with development:

# first make a fork of this project. 
# create a desired development directory and cdb into it
mkdir $desired_dev_directory
cd $desired_dev_directory
git clone --recurse-submodules https://github.com/AdvancedPhotonSource/ComponentDB.git
# existing clone, or after a pull that moves the support/ submodule:
# git submodule update --init

# Getting support software
cd ComponentDb
make support 
# Get Netbeans
make support-netbeans

# Load up the environment 
source setup.sh

# Prepare Dev DB    
# mysql could be installed as part of ComponentDB support by running 'make support-mysql' 
# - Afterwards run `./etc/init.d/cdb-mysql start`
# if you have mysql installed and started run...
make clean-db   # sample-db will be coming later 

# Start development
make dev-config     

# Open Netbeans
netbeans & 

Preparing Netbeans

make support-netbeans installs NetBeans 32 and configures it to run on the support JDK (Java 25), which the project needs to compile (--release 25). If you use another NetBeans install, start it with --jdkhome $desired_dev_directory/support-hostname -s/java/$CDB_HOST_ARCH or set netbeans_jdkhome in its etc/netbeans.conf. Don't select a separate Java Platform in the project properties; that would break make builds.

Once netbeans is open a few steps need to be taken to prepare netbeans for CDB development.

  1. Open CDB Project: File > Open Project
  2. Navigate to $desired_dev_directory/ComponentDB/src/java
  3. Select CdbWebPortal and hit Open Project
  4. Right click on CdbWebPortal top level under projects
  5. Click "Resolve Missing Server Problem"
  6. Add Server -> Payara Server
  • Installation Location: $desired_dev_directory/support-hostname/netbeans/payara
  • Version: the Payara version in support/bin/versions.sh (currently 7.2026.11)
  • Use the wizard's download
  • Java Platform: the default (support JDK 25)
  1. Next -> Use Default Domain Location -> Finish add server instance wizard
  2. Select the Newly added "Payara Server"
  3. Copy over the required mysql client to new payara server.
# cd into the $desired_dev_directory/$distribution_directory
cp src/java/CdbWebPortal/lib/mariadb-java-client-3.1.0.jar ../support-`hostname`/netbeans/payara/glassfish/domains/domain1/lib/
  1. Increase the server heap. The NetBeans-installed domain defaults to -Xmx512m, which runs out of memory (OutOfMemoryError: Java heap space) under the parallel Selenium suite and after repeated redeploys. With the server running:
ASADMIN=../support-`hostname`/netbeans/payara/bin/asadmin
$ASADMIN list-jvm-options | grep Xm          # remove every existing -Xmx/-Xms value shown
$ASADMIN delete-jvm-options -- -Xmx512m
$ASADMIN create-jvm-options -- -Xmx4g
$ASADMIN create-jvm-options -- -Xms1g
$ASADMIN list-jvm-options | grep Xm          # should show only -Xmx4g and -Xms1g
$ASADMIN restart-domain
  1. Run the project

Repeated NetBeans redeploys leak memory (old application class loaders are not fully released). Restart Payara before running the test suite or when the server slows down.

Optional (macOS): Payara's Hazelcast data grid defaults to port 5900, which is also used by macOS Screen Sharing (VNC). If startup hangs and server.log repeats Unknown protocol: RFB, move Hazelcast to another port. The make support domain already uses 6900; the NetBeans-installed copy needs this once. Stop the server first (a running server keeps the old value and can write it back), then use the domain path shown in NetBeans under Services → Servers → Payara → Properties:

DOMAIN_XML=../support-`hostname`/netbeans/payara/glassfish/domains/domain1/config/domain.xml
# Sets or adds start-port; the element may have no attributes when Payara relies on the 5900 default.
sed -i '' -E 's#<hazelcast-runtime-configuration( start-port="[0-9]+")?#<hazelcast-runtime-configuration start-port="6900"#' $DOMAIN_XML   # GNU sed on Linux: sed -i -E ...
grep hazelcast-runtime-configuration $DOMAIN_XML                     # should show start-port="6900"

If the server is running, asadmin set-hazelcast-configuration --enabled=true --startport 6900 followed by a restart does the same.

Python Web Service Development

The python web service is deprecated but is still a part of the distribution for legacy integrations.

# Code is located in $desired_dev_directory/ComponentDB/src/python
# For web service development (Use your favorite python editor) to test run web service using:
./sbin/cdbWebService.sh

Running Tests

source setup.sh
make test

The Selenium suite runs several browsers in parallel against the portal; give Payara at least a 4 GB heap (see step 10 of Preparing Netbeans) and restart it after a long redeploy session. Failure logs, screenshots, and page source are written to tools/developer_tools/portal_testing/PythonSeleniumTest/test-failures/ (see tools/developer_tools/portal_testing/PythonSeleniumTest/README.md).

See the test setup in tools/developer_tools/{python-client,portal_testing/PythonSeleniumTest}/README.md.

Preparing a Release

make prepare-release bumps the version string across the repo (etc/version, openapi.yaml, web asset cache-busters, python-client packages/*/pyproject.toml/conda recipes) and scaffolds docs/release-notes/<VERSION>.md. Run it, review the diff, then commit.

make prepare-release

Publish the python client (componentdb-api, componentdb-cli) to PyPI with:

make release-python-client

See tools/developer_tools/python-client/README.md for the uv build/uv publish details, TestPyPI dry runs, and the conda packaging path.

License

Copyright (c) UChicago Argonne, LLC. All rights reserved.

About

No description, website, or topics provided.

Resources

Stars

11 stars

Watchers

7 watching

Forks

Releases

Packages

Used by

Contributors

Languages