Skip to content

Instantly share code, notes, and snippets.

@ajmazurie
Created October 20, 2016 19:25
Show Gist options
  • Save ajmazurie/1ff080a4dcbee815b21076fc43d883ef to your computer and use it in GitHub Desktop.
Save ajmazurie/1ff080a4dcbee815b21076fc43d883ef to your computer and use it in GitHub Desktop.
Startup script for OHDSI Broadsee
#!/bin/bash
PGSCHEMA=${1:-public}; PGDATABASE=${PGDATABASE:-postgres}
PGHOST=${PGHOST:-localhost}; PGPORT=${PGPORT:-5432}
PGUSER=${PGUSER:-postgres}; PGPASSWORD=${PGPASSWORD:-postgres}
PGURI="postgresql://${PGHOST}:${PGPORT}/${PGDATABASE}"
tmp_docker_compose="docker-compose.yml"
cat > ${tmp_docker_compose} <<EOB
version: '2'
services:
"methods_library":
image: "ohdsi/broadsea-methodslibrary"
ports:
- "8787:8787"
- "6311:6311"
"webtools":
image: "ohdsi/broadsea-webtools"
ports:
- "8080:8080"
volumes:
- .:/tmp/drivers/:ro
- .:/tmp/achilles-data-reports/:ro
environment:
- WEBAPI_URL="http://localhost:8080"
- env="webapi-postgresql"
- datasource.driverClassName="org.postgresql.Driver"
- datasource.url="jdbc:postgresql://${PGHOST}:${PGPORT}/${PGDATABASE}"
- datasource.cdm.schema="${PGSCHEMA}"
- datasource.ohdsi.schema="ohdsi"
- datasource.username="${PGUSER}"
- datasource.password="${PGPASSWORD}"
- spring.jpa.properties.hibernate.default_schema="ohdsi"
- spring.batch.repository.tableprefix=ohdsi.BATCH_
- flyway.datasource.driverClassName="org.postgresql.Driver"
- flyway.datasource.url="jdbc:${PGURI}"
- flyway.schemas="ohdsi"
- flyway.placeholders.ohdsiSchema="ohdsi"
- flyway.datasource.username="${PGUSER}"
- flyway.datasource.password="${PGPASSWORD}"
- flyway.locations="classpath:db/migration/postgresql"
EOB
tmp_source_daimon="source_source_daimon.sql"
cat > ${tmp_source_daimon} <<EOB
-- remove any previously added database connection configuration data
TRUNCATE ohdsi.source;
TRUNCATE ohdsi.source_daimon;
-- OHDSI CDM source
INSERT INTO ohdsi.source(
source_id,
source_name,
source_key,
source_connection,
source_dialect)
VALUES (1, 'OHDSI CDM V5 Database', 'OHDSI-CDMV5',
'jdbc:${PGURI}?user=${PGUSER}&password=${PGPASSWORD}',
'postgresql');
-- CDM daimon
INSERT INTO ohdsi.source_daimon(
source_daimon_id,
source_id,
daimon_type,
table_qualifier,
priority)
VALUES (1, 1, 0, '${PGSCHEMA}', 2);
-- VOCABULARY daimon
INSERT INTO ohdsi.source_daimon(
source_daimon_id,
source_id,
daimon_type,
table_qualifier,
priority)
VALUES (2, 1, 1, '${PGSCHEMA}', 2);
-- RESULTS daimon
INSERT INTO ohdsi.source_daimon(
source_daimon_id,
source_id,
daimon_type,
table_qualifier,
priority)
VALUES (3, 1, 2, 'ohdsi', 2);
-- EVIDENCE daimon
INSERT INTO ohdsi.source_daimon(
source_daimon_id,
source_id,
daimon_type,
table_qualifier,
priority)
VALUES (4, 1, 3, 'ohdsi', 2);
EOB
docker-compose --file ${tmp_docker_compose} --project-name "broadsee" up
rm ${tmp_docker_compose}
rm ${tmp_source_daimon}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment