Skip to content

Commit 318cc95

Browse files
dmitryschrisknoll
authored andcommitted
Add Development Quick Start Guide and settings.xml file ready to be used with docker postgres container
1 parent 18e5d7a commit 318cc95

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,24 @@ It was chosen to use embedded PG instead of H2 for unit tests since H2 doesn't s
7878
- WebAPI follows [Semantic versioning](https://semver.org/);
7979
- Only Non-SNAPSHOT dependencies should be presented in POM.xml on release branches/tags.
8080

81+
### Development Quick Start Guide
82+
83+
To start the application locally, the following quick steps (all commands are executed from repository root directory)
84+
85+
1. Ensure that you have the following tools installed: Java 1.8, maven (check via `mvn -v`), docker-ce (check via `docker -v`), psql command line client
86+
(check via psql --version) or other tool that allows to connect to postgres DB.
87+
2. Run `mvn clean install` and make sure it completes successfully, resolve dependency issues if any.
88+
3. Create a new database in docker: `docker create --name postgres-webapi -p 8432:5432 -e POSTGRES_PASSWORD=ohdsi postgres:15.0-alpine`.
89+
4. Start DB container: `docker start postgres-webapi`.
90+
Verify that you can connect via psql console (`PGPASSWORD='ohdsi' psql -d postgresql://localhost:8432/?user=postgres`).
91+
5. If your default java version is too high (e.g. 17), set JAVA_HOME to point to 1.8 installaction, for example `export JAVA_HOME=/usr/lib/jvm/zulu8-ca-amd64`
92+
6. Start WebAPI `mvn clean install spring-boot:run -Dmaven.test.skip=true -P webapi-postgresql -s src/dev/settings.xml -f pom.xml`
93+
7. Log in with the username of your liking
94+
8. Grant this newly created user admin privileges by running the following sql `INSERT INTO sec_user_role (user_id, role_id, origin) VALUES (1000, 2, 'SYSTEM');`
95+
and log in again.
96+
97+
At this point you have the application running and admin account operational. To actually use it, additional steps are required to set up privileges
98+
and at least one CDM database. They are covered in the respective documentation sections.
99+
81100
## License
82101
OHDSI WebAPI is licensed under Apache License 2.0

dev/settings.xml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- Sample ready-to-use configuration file for Maven to configure WebAPI in development environment. -->
3+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
4+
<profiles>
5+
<profile>
6+
<id>webapi-postgresql</id>
7+
<properties>
8+
<datasource.driverClassName>org.postgresql.Driver</datasource.driverClassName>
9+
<datasource.url>jdbc:postgresql://localhost:8432/</datasource.url>
10+
<datasource.username>postgres</datasource.username>
11+
<datasource.password>ohdsi</datasource.password>
12+
<datasource.dialect>postgresql</datasource.dialect>
13+
<datasource.ohdsi.schema>public</datasource.ohdsi.schema>
14+
<flyway.datasource.driverClassName>${datasource.driverClassName}</flyway.datasource.driverClassName>
15+
<flyway.datasource.url>${datasource.url}</flyway.datasource.url>
16+
<flyway.datasource.username>${datasource.username}</flyway.datasource.username>
17+
<flyway.datasource.password>${datasource.password}</flyway.datasource.password>
18+
<flyway.locations>classpath:db/migration/postgresql</flyway.locations>
19+
20+
<security.enabled>true</security.enabled>
21+
<security.provider>AtlasRegularSecurity</security.provider>
22+
<security.origin>http://localhost:8081</security.origin>
23+
<!--
24+
'password'. Obviously not secure in any way, intended for local environment only.
25+
The configuration below allows you to spawn as many users as needed and test for behaviour when user is not found using 'notfound' username
26+
-->
27+
<security.db.datasource.authenticationQuery>SELECT '$2a$10$a.oAKDX3Yy9uz1WQUSuaSOSuPDCpvjMo3uG27z0Pnds.NA1pm7WTq' WHERE ? != 'notfound'</security.db.datasource.authenticationQuery>
28+
<profiles.allow.physicalDates>true</profiles.allow.physicalDates>
29+
<!-- <spring.jpa.show-sql>true</spring.jpa.show-sql>-->
30+
<cache.invalidation.period>3600000</cache.invalidation.period>
31+
</properties>
32+
</profile>
33+
</profiles>
34+
</settings>

0 commit comments

Comments
 (0)