Build script updates / README updated

This commit is contained in:
michaelpede 2021-04-22 12:57:44 -07:00
parent 0dc48d8944
commit 238dc2bd1b
4 changed files with 73 additions and 9 deletions

View File

@ -1,2 +1,33 @@
# reso-web-api-reference-server
RESO Web API and Data Dictionary compliant reference server
# RESO Web API and Data Dictionary compliant reference server
## Building the server
In order to run your own local server you need a linux / Unix environment with the following dependencies:
* Maven
* docker-compose
* wget or curl
Run the `build.sh`
This will create everything to run the test server.
## Running the server
Run the `run.sh`
## Access the Server
Assuming you're running the server locally, go to [http://localhost:8080/RESOservice-1.0/Lookup](http://localhost:8080/RESOservice-1.0/Lookup)\
Otherwise, you will have to replace `localhost` with the IP of your Docker machine.
## Running with a different database
If you set the `SQL_HOST` Environment Variable, then the build script will not build the test database.
It will only build the reference server.
You will need to configure the following environment variables, so the server can connect to your custom database.
* SQL_HOST
* SQL_USER
* SQL_PASSWORD

View File

@ -1,9 +1,42 @@
#!/bin/bash
wget https://github.com/RESOStandards/web-api-commander/releases/download/current-version/web-api-commander.jar -O temp/web-api-commander.jar
java -jar temp/web-api-commander.jar --generateReferenceDDL --useKeyNumeric > sql/reso-reference-ddl-dd-1.7.numeric-keys.sql
REAL_VAR0=`readlink -f $0`
HOME_DIR=`dirname ${REAL_VAR0}`
TEMP_DIR="${HOME_DIR}/temp"
SQL_DIR="${HOME_DIR}/sql"
mvn compile
mvn package
# Ensure we have directories set up
[ -d "${TEMP_DIR}" ] && echo "temp directory found." || mkdir ${TEMP_DIR}
[ -d "${SQL_DIR}" ] && echo "sql directory found." || mkdir ${SQL_DIR}
docker-compose build
if [ -z "${SQL_HOST}" ]
then
# Get the Web API Commander, needed to generate the test database
if ! wget https://github.com/RESOStandards/web-api-commander/releases/download/current-version/web-api-commander.jar -O temp/web-api-commander.jar
then
echo "WGET not installed. trying CURL."
if ! curl -L https://github.com/RESOStandards/web-api-commander/releases/download/current-version/web-api-commander.jar --output temp/web-api-commander.jar
then
echo "CURL not installed. Exiting build."
exit
fi
fi
java -jar temp/web-api-commander.jar --generateReferenceDDL --useKeyNumeric > sql/reso-reference-ddl-dd-1.7.numeric-keys.sql
else
COMPOSE_FILE="docker-compose.yml"
fi
if ! mvn compile
then
echo "Maven could not be found."
exit
else
mvn package
fi
if ! docker-compose build
then
echo "docker-compose could not be found. You may need to install with pip."
exit
fi

View File

@ -3,7 +3,7 @@ services:
docker-mysql:
restart: always
container_name: docker-mysql
image: mysql
image: mysql/mysql-server
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_DATABASE: reso_data_dictionary_1_7