diff --git a/containers/build_classic.sh b/containers/build_classic.sh deleted file mode 100755 index 22a94eb10..000000000 --- a/containers/build_classic.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -set -e - -BASE="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" - -CLASSIC_PATH=$BASE/wildfly/builder/NEDSSDev -CLASSIC_VERSION=lts/6.0.17 - -echo "Building NBS6 Application" - -if [ -d "$CLASSIC_PATH" ]; then - echo "NEDSSDEV already cloned" -else - echo "NEDSSDEV not found, cloning..." - git clone -b $CLASSIC_VERSION git@github.com:cdcent/NEDSSDev.git $CLASSIC_PATH -fi - -docker compose -f $BASE/../docker-compose.yaml up wildfly --build -d - -echo "**** Classic build complete ****" -echo "http://localhost:7003/nbs/login" -echo "" -echo "**** Available users ****" -echo "*\tmsa" -echo "*\tsuperuser" -echo "" \ No newline at end of file diff --git a/containers/db/.gitignore b/containers/db/.gitignore deleted file mode 100644 index bfca30dd8..000000000 --- a/containers/db/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.backups \ No newline at end of file diff --git a/containers/db/Dockerfile b/containers/db/Dockerfile deleted file mode 100644 index cec3f8a16..000000000 --- a/containers/db/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# Build the base database image -FROM ghcr.io/cdcent/nedssdb:fdbd7a - -USER mssql - -ARG DATABASE_PASSWORD -ARG DATABASE_VERSION -ARG DEPLOY_ADMIN_PASSWORD - -ENV SQLCMDPASSWORD=${DATABASE_PASSWORD} \ - DATABASE_PASSWORD=${DATABASE_PASSWORD} \ - DATABASE_VERSION=${DATABASE_VERSION} \ - DEPLOY_ADMIN_PASSWORD=${DEPLOY_ADMIN_PASSWORD} - -# Copy the supplemental restore files for RTR -COPY --chown=mssql ./initialize /var/opt/database/initialize/ - -# Run RTR specific initialization scripts -RUN /var/opt/database/initialize/initialize.sh && \ - rm -rf /var/opt/database/* diff --git a/containers/db/Dockerfile_windows b/containers/db/Dockerfile_windows deleted file mode 100644 index 25a16f20b..000000000 --- a/containers/db/Dockerfile_windows +++ /dev/null @@ -1,31 +0,0 @@ -FROM mcr.microsoft.com/mssql/server:2022-latest - -ARG DATABASE_PASSWORD - -ENV ACCEPT_EULA=Y \ - MSSQL_PID=Developer \ - SA_PASSWORD=${DATABASE_PASSWORD} \ - SQLCMDPASSWORD=${DATABASE_PASSWORD} - -USER root - -RUN apt-get update && \ - apt-get install -y curl gnupg unixodbc-dev && \ - curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ - curl -sSL https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list && \ - apt-get update && \ - ACCEPT_EULA=Y apt-get install -y mssql-tools18 && \ - apt-get clean && \ - echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc - -ENV PATH="${PATH}:/opt/mssql-tools18/bin" - -COPY ./initialize /var/opt/database/initialize/ -RUN chmod +x /var/opt/database/initialize/*.sh - -RUN /opt/mssql/bin/mssql-conf set sqlagent.enabled true - -USER mssql - -# Start SQL Server and run the init script in container runtime -CMD /bin/bash -c "/opt/mssql/bin/sqlservr & sleep 30 && /var/opt/database/initialize/initialize.sh && wait" diff --git a/containers/db/initialize/01-restore-modern.sql b/containers/db/initialize/01-restore-modern.sql new file mode 100644 index 000000000..ee8b19d54 --- /dev/null +++ b/containers/db/initialize/01-restore-modern.sql @@ -0,0 +1,19 @@ +USE [master]; + +--------------------------------------------------------------------------------------------------- +-- RDB_MODERN (Copy of RDB) +--------------------------------------------------------------------------------------------------- + +IF DB_ID('rdb_modern') IS NULL +BEGIN + -- Create backup of RDB + BACKUP DATABASE RDB TO DISK = '/tmp/RDB.bak' WITH COMPRESSION; + + -- Restore backup to rdb_modern + RESTORE DATABASE [RDB_MODERN] FROM DISK = N'/tmp/RDB.bak' WITH FILE = 1, + MOVE N'RDB' TO N'/var/opt/mssql/data/rdb_modern_data.mdf', + MOVE N'RDB_log' TO N'/var/opt/mssql/data/rdb_modern_log.ldf', NOUNLOAD, STATS = 10 + + + ALTER DATABASE [RDB_MODERN] SET COMPATIBILITY_LEVEL = 120; +END diff --git a/containers/db/initialize/02-initialize-rdb-modern.sql b/containers/db/initialize/02-initialize-rdb-modern.sql new file mode 100644 index 000000000..70aafe20b --- /dev/null +++ b/containers/db/initialize/02-initialize-rdb-modern.sql @@ -0,0 +1,19 @@ +USE [NBS_ODSE]; +-- Insert into NBS_ODSE.NBS_Configuration to flag use of RDB_MODERN +IF (SELECT config_value FROM NBS_configuration WHERE config_key = 'ENV') IS NULL +BEGIN + INSERT INTO + NBS_configuration ( + config_key, + config_value, + version_ctrl_nbr, + add_user_id, + add_time, + last_chg_user_id, + last_chg_time, + status_cd, + status_time + ) + VALUES + ('ENV', 'UAT', 1, 99999999, GETDATE(), 99999999, GETDATE(), 'A', GETDATE()); +END diff --git a/containers/db/initialize/restore.d/03-user-db_deploy_admin.sql b/containers/db/initialize/03-user-db_deploy_admin.sql similarity index 68% rename from containers/db/initialize/restore.d/03-user-db_deploy_admin.sql rename to containers/db/initialize/03-user-db_deploy_admin.sql index d19c5acea..f571ee073 100644 --- a/containers/db/initialize/restore.d/03-user-db_deploy_admin.sql +++ b/containers/db/initialize/03-user-db_deploy_admin.sql @@ -9,7 +9,7 @@ IF NOT EXISTS (SELECT name FROM sys.server_principals WHERE name = 'db_deploy_admin') BEGIN - CREATE LOGIN [db_deploy_admin] WITH PASSWORD =N'$(DEPLOY_ADMIN_PASSWORD)', DEFAULT_DATABASE = [master], DEFAULT_LANGUAGE = [us_english], CHECK_EXPIRATION = OFF, CHECK_POLICY = OFF; + CREATE LOGIN [db_deploy_admin] WITH PASSWORD =N'$(LIQUIBASE_USER_PASSWORD)', DEFAULT_DATABASE = [master], DEFAULT_LANGUAGE = [us_english], CHECK_EXPIRATION = OFF, CHECK_POLICY = OFF; ALTER SERVER ROLE [setupadmin] ADD MEMBER [db_deploy_admin]; ALTER SERVER ROLE [processadmin] ADD MEMBER [db_deploy_admin]; @@ -19,18 +19,17 @@ IF NOT EXISTS (SELECT name GRANT VIEW SERVER STATE TO [db_deploy_admin]; END -if exists (select 1 - from sys.databases - where name = 'rdsadmin') -- for aws - begin +IF EXISTS (SELECT 1 FROM sys.databases WHERE NAME = 'rdsadmin') -- for aws + BEGIN USE msdb; IF NOT EXISTS (SELECT name FROM master.sys.database_principals WHERE name = 'db_deploy_admin') - CREATE USER [db_deploy_admin] FOR LOGIN [db_deploy_admin] WITH DEFAULT_SCHEMA =[dbo]; + BEGIN + CREATE USER [db_deploy_admin] FOR LOGIN [db_deploy_admin] WITH DEFAULT_SCHEMA =[dbo]; - GRANT SELECT ON msdb.dbo.sysjobs TO db_deploy_admin; - GRANT EXECUTE ON msdb.dbo.rds_cdc_enable_db TO db_deploy_admin; - GRANT EXECUTE ON msdb.dbo.rds_cdc_disable_db TO db_deploy_admin; + GRANT SELECT ON msdb.dbo.sysjobs TO db_deploy_admin; + GRANT EXECUTE ON msdb.dbo.rds_cdc_enable_db TO db_deploy_admin; + GRANT EXECUTE ON msdb.dbo.rds_cdc_disable_db TO db_deploy_admin; /* CNDE-2707: @@ -39,17 +38,22 @@ if exists (select 1 it is sufficient to just have sysadmin role, which has full access to SQL Server Agent roles. */ - ALTER ROLE [SQLAgentOperatorRole] ADD MEMBER [db_deploy_admin]; - end; -else - begin + ALTER ROLE [SQLAgentOperatorRole] ADD MEMBER [db_deploy_admin]; + END + END; +ELSE + BEGIN -- azure and onprem - ALTER SERVER ROLE [sysadmin] ADD MEMBER [db_deploy_admin] + IF NOT EXISTS (SELECT name FROM master.sys.database_principals WHERE name = 'db_deploy_admin') + BEGIN + ALTER SERVER ROLE [sysadmin] ADD MEMBER [db_deploy_admin] + + CREATE USER [db_deploy_admin] FOR LOGIN [db_deploy_admin] WITH DEFAULT_SCHEMA =[dbo] + GRANT EXECUTE ON sys.sp_cdc_enable_db TO db_deploy_admin; + GRANT EXECUTE ON sys.sp_cdc_disable_db TO db_deploy_admin; + END - CREATE USER [db_deploy_admin] FOR LOGIN [db_deploy_admin] WITH DEFAULT_SCHEMA =[dbo] - GRANT EXECUTE ON sys.sp_cdc_enable_db TO db_deploy_admin; - GRANT EXECUTE ON sys.sp_cdc_disable_db TO db_deploy_admin; - end; + END; -- ========================================== -- RDB @@ -65,15 +69,6 @@ IF NOT EXISTS (SELECT * END; -IF NOT EXISTS (SELECT * - FROM sys.database_principals - WHERE name = 'db_deploy_admin') - BEGIN - CREATE USER [db_deploy_admin] FOR LOGIN [db_deploy_admin] WITH DEFAULT_SCHEMA =[dbo] - - ALTER ROLE [db_owner] ADD MEMBER [db_deploy_admin] - END - -- ========================================== -- NBS_ODSE -- ========================================== diff --git a/containers/db/initialize/04-nbs_odse-change-data-capture.sql b/containers/db/initialize/04-nbs_odse-change-data-capture.sql new file mode 100644 index 000000000..e48d7cf7c --- /dev/null +++ b/containers/db/initialize/04-nbs_odse-change-data-capture.sql @@ -0,0 +1,55 @@ +--------------------------------------------------------------------------------------------------- +-- Enable CDC for NBS_ODSE +--------------------------------------------------------------------------------------------------- +USE NBS_ODSE; + +EXEC sp_changedbowner 'sa'; + +-- Enable at database level +IF (SELECT is_cdc_enabled FROM sys.databases WHERE name = 'NBS_ODSE') = 0 +BEGIN + PRINT 'Enabling CDC for NBS_ODSE'; + EXEC sys.sp_cdc_enable_db; +END + +-- Enable for tables +DECLARE @tableName NVARCHAR(128); +DECLARE @enableCDCSQL NVARCHAR(MAX); + +DECLARE @tablesToEnable TABLE ( + TableName NVARCHAR(128) +); + +INSERT INTO @tablesToEnable (TableName) VALUES + ('Person'), + ('Organization'), + ('Observation'), + ('Public_health_case'), + ('Treatment'), + ('state_defined_field_data'), + ('Notification'), + ('Interview'), + ('Place'), + ('CT_contact'), + ('Auth_user'), + ('Intervention'), + ('Act_relationship') +; + +DECLARE cur CURSOR FOR SELECT TableName FROM @tablesToEnable; +OPEN cur; +FETCH NEXT FROM cur INTO @tableName; + +WHILE @@FETCH_STATUS = 0 +BEGIN + IF (SELECT is_tracked_by_cdc FROM sys.tables WHERE name = @tableName) = 0 + BEGIN + PRINT 'Enabling CDC for table ' + @tableName; + EXEC sys.sp_cdc_enable_table @source_schema = 'dbo', @source_name = @tableName, @role_name = NULL; + END + + FETCH NEXT FROM cur INTO @tableName; +END + +CLOSE cur; +DEALLOCATE cur; diff --git a/containers/db/initialize/05-nbs_srte-change-data-capture.sql b/containers/db/initialize/05-nbs_srte-change-data-capture.sql new file mode 100644 index 000000000..6b14c6a34 --- /dev/null +++ b/containers/db/initialize/05-nbs_srte-change-data-capture.sql @@ -0,0 +1,86 @@ +--------------------------------------------------------------------------------------------------- +-- Enable CDC for NBS_SRTE +--------------------------------------------------------------------------------------------------- +USE NBS_SRTE; + +-- Enable at database level +IF (SELECT is_cdc_enabled FROM sys.databases WHERE name = 'NBS_SRTE') = 0 +BEGIN + PRINT 'Enabling CDC for NBS_SRTE'; + EXEC sys.sp_cdc_enable_db; +END + +-- Enable for tables +DECLARE @tableName NVARCHAR(128); +DECLARE @enableCDCSQL NVARCHAR(MAX); + +DECLARE @tablesToEnable TABLE ( + TableName NVARCHAR(128) +); + +INSERT INTO @tablesToEnable (TableName) VALUES + ('Condition_code'), + ('Program_area_code'), + ('Language_code'), + ('State_code'), + ('Unit_code'), + ('Cntycity_code_value'), + ('Lab_result'), + ('Country_code'), + ('Labtest_loinc'), + ('ELR_XREF'), + ('Loinc_condition'), + ('Loinc_snomed_condition'), + ('Lab_test'), + ('Zip_code_value'), + ('Zipcnty_code_value'), + ('Lab_result_Snomed'), + ('Investigation_code'), + ('TotalIDM'), + ('IMRDBMapping'), + ('Anatomic_site_code'), + ('Jurisdiction_code'), + ('Lab_coding_system'), + ('City_code_value'), + ('LDF_page_set'), + ('LOINC_code'), + ('NAICS_Industry_code'), + ('Codeset_Group_Metadata'), + ('Country_Code_ISO'), + ('Occupation_code'), + ('Country_XREF'), + ('Standard_XREF'), + ('Code_value_clinical'), + ('Code_value_general'), + ('Race_code'), + ('Participation_type'), + ('Specimen_source_code'), + ('Snomed_code'), + ('State_county_code_value'), + ('State_model'), + ('Codeset'), + ('Jurisdiction_participation'), + ('Labtest_Progarea_Mapping'), + ('Treatment_code'), + ('Snomed_condition'); + +DECLARE cur CURSOR FOR SELECT TableName FROM @tablesToEnable; +OPEN cur; +FETCH NEXT FROM cur INTO @tableName; + +WHILE @@FETCH_STATUS = 0 +BEGIN + IF (SELECT is_tracked_by_cdc FROM sys.tables WHERE name = @tableName) = 0 + BEGIN + PRINT 'Enabling CDC for table ' + @tableName; + EXEC sys.sp_cdc_enable_table @source_schema = 'dbo', @source_name = @tableName, @role_name = NULL; + END + + FETCH NEXT FROM cur INTO @tableName; +END + +CLOSE cur; +DEALLOCATE cur; + + + diff --git a/containers/db/initialize/initialize.sh b/containers/db/initialize/initialize.sh deleted file mode 100755 index e94c077b6..000000000 --- a/containers/db/initialize/initialize.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env bash -set -e -BASE="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" - -# Start SQL Server in the background -echo "Starting SQL Server..." -sqlservr & -SQL_PID=$! - -# 2. Wait for SQL Server to be ready -echo "Waiting for SQL Server to accept connections..." -MAX_RETRIES=60 -count=0 -while [ $count -lt $MAX_RETRIES ]; do - if sqlcmd -C -S localhost -U sa -Q "SELECT 1" &> /dev/null; then - echo "SQL Server is ready." - break - fi - - # Check if the process is still running; fail fast if it died - if ! kill -0 $SQL_PID 2>/dev/null; then - echo "Error: SQL Server process exited unexpectedly." - exit 1 - fi - - echo "Waiting for SQL Server... ($count/$MAX_RETRIES)" - sleep 5 - count=$((count+1)) -done - -if [ $count -eq $MAX_RETRIES ]; then - echo "Timeout waiting for SQL Server to start." - kill -SIGTERM $SQL_PID - exit 1 -fi - -echo "*************************************************************************" -echo " Running NBS migrations" -echo "*************************************************************************" -# Run migrations as part of initialization to prevent liquibase errors -/var/data/run_migrations.sh ${DATABASE_VERSION} -echo "Migrations complete" - -echo "*************************************************************************" -echo " Initializing NBS databases" -echo "*************************************************************************" - -echo "Enabling CLR" -sqlcmd -C -S localhost -U sa -Q "EXEC sp_configure 'clr enabled', 1; RECONFIGURE;" - - -for sql in $(find "$BASE/restore.d" -iname "*.sql" | sort) ; -do - echo "Executing: $sql" - sqlcmd -C -S localhost -U sa -i "$sql" - - echo "Completed: $sql" -done - -echo "Enabling CDC for NBS_ODSE" -if ! sqlcmd -C -S localhost -U sa -Q "USE NBS_ODSE; EXEC sp_changedbowner 'sa'; EXEC sys.sp_cdc_enable_db;"; then - echo "Error enabling CDC for ODSE database" - exit 1 -fi - -for table in "Person" "Organization" "Observation" "Public_health_case" "Treatment" "state_defined_field_data" "Notification" "Interview" "Place" "CT_contact" "Auth_user" "Intervention" "Act_relationship"; do - echo "Enabling CDC for NBS_ODSE.$table" - sqlcmd -C -S localhost -U sa -Q "USE NBS_ODSE; EXEC sys.sp_cdc_enable_table @source_schema = 'dbo', @source_name = '$table', @role_name = NULL;" -done - -echo "Enabling CDC for NBS_SRTE" -if ! sqlcmd -C -S localhost -U sa -Q "USE NBS_SRTE; EXEC sp_changedbowner 'sa'; EXEC sys.sp_cdc_enable_db;"; then - echo "Error enabling CDC for the SRTE database" - exit 1 -fi -for table in "Condition_code" "Program_area_code" "Language_code" "State_code" "Unit_code" "Cntycity_code_value" "Lab_result" "Country_code" "Labtest_loinc" "ELR_XREF" "Loinc_condition" "Loinc_snomed_condition" "Lab_test" "Zip_code_value" "Zipcnty_code_value" "Lab_result_Snomed" "Investigation_code" "TotalIDM" "IMRDBMapping" "Anatomic_site_code" "Jurisdiction_code" "Lab_coding_system" "City_code_value" "LDF_page_set" "LOINC_code" "NAICS_Industry_code" "Codeset_Group_Metadata" "Country_Code_ISO" "Occupation_code" "Country_XREF" "Standard_XREF" "Code_value_clinical" "Code_value_general" "Race_code" "Participation_type" "Specimen_source_code" "Snomed_code" "State_county_code_value" "State_model" "Codeset" "Jurisdiction_participation" "Labtest_Progarea_Mapping" "Treatment_code" "Snomed_condition"; do - echo "Enabling CDC for NBS_SRTE.$table" - sqlcmd -C -S localhost -U sa -Q "USE NBS_SRTE; EXEC sys.sp_cdc_enable_table @source_schema = 'dbo', @source_name = '$table', @role_name = NULL;" -done - -echo "*************************************************************************" -echo " NBS databases ready. Shutting down..." -echo "*************************************************************************" - -# Send shutdown command -sqlcmd -C -S localhost -U sa -Q "SHUTDOWN WITH NOWAIT" || true - -# Wait for the background sqlservr process to exit -# Use '|| true' to prevent script failure if sqlservr exits with a non-zero code -wait $SQL_PID || echo "SQL Server process exited with code $?" - -echo "SQL Server stopped." -exit 0 \ No newline at end of file diff --git a/containers/db/initialize/restore.d/01-restore-modern.sql b/containers/db/initialize/restore.d/01-restore-modern.sql deleted file mode 100644 index 316bbab24..000000000 --- a/containers/db/initialize/restore.d/01-restore-modern.sql +++ /dev/null @@ -1,14 +0,0 @@ -use [master]; -go - ---------------------------------------------------------------------------------------------------- --- RDB_MODERN (Copy of RDB) ---------------------------------------------------------------------------------------------------- - -RESTORE DATABASE [RDB_MODERN] FROM DISK = N'/var/opt/database/initialize/restore.d/RDB.bak' WITH FILE = 1, -MOVE N'RDB' TO N'/var/opt/mssql/data/rdb_modern_data.mdf', -MOVE N'RDB_log' TO N'/var/opt/mssql/data/rdb_modern_log.ldf', NOUNLOAD, STATS = 10 -GO - -EXEC dbo.sp_dbcmptlevel @dbname=N'RDB_MODERN', @new_cmptlevel=120 -GO diff --git a/containers/db/initialize/restore.d/02-initialize-rdb-modern.sql b/containers/db/initialize/restore.d/02-initialize-rdb-modern.sql deleted file mode 100644 index 72a656bbb..000000000 --- a/containers/db/initialize/restore.d/02-initialize-rdb-modern.sql +++ /dev/null @@ -1,19 +0,0 @@ --- Insert into NBS_ODSE.NBS_Configuration to flag use of RDB_MODERN -INSERT INTO - NBS_ODSE.DBO.NBS_configuration ( - config_key, - config_value, - version_ctrl_nbr, - add_user_id, - add_time, - last_chg_user_id, - last_chg_time, - status_cd, - status_time - ) -VALUES - ('ENV', 'UAT', 1, 99999999, GETDATE(), 99999999, GETDATE(), 'A', GETDATE()); - --- Fix for missing columns -ALTER TABLE LDF_GROUP ADD BUSINESS_OBJECT_UID BIGINT NULL; -ALTER TABLE D_VACCINATION ADD VACCINATION_UID BIGINT NULL; \ No newline at end of file diff --git a/containers/db/initialize/restore.d/RDB.bak b/containers/db/initialize/restore.d/RDB.bak deleted file mode 100644 index 99ed5a26a..000000000 Binary files a/containers/db/initialize/restore.d/RDB.bak and /dev/null differ diff --git a/containers/db/initialize/restore.d/README.md b/containers/db/initialize/restore.d/README.md deleted file mode 100644 index 40538bf29..000000000 --- a/containers/db/initialize/restore.d/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Want to automatically restore data? - -Any `.sql` placed here will be restored during startup of the docker container in lexicographic order using `sqlcmd`. - -## Important paths - -The path to this directory as mounted by the docker container: - -``` -/var/opt/db-restore/restore.d -``` - -The path to mssql data within the docker container: - -``` -/var/opt/mssql/data -``` \ No newline at end of file diff --git a/containers/db/restore.sh b/containers/db/restore.sh deleted file mode 100755 index a43ea47ef..000000000 --- a/containers/db/restore.sh +++ /dev/null @@ -1,68 +0,0 @@ -#! /usr/bin/env bash -CONTAINER_NAME=di-mssql -DATABASE_NAME=nbs_odse - -while getopts ":c:d:f:" opt; do - case $opt in - c) - CONTAINER_NAME=$OPTARG - ;; - d) - DATABASE_NAME=$OPTARG - ;; - f) - FILE_PATH=$OPTARG - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - ;; - esac -done - -if [ -z $CONTAINER_NAME ] -then - echo "Usage: $0 [container name] [database name] [backup file name]" - exit 1 -fi - -if [ -z $DATABASE_NAME ] -then - echo "Usage: $0 [container name] [database name] [backup file name]" - exit 1 -fi - -if [ -z $FILE_PATH ] -then - echo "Usage: $0 [container name] [database name] [backup file name]" - exit 1 -fi - -# Check if the backup file can be found -if [ ! -f $FILE_PATH ] -then - echo "Backup file $FILE_PATH does not exist." - exit 1 -fi - -# Set bash to exit if any command fails -set -e -set -o pipefail - -FILE_NAME=$(basename $FILE_PATH) - -echo "Copying backup file $FILE_PATH to container '$CONTAINER_NAME'" -echo "Note: the container should already be running!" - -# Copy the file over to a special restore folder in the container, where the sqlcmd binary can access it -docker exec $CONTAINER_NAME mkdir -p /var/opt/mssql/restores -docker cp $FILE_PATH "$CONTAINER_NAME:/var/opt/mssql/restores/$FILE_NAME" -docker exec -u root $CONTAINER_NAME chown mssql "/var/opt/mssql/restores/$FILE_NAME" - -echo "Restoring database '$DATABASE_NAME' in container '$CONTAINER_NAME'..." - -# Restore the database with sqlcmd -docker exec -it "$CONTAINER_NAME" /opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -Q "RESTORE DATABASE [$DATABASE_NAME] FROM DISK = N'/var/opt/mssql/restores/$FILE_NAME' WITH FILE = 1, NOUNLOAD, REPLACE, RECOVERY, STATS = 5" - -echo "" -echo "Restored database '$DATABASE_NAME' in container '$CONTAINER_NAME' from file $FILE_PATH" -echo "Done!" \ No newline at end of file diff --git a/containers/debezium/odse_connector.json b/containers/debezium/odse_connector.json index 3b81feb8b..8544378a5 100644 --- a/containers/debezium/odse_connector.json +++ b/containers/debezium/odse_connector.json @@ -2,7 +2,7 @@ "name": "odse-connector", "config": { "connector.class": "io.debezium.connector.sqlserver.SqlServerConnector", - "database.hostname": "rtr-mssql", + "database.hostname": "nbs-mssql", "database.port": "1433", "database.user": "sa", "database.password": "PizzaIsGood33!", diff --git a/containers/debezium/odse_meta_connector.json b/containers/debezium/odse_meta_connector.json index 5c903496d..e23b5e07c 100644 --- a/containers/debezium/odse_meta_connector.json +++ b/containers/debezium/odse_meta_connector.json @@ -2,7 +2,7 @@ "name": "odse-meta-connector", "config": { "connector.class": "io.debezium.connector.sqlserver.SqlServerConnector", - "database.hostname": "rtr-mssql", + "database.hostname": "nbs-mssql", "database.port": "1433", "database.user": "sa", "database.password": "PizzaIsGood33!", diff --git a/containers/debezium/srte_connector.json b/containers/debezium/srte_connector.json index 9c2fcf03d..98aaaac95 100644 --- a/containers/debezium/srte_connector.json +++ b/containers/debezium/srte_connector.json @@ -2,7 +2,7 @@ "name": "srte-connector", "config": { "connector.class": "io.debezium.connector.sqlserver.SqlServerConnector", - "database.hostname": "rtr-mssql", + "database.hostname": "nbs-mssql", "database.port": "1433", "database.user": "sa", "database.password": "PizzaIsGood33!", diff --git a/containers/kafka-connect/mssql-connector.json b/containers/kafka-connect/mssql-connector.json index e576788bd..0f6f71725 100644 --- a/containers/kafka-connect/mssql-connector.json +++ b/containers/kafka-connect/mssql-connector.json @@ -5,7 +5,7 @@ "tasks.max": "1", "offset.flush.interval.ms": "60000", "batch.size": "200", - "connection.url": "jdbc:sqlserver://rtr-mssql:1433;databaseName=rdb_modern;encrypt=true;trustServerCertificate=true;", + "connection.url": "jdbc:sqlserver://nbs-mssql:1433;databaseName=rdb_modern;encrypt=true;trustServerCertificate=true;", "connection.user": "sa", "connection.password": "PizzaIsGood33!", "connection.pool.min_size": "1", diff --git a/containers/wildfly/Dockerfile b/containers/wildfly/Dockerfile deleted file mode 100644 index cc961c593..000000000 --- a/containers/wildfly/Dockerfile +++ /dev/null @@ -1,115 +0,0 @@ -FROM maven:3.9-amazoncorretto-8 AS nbs-source - -# update -RUN yum update -y -RUN yum install -y tar gzip hostname - -# install ant -WORKDIR /home -ADD https://dlcdn.apache.org/ant/binaries/apache-ant-1.10.14-bin.tar.gz . -RUN tar -zxvf "apache-ant-1.10.14-bin.tar.gz" -RUN rm apache-ant-1.10.14*.gz -ENV ANT_HOME=/home/apache-ant-1.10.14 - -# copy NBS source code -COPY builder/NEDSSDev ./NEDSSDev/ - -# Massage NEDSS source code -ENV NEDSS_HOME=/home/NEDSSDev -COPY builder/dependencies.xml . -RUN sed -i 's/PhcMartEtl.bat/PHCMartETL.bat/gi' "$NEDSS_HOME/pom.xml" -RUN sed -i "s##$(cat dependencies.xml)#g" "$NEDSS_HOME/pom-jar.xml" -RUN cp "$NEDSS_HOME/source/gov/cdc/nedss/webapp/nbs/resource/javascript/Globals.js" "$NEDSS_HOME/source/gov/cdc/nedss/webapp/nbs/resource/javascript/globals.js" - -# Data ingestion specific modificiations -RUN sed -i 's/ELR_IMPORTER_SCHEDULE_TO_RUN=NO/ELR_IMPORTER_SCHEDULE_TO_RUN=YES/gi' "$NEDSS_HOME/source/PropertyFiles/NEDSSBatchProcess.properties" -RUN sed -i 's/if (isProcessReadyToRun)/\/\/if (isProcessReadyToRun)/gi' "$NEDSS_HOME/source/gov/cdc/nedss/systemservice/scheduler/elr/elrscheduler/ELRScheduler.java" -RUN sed -i 's/nedss_elr_load/superuser/gi' "$NEDSS_HOME/source/gov/cdc/nedss/util/NEDSSConstants.java" -RUN sed -i 's/nedss_elr_load/superuser/gi' "$NEDSS_HOME/source/gov/cdc/nedss/systemservice/ejb/edxdocumentejb/labutil/HL7CommonLabUtil.java" -RUN sed -i 's/msCommand.nbsSecurityLogin(userName, userName)/msCommand.nbsSecurityLogin("superuser", "superuser")/gi' "$NEDSS_HOME/source/gov/cdc/nedss/systemservice/ejb/edxdocumentejb/labutil/EdxAutoLabInvFromInterface.java" - - -WORKDIR $NEDSS_HOME - -# Clean container dist directory -RUN rm -rf build - -ENV JBOSS_HOME=build -ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=ISO-8859-1 -RUN /usr/share/maven/bin/mvn package -DskipTests - -#Open JDK build from amazon https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/docker-install.html -FROM amazoncorretto:8 - -#=============================================================================================================== -# Installs -#=============================================================================================================== -RUN yum update -y && yum -y install xmlstarlet saxon augeas bsdtar unzip xz gzip tar shadow-utils emacs && yum clean all - -#=============================================================================================================== -# Set Additional Environment Variables -#=============================================================================================================== -# ENV LANG en_US.utf8 - -ENV JBOSS_HOME=/opt/jboss/wildfly-10.0.0.Final -ENV JBOSS_BASE_DIR=${JBOSS_HOME}/nedssdomain -ENV JBOSS_CONFIG_DIR=${JBOSS_BASE_DIR}/configuration -ENV NEDSS_DIR=${JBOSS_BASE_DIR}/Nedss -ENV JBOSS_ENDORSED_DIRS=${JBOSS_BASE_DIR}/lib/Endorsed - -# This is hardcoded in as log dump, so keeping this path absolute -ENV JBOSS_LOG_DIR=${JBOSS_BASE_DIR}/log - -# Create user (USER CURRENTLY NOT IN USE) -RUN groupadd -r jboss -g 1000 && useradd -u 1000 -r -g jboss -m -d /opt/jboss -c "JBoss user" jboss && chmod 755 /opt/jboss - -#=============================================================================================================== -# Set up directories -#=============================================================================================================== -RUN mkdir /log -RUN chmod a+w log/ -RUN touch /log/nedss.log - -#=============================================================================================================== -# Download wildfly -#=============================================================================================================== - -RUN mkdir -p "$JBOSS_HOME" -WORKDIR ${JBOSS_HOME}/.. -ADD https://download.jboss.org/wildfly/10.0.0.Final/wildfly-10.0.0.Final.tar.gz . -RUN tar -zxvf wildfly-10.0.0.Final.tar.gz - -#=============================================================================================================== -# Copy wildfly configuration -#=============================================================================================================== - -RUN mkdir "${JBOSS_HOME}/nedssdomain" -COPY "./config/wildfly" "${JBOSS_HOME}/nedssdomain/configuration" - -#=============================================================================================================== -# Copy web application from build dist to wildfly -#=============================================================================================================== - -COPY --from=nbs-source /home/NEDSSDev/build/ ${JBOSS_HOME} -ADD ./pagemanagement.zip ${NEDSS_DIR}/pagemanagement.zip -RUN mkdir -p ${JBOSS_HOME}/nedssdomain/Nedss/ -RUN unzip "${NEDSS_DIR}/pagemanagement.zip" -d "${JBOSS_HOME}/nedssdomain/Nedss/" - - -#=============================================================================================================== -# FILE Modifications (Require Root Access due to file locations) -WORKDIR ${JBOSS_HOME} -# Create a copy for debugging and modify existing routes -RUN cp ./nedssdomain/configuration/standalone.xml ./nedssdomain/configuration/standalone-orginal.txt - -# A Bit messy, but add in required -RUN sed -i '314i -Dnbs.dir=\\""\$NEDSS_DIR"\\" \\' ./bin/standalone.sh -#=============================================================================================================== - - -# USER root -# RUN chown -R jboss:jboss . -RUN chmod +x bin/standalone.sh -# USER jboss:jboss - -CMD ["./bin/standalone.sh", "-bmanagement", "0.0.0.0", "-b", "0.0.0.0","--debug"] diff --git a/containers/wildfly/builder/dependencies.xml b/containers/wildfly/builder/dependencies.xml deleted file mode 100644 index 647d3f2da..000000000 --- a/containers/wildfly/builder/dependencies.xml +++ /dev/null @@ -1 +0,0 @@ -xercesxercesImpl2.11.0providedxalanxalan2.7.1provided \ No newline at end of file diff --git a/containers/wildfly/config/wildfly/application-roles.properties b/containers/wildfly/config/wildfly/application-roles.properties deleted file mode 100644 index 43e558934..000000000 --- a/containers/wildfly/config/wildfly/application-roles.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# Properties declaration of users roles for the realm 'ApplicationRealm' which is the default realm -# for application services on a new installation. -# -# This includes the following protocols: remote ejb, remote jndi, web, remote jms -# -# Users can be added to this properties file at any time, updates after the server has started -# will be automatically detected. -# -# The format of this file is as follows: - -# username=role1,role2,role3 -# -# A utility script is provided which can be executed from the bin folder to add the users: - -# - Linux -# bin/add-user.sh -# -# - Windows -# bin\add-user.bat -# -# The following illustrates how an admin user could be defined. -# -#admin=PowerUser,BillingAdmin, -#guest=guest diff --git a/containers/wildfly/config/wildfly/application-users.properties b/containers/wildfly/config/wildfly/application-users.properties deleted file mode 100644 index 24889c3f3..000000000 --- a/containers/wildfly/config/wildfly/application-users.properties +++ /dev/null @@ -1,25 +0,0 @@ -# -# Properties declaration of users for the realm 'ApplicationRealm' which is the default realm -# for application services on a new installation. -# -# This includes the following protocols: remote ejb, remote jndi, web, remote jms -# -# Users can be added to this properties file at any time, updates after the server has started -# will be automatically detected. -# -# The format of this realm is as follows: - -# username=HEX( MD5( username ':' realm ':' password)) -# -# A utility script is provided which can be executed from the bin folder to add the users: - -# - Linux -# bin/add-user.sh -# -# - Windows -# bin\add-user.bat -# -#$REALM_NAME=ApplicationRealm$ This line is used by the add-user utility to identify the realm name already used in this file. -# -# The following illustrates how an admin user could be defined, this -# is for illustration only and does not correspond to a usable password. -# -#admin=2a0923285184943425d1f53ddd58ec7a diff --git a/containers/wildfly/config/wildfly/logging.properties b/containers/wildfly/config/wildfly/logging.properties deleted file mode 100644 index d09cf8e28..000000000 --- a/containers/wildfly/config/wildfly/logging.properties +++ /dev/null @@ -1,44 +0,0 @@ -# Note this file has been generated and will be overwritten if a -# logging subsystem has been defined in the XML configuration. - - -# Additional loggers to configure (the root logger is always configured) -loggers=sun.rmi,org.jboss.as.config,com.arjuna - -logger.level=ERROR -logger.handlers=FILE,CONSOLE - -logger.sun.rmi.level=WARN -logger.sun.rmi.useParentHandlers=true - -logger.org.jboss.as.config.level=DEBUG -logger.org.jboss.as.config.useParentHandlers=true - -logger.com.arjuna.level=WARN -logger.com.arjuna.useParentHandlers=true - -handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler -handler.CONSOLE.level=ERROR -handler.CONSOLE.formatter=COLOR-PATTERN -handler.CONSOLE.properties=enabled,autoFlush,target -handler.CONSOLE.enabled=true -handler.CONSOLE.autoFlush=true -handler.CONSOLE.target=SYSTEM_OUT - -handler.FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler -handler.FILE.level=ALL -handler.FILE.formatter=PATTERN -handler.FILE.properties=append,autoFlush,enabled,suffix,fileName -handler.FILE.append=true -handler.FILE.autoFlush=true -handler.FILE.enabled=true -handler.FILE.suffix=.yyyy-MM-dd -handler.FILE.fileName=C\:\\wildfly-10.0.0.Final\\bin\\..\\nedssdomain\\log\\server.log - -formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter -formatter.PATTERN.properties=pattern -formatter.PATTERN.pattern=%d{yyyy-MM-dd HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n - -formatter.COLOR-PATTERN=org.jboss.logmanager.formatters.PatternFormatter -formatter.COLOR-PATTERN.properties=pattern -formatter.COLOR-PATTERN.pattern=%K{level}%d{HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n diff --git a/containers/wildfly/config/wildfly/mgmt-groups.properties b/containers/wildfly/config/wildfly/mgmt-groups.properties deleted file mode 100644 index 44742a83c..000000000 --- a/containers/wildfly/config/wildfly/mgmt-groups.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Properties declaration of users groups for the realm 'ManagementRealm'. -# -# This is used for domain management, users groups membership information is used to assign the user -# specific management roles. -# -# Users can be added to this properties file at any time, updates after the server has started -# will be automatically detected. -# -# The format of this file is as follows: - -# username=role1,role2,role3 -# -# A utility script is provided which can be executed from the bin folder to add the users: - -# - Linux -# bin/add-user.sh -# -# - Windows -# bin\add-user.bat -# -# The following illustrates how an admin user could be defined. -# -#admin=PowerUser,BillingAdmin, \ No newline at end of file diff --git a/containers/wildfly/config/wildfly/mgmt-users.properties b/containers/wildfly/config/wildfly/mgmt-users.properties deleted file mode 100644 index 1eb477657..000000000 --- a/containers/wildfly/config/wildfly/mgmt-users.properties +++ /dev/null @@ -1,27 +0,0 @@ -# -# Properties declaration of users for the realm 'ManagementRealm' which is the default realm -# for new installations. Further authentication mechanism can be configured -# as part of the in standalone.xml. -# -# Users can be added to this properties file at any time, updates after the server has started -# will be automatically detected. -# -# By default the properties realm expects the entries to be in the format: - -# username=HEX( MD5( username ':' realm ':' password)) -# -# A utility script is provided which can be executed from the bin folder to add the users: - -# - Linux -# bin/add-user.sh -# -# - Windows -# bin\add-user.bat -# -#$REALM_NAME=ManagementRealm$ This line is used by the add-user utility to identify the realm name already used in this file. -# -# On start-up the server will also automatically add a user $local - this user is specifically -# for local tools running against this AS installation. -# -# The following illustrates how an admin user could be defined, this -# is for illustration only and does not correspond to a usable password. -# -#admin=2a0923285184943425d1f53ddd58ec7a diff --git a/containers/wildfly/config/wildfly/server.keystore b/containers/wildfly/config/wildfly/server.keystore deleted file mode 100644 index 662a42d44..000000000 Binary files a/containers/wildfly/config/wildfly/server.keystore and /dev/null differ diff --git a/containers/wildfly/config/wildfly/standalone-full-ha.xml b/containers/wildfly/config/wildfly/standalone-full-ha.xml deleted file mode 100644 index 1ca5e836b..000000000 --- a/containers/wildfly/config/wildfly/standalone-full-ha.xml +++ /dev/null @@ -1,506 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - h2 - - sa - sa - - - - - org.h2.jdbcx.JdbcDataSource - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${jboss.bind.address:127.0.0.1} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/containers/wildfly/config/wildfly/standalone-full.xml b/containers/wildfly/config/wildfly/standalone-full.xml deleted file mode 100644 index 18406c4bd..000000000 --- a/containers/wildfly/config/wildfly/standalone-full.xml +++ /dev/null @@ -1,445 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - h2 - - sa - sa - - - - - org.h2.jdbcx.JdbcDataSource - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${jboss.bind.address:127.0.0.1} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/containers/wildfly/config/wildfly/standalone-ha.xml b/containers/wildfly/config/wildfly/standalone-ha.xml deleted file mode 100644 index 96c363dd2..000000000 --- a/containers/wildfly/config/wildfly/standalone-ha.xml +++ /dev/null @@ -1,460 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - h2 - - sa - sa - - - - - org.h2.jdbcx.JdbcDataSource - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${jboss.bind.address:127.0.0.1} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/containers/wildfly/config/wildfly/standalone.xml b/containers/wildfly/config/wildfly/standalone.xml deleted file mode 100644 index 41151c0d4..000000000 --- a/containers/wildfly/config/wildfly/standalone.xml +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - h2 - - sa - sa - - - - jdbc:sqlserver://rtr-mssql:1433;SelectMethod=direct;DatabaseName=nbs_odse - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://rtr-mssql:1433;SelectMethod=direct;DatabaseName=nbs_msgoute - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://rtr-mssql:1433;SelectMethod=direct;DatabaseName=nbs_msgine - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://rtr-mssql:1433;SelectMethod=direct;DatabaseName=nbs_msgoute - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://rtr-mssql:1433;SelectMethod=direct;DatabaseName=rdb - sqlserver - - 75 - 150 - - - nbs_rdb - rdb - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://rtr-mssql:1433;SelectMethod=direct;DatabaseName=nbs_srte - sqlserver - - 75 - 150 - Gracefully - - - srte_admin - admin - - - - - - 5000 - 15 - - - 10 - - - - - org.h2.jdbcx.JdbcDataSource - - - com.microsoft.sqlserver.jdbc.SQLServerXADataSource - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${jboss.bind.address:127.0.0.1} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/containers/wildfly/config/wildfly/standalone_xml_history/standalone.boot.xml b/containers/wildfly/config/wildfly/standalone_xml_history/standalone.boot.xml deleted file mode 100644 index 8b1dd77f1..000000000 --- a/containers/wildfly/config/wildfly/standalone_xml_history/standalone.boot.xml +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - h2 - - sa - sa - - - - jdbc:sqlserver://localhost\singhm;SelectMethod=direct;DatabaseName=nbs_odse - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\singhm;SelectMethod=direct;DatabaseName=nbs_msgoute - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\singhm;SelectMethod=direct;DatabaseName=nbs_msgine - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\singhm;SelectMethod=direct;DatabaseName=nbs_msgoute - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\singhm;SelectMethod=direct;DatabaseName=rdb - sqlserver - - 75 - 150 - - - nbs_rdb - rdb - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\singhm;SelectMethod=direct;DatabaseName=nbs_srte - sqlserver - - 75 - 150 - Gracefully - - - srte_admin - admin - - - - - - 5000 - 15 - - - 10 - - - - - org.h2.jdbcx.JdbcDataSource - - - com.microsoft.sqlserver.jdbc.SQLServerXADataSource - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${jboss.bind.address:127.0.0.1} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/containers/wildfly/config/wildfly/standalone_xml_history/standalone.initial.xml b/containers/wildfly/config/wildfly/standalone_xml_history/standalone.initial.xml deleted file mode 100644 index ae6773a46..000000000 --- a/containers/wildfly/config/wildfly/standalone_xml_history/standalone.initial.xml +++ /dev/null @@ -1,570 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - h2 - - sa - sa - - - - jdbc:sqlserver://localhost\SINGHM;SelectMethod=direct;DatabaseName=nbs_odse - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\SINGHM;SelectMethod=direct;DatabaseName=nbs_msgoute - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\SINGHM;SelectMethod=direct;DatabaseName=nbs_msgine - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\SINGHM;SelectMethod=direct;DatabaseName=nbs_msgoute - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\SINGHM;SelectMethod=direct;DatabaseName=rdb - sqlserver - - 75 - 150 - - - nbs_rdb - rdb - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\SINGHM;SelectMethod=direct;DatabaseName=nbs_srte - sqlserver - - 75 - 150 - Gracefully - - - srte_admin - admin - - - - - - 5000 - 15 - - - 10 - - - - - org.h2.jdbcx.JdbcDataSource - - - com.microsoft.sqlserver.jdbc.SQLServerXADataSource - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${jboss.bind.address:127.0.0.1} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/containers/wildfly/config/wildfly/standalone_xml_history/standalone.last.xml b/containers/wildfly/config/wildfly/standalone_xml_history/standalone.last.xml deleted file mode 100644 index 8b1dd77f1..000000000 --- a/containers/wildfly/config/wildfly/standalone_xml_history/standalone.last.xml +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE - h2 - - sa - sa - - - - jdbc:sqlserver://localhost\singhm;SelectMethod=direct;DatabaseName=nbs_odse - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\singhm;SelectMethod=direct;DatabaseName=nbs_msgoute - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\singhm;SelectMethod=direct;DatabaseName=nbs_msgine - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\singhm;SelectMethod=direct;DatabaseName=nbs_msgoute - sqlserver - - 75 - 150 - Gracefully - - - nbs_ods - ods - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\singhm;SelectMethod=direct;DatabaseName=rdb - sqlserver - - 75 - 150 - - - nbs_rdb - rdb - - - - - - 5000 - 15 - - - 10 - - - - jdbc:sqlserver://localhost\singhm;SelectMethod=direct;DatabaseName=nbs_srte - sqlserver - - 75 - 150 - Gracefully - - - srte_admin - admin - - - - - - 5000 - 15 - - - 10 - - - - - org.h2.jdbcx.JdbcDataSource - - - com.microsoft.sqlserver.jdbc.SQLServerXADataSource - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${jboss.bind.address:127.0.0.1} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/containers/wildfly/pagemanagement.zip b/containers/wildfly/pagemanagement.zip deleted file mode 100644 index 35df55ea3..000000000 Binary files a/containers/wildfly/pagemanagement.zip and /dev/null differ diff --git a/docker-compose.yaml b/docker-compose.yaml index 0a5f2efe8..83a6f6cc4 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,35 +1,28 @@ services: mssql: + image: ghcr.io/cdcent/nedssdb:latest platform: linux/amd64 - container_name: rtr-mssql - build: - context: ./containers/db - args: - - DATABASE_VERSION=6.0.17.1 - - DEPLOY_ADMIN_PASSWORD=${DEPLOY_ADMIN_PASSWORD:-db_deploy_admin} + container_name: nbs-mssql environment: + - DATABASE_VERSION=6.0.18.1 + - DEPLOY_ADMIN_PASSWORD=${DATABASE_PASSWORD:-PizzaIsGood33!} - DATABASE_PASSWORD=${DATABASE_PASSWORD:-PizzaIsGood33!} + - LIQUIBASE_USER_PASSWORD=${LIQUIBASE_USER_PASSWORD:-db_deploy_admin} + volumes: + - ./containers/db/initialize:/docker-entrypoint-initdb.d/ ports: - 3433:1433 - networks: - - rtr - healthcheck: - test: test -f /tmp/db_ready && bash -c 'echo > /dev/tcp/localhost/1433' || exit 1 - interval: 5s - timeout: 5s - retries: 5 - start_period: 5s wildfly: - build: ./containers/wildfly - image: nbs-classic:6.0.16 + image: ghcr.io/cdcent/nedssdev:6.0.18.1 + platform: linux/amd64 container_name: rtr-wildfly + depends_on: + - mssql ports: - "9991:9990" - "7003:7001" - "8788:8787" - networks: - - rtr zookeeper: image: confluentinc/cp-zookeeper:7.3.0 @@ -40,8 +33,6 @@ services: environment: ZOOKEEPER_CLIENT_PORT: 2181 ZOOKEEPER_TICK_TIME: 2000 - networks: - - rtr kafka: image: confluentinc/cp-kafka:7.3.0 @@ -62,8 +53,6 @@ services: KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181" - networks: - - rtr kafka-connect: container_name: kafka-connect @@ -86,8 +75,6 @@ services: CONNECT_KEY_CONVERTER: "org.apache.kafka.connect.json.JsonConverter" CONNECT_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter" CONNECT_REST_ADVERTISED_HOST_NAME: "kafka-connect" - networks: - - rtr debezium: image: debezium/connect:2.4 @@ -115,21 +102,17 @@ services: CONFIG_STORAGE_REPLICATION_FACTOR: 1 OFFSET_STORAGE_REPLICATION_FACTOR: 1 STATUS_STORAGE_REPLICATION_FACTOR: 1 - networks: - - rtr liquibase: build: dockerfile: ./liquibase-service/Dockerfile.local environment: - DB_USERNAME=db_deploy_admin - - DB_PASSWORD=${DEPLOY_ADMIN_PASSWORD:-db_deploy_admin} - - DB_HOST=rtr-mssql + - DB_PASSWORD=${LIQUIBASE_USER_PASSWORD:-db_deploy_admin} + - DB_HOST=nbs-mssql depends_on: mssql: condition: service_healthy - networks: - - rtr investigation-service: build: @@ -137,10 +120,8 @@ services: environment: - DB_USERNAME=investigation_service_rdb - DB_PASSWORD=investigation_service - - DB_HOST=jdbc:sqlserver://rtr-mssql:1433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true; + - DB_HOST=jdbc:sqlserver://nbs-mssql:1433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true; - KAFKA_BOOTSTRAP_SERVER=kafka:29092 - networks: - - rtr depends_on: - kafka @@ -150,10 +131,8 @@ services: environment: - DB_USERNAME=ldf_service_rdb - DB_PASSWORD=ldf_service - - DB_HOST=jdbc:sqlserver://rtr-mssql:1433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true; + - DB_HOST=jdbc:sqlserver://nbs-mssql:1433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true; - KAFKA_BOOTSTRAP_SERVER=kafka:29092 - networks: - - rtr depends_on: - kafka @@ -163,10 +142,8 @@ services: environment: - DB_USERNAME=observation_service_rdb - DB_PASSWORD=observation_service - - DB_HOST=jdbc:sqlserver://rtr-mssql:1433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true; + - DB_HOST=jdbc:sqlserver://nbs-mssql:1433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true; - KAFKA_BOOTSTRAP_SERVER=kafka:29092 - networks: - - rtr depends_on: - kafka @@ -176,10 +153,8 @@ services: environment: - DB_USERNAME=organization_service_rdb - DB_PASSWORD=organization_service - - DB_HOST=jdbc:sqlserver://rtr-mssql:1433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true; + - DB_HOST=jdbc:sqlserver://nbs-mssql:1433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true; - KAFKA_BOOTSTRAP_SERVER=kafka:29092 - networks: - - rtr depends_on: - kafka @@ -189,10 +164,8 @@ services: environment: - DB_USERNAME=person_service_rdb - DB_PASSWORD=person_service - - DB_HOST=jdbc:sqlserver://rtr-mssql:1433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true; + - DB_HOST=jdbc:sqlserver://nbs-mssql:1433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true; - KAFKA_BOOTSTRAP_SERVER=kafka:29092 - networks: - - rtr depends_on: - kafka @@ -202,14 +175,7 @@ services: environment: - DB_USERNAME=post_processing_service_rdb - DB_PASSWORD=post_processing_service - - DB_HOST=jdbc:sqlserver://rtr-mssql:1433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true; + - DB_HOST=jdbc:sqlserver://nbs-mssql:1433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true; - KAFKA_BOOTSTRAP_SERVER=kafka:29092 - networks: - - rtr depends_on: - kafka - -networks: - rtr: - name: rtr - driver: bridge diff --git a/documentation/DevSetup.md b/documentation/DevSetup.md index 4a0aa363e..5d7f546c6 100644 --- a/documentation/DevSetup.md +++ b/documentation/DevSetup.md @@ -76,17 +76,8 @@ docker compose up investigation-service ldfdata-service observation-service orga ### Build NBS 6 WildFly container -Run the `build_classic.sh` script to pull the NBS 6 source code and build a WildFly container. - -```sh -./containers/build_classic.sh -``` - -OR manually clone the NBS 6 repository to the proper directory and build docker container - ```sh -git clone -b lts/6.0.17 git@github.com:cdcent/NEDSSDev.git containers/wildfly/builder/NEDSSDev -docker compose up wildfly --build -d +docker compose up wildfly -d ``` ### Verifying functionality diff --git a/env.sample b/env.sample index cbffb43dc..34f33bb09 100644 --- a/env.sample +++ b/env.sample @@ -1,2 +1,2 @@ DATABASE_PASSWORD=PizzaIsGood33! -DB_VERSION=6.0.17.1 \ No newline at end of file +LIQUIBASE_USER_PASSWORD=db_deploy_admin diff --git a/observation-service/README.md b/observation-service/README.md index 7701eb7a4..624880dd9 100644 --- a/observation-service/README.md +++ b/observation-service/README.md @@ -14,9 +14,9 @@ spring: username: ${DB_USERNAME:sa} url: ${DB_HOST:jdbc:sqlserver://localhost:3433;databaseName=NBS_ODSE;encrypt=true;trustServerCertificate=true;} ``` -2. Ensure the `kafka` and `rtr-mssql` containers running. You likely want all your RTR containers running for complete testing! +2. Ensure the `kafka` and `nbs-mssql` containers running. You likely want all your RTR containers running for complete testing! ```shell -docker ps -a -f "name=kafka$" -f "name=rtr-mssql$" +docker ps -a -f "name=kafka$" -f "name=nbs-mssql$" ``` 3. In the root of this repository execute the following command so the service uses `application-local.yaml`. ```shell diff --git a/performance-testing/README.md b/performance-testing/README.md index b25017422..c17f844ac 100644 --- a/performance-testing/README.md +++ b/performance-testing/README.md @@ -4,7 +4,7 @@ This directory contains tools to add data intended to test the performance and a ## Data generation -`generate.py` : create fake ELRs +`generate.py` : create fake ELRs `convert.py` : convert an ELR into NBS XML format @@ -63,25 +63,13 @@ for i in *sql; do; sqlcmd -U 'superuser' -P [PASSWORD] -i $i; echo $i; done # a ``` -This will add the ELRs to the NBS_INTERFACE table in the NBS_MSGOUTE database with status marked as `QUEUED`. The local NBS 6 dev environment is configured to automatically import the queued ELRs into the ODSE database every few minutes. (See [https://github.com/CDCgov/NEDSS-DataReporting/blob/main/containers/wildfly/Dockerfile](https://github.com/CDCgov/NEDSS-DataReporting/blob/main/containers/wildfly/Dockerfile)). So you should soon see the data appear. New patients will be created, and (unless workflow decision procedures are configured) the ELRs will be dropped in either of two queues: Documents Requiring Review or Documents Requiring Security Assignment. +This will add the ELRs to the NBS_INTERFACE table in the NBS_MSGOUTE database with status marked as `QUEUED`. The `ELRImporter.sh` script should then be executed to process the ELRs. -### ELRImporter batch process - -If necessary, it is also possible to force the ELR importer to run immediately. -In the windows development environments the batch process can usually be found here: - -``` -D:\wildfly-10.0.0.Final\nedssdomain\Nedss\BatchFiles\ELRImporter.bat +```sh +docker exec -it rtr-wildfly /opt/jboss/wildfly/nedssdomain/Nedss/BatchFiles/ELRImporter.sh ``` -The batch process can also be triggered when running locally. The shell version of the batch process in included in more recent NBS 6 versions (6.0.17 and later). - -``` -docker exec wildfly /opt/jboss/wildfly-10.0.0.Final/nedssdomain/Nedss/BatchFiles/ELRImporter.sh # import data to NBS_ODSE - -``` - -Note that the batch process defaults to using the `nedss_elr_load` user. Depending on the environment, this user may need extra permissions. +Once the script is run you should soon see the data appear. New patients will be created, and (unless workflow decision procedures are configured) the ELRs will be dropped in either of two queues: Documents Requiring Review or Documents Requiring Security Assignment. ### Workflow decision support @@ -100,4 +88,3 @@ Note that, depending on the completeness of the database snapshot, errors may be - Add preliminary ELRs and ELR updates, not just final ELRs - Add EICR generation to add more data - Update the local database snapshots to contain full data for page builder question prepopulation - diff --git a/post-processing-service/README.md b/post-processing-service/README.md index a585c7802..5d54cebc2 100644 --- a/post-processing-service/README.md +++ b/post-processing-service/README.md @@ -14,9 +14,9 @@ spring: username: ${DB_USERNAME:sa} url: ${DB_HOST:jdbc:sqlserver://localhost:3433;databaseName=RDB_MODERN;encrypt=true;trustServerCertificate=true;} ``` -2. Ensure the `kafka` and `rtr-mssql` containers running. You likely want all your RTR containers running for complete testing! +2. Ensure the `kafka` and `nbs-mssql` containers running. You likely want all your RTR containers running for complete testing! ```shell -docker ps -a -f "name=kafka$" -f "name=rtr-mssql$" +docker ps -a -f "name=kafka$" -f "name=nbs-mssql$" ``` 3. In the root of this repository execute the following command (this service is configured to run in debug mode on port 17070 in `build.gradle` by previous dev team). ```shell