The following instructions are useful during development.
Note: This has been tested on Linux and Darwin/macOS. It has not been tested on Windows.
🤔 The following tasks need to be complete before proceeding. These are "one-time tasks" which may already have been completed.
Since the Senzing library is a prerequisite, it must be installed first.
-
Verify Senzing C shared objects, configuration, and SDK header files are installed.
/opt/senzing/er/lib
/opt/senzing/er/sdk/c
/etc/opt/senzing
-
If not installed, see How to Install Senzing for Go Development.
-
Identify git repository.
export GIT_ACCOUNT=senzing-garage export GIT_REPOSITORY=serve-grpc export GIT_ACCOUNT_DIR=~/${GIT_ACCOUNT}.git export GIT_REPOSITORY_DIR="${GIT_ACCOUNT_DIR}/${GIT_REPOSITORY}"
-
Using the environment variables values just set, follow steps in clone-repository to install the Git repository.
-
A one-time command to install dependencies needed for
make
targets. Example:cd ${GIT_REPOSITORY_DIR} make dependencies-for-development
-
Install dependencies needed for Go code. Example:
cd ${GIT_REPOSITORY_DIR} make dependencies
-
Run linting. Example:
cd ${GIT_REPOSITORY_DIR} make lint
-
Build the binaries. Example:
cd ${GIT_REPOSITORY_DIR} make clean build
-
The binaries will be found in the
${GIT_REPOSITORY_DIR}/target
directory. Example:tree ${GIT_REPOSITORY_DIR}/target
-
Run program. Examples:
-
Linux
-
✏️ Identify a location for database. Example:
export SENZING_TOOLS_DATABASE_FILE=/tmp/sqlite/G2C.db
-
Copy template database and run command. Example:
mkdir --parents ${SENZING_TOOLS_DATABASE_FILE%/*} cp ${GIT_REPOSITORY_DIR}/testdata/sqlite/G2C.db ${SENZING_TOOLS_DATABASE_FILE} export SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@nowhere${SENZING_TOOLS_DATABASE_FILE} ${GIT_REPOSITORY_DIR}/target/linux-amd64/serve-grpc
-
-
macOS
${GIT_REPOSITORY_DIR}/target/darwin-amd64/serve-grpc
-
Windows
${GIT_REPOSITORY_DIR}/target/windows-amd64/serve-grpc
-
-
Clean up. Example:
cd ${GIT_REPOSITORY_DIR} make clean
-
Run tests. Example:
cd ${GIT_REPOSITORY_DIR} make clean setup test
-
Optional: View the SQLite database. Example:
docker run \ --env SQLITE_DATABASE=G2C.db \ --interactive \ --publish 9174:8080 \ --rm \ --tty \ --volume /tmp/sqlite:/data \ coleifer/sqlite-web
Visit localhost:9174.
Create a code coverage map.
-
Run Go tests. Example:
cd ${GIT_REPOSITORY_DIR} make clean setup coverage
A web-browser will show the results of the coverage. The goal is to have over 80% coverage. Anything less needs to be reflected in testcoverage.yaml.
-
View documentation. Example:
cd ${GIT_REPOSITORY_DIR} make clean documentation
-
If a web page doesn't appear, visit localhost:6060.
-
Senzing documentation will be in the "Third party" section.
github.com
>senzing-garage
>serve-grpc
-
When a versioned release is published with a
v0.0.0
format tag, the reference can be found by clicking on the following badge at the top of the README.md page. Example: -
To stop the
godoc
server, runcd ${GIT_REPOSITORY_DIR} make clean
-
Use make target to run a docker images that builds RPM and DEB files. Example:
cd ${GIT_REPOSITORY_DIR} make docker-build
-
Run docker container. Example:
docker run \ --interactive \ --publish 8261:8261 \ --read-only \ --rm \ --tty \ senzing/serve-grpc
-
Optional: Test using
docker-compose
. Example:cd ${GIT_REPOSITORY_DIR} make clean docker-test
To bring the
docker-compose
formation, runcd ${GIT_REPOSITORY_DIR} make clean
Note: This only packages the serve-grpc
command.
It is only to be used in development and test.
The actual packaging is done in the senzing-tools repository.
-
Use make target to run a docker images that builds RPM and DEB files. Example:
cd ${GIT_REPOSITORY_DIR} make package
-
The results will be in the
${GIT_REPOSITORY_DIR}/target
directory. Example:tree ${GIT_REPOSITORY_DIR}/target
-
Determine if
serve-grpc
is installed. Example:apt list --installed | grep serve-grpc
-
✏️ Install
serve-grpc
. Theserve-grpc-...
filename will need modification. Example:cd ${GIT_REPOSITORY_DIR}/target sudo apt install ./serve-grpc-0.0.0.deb
-
✏️ Identify a location for database. Example:
export SENZING_TOOLS_DATABASE_FILE=/tmp/sqlite/G2C.db
-
Copy template database and run command. Example:
mkdir --parents ${SENZING_TOOLS_DATABASE_FILE%/*} cp ${GIT_REPOSITORY_DIR}/testdata/sqlite/G2C.db ${SENZING_TOOLS_DATABASE_FILE} export SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@nowhere${SENZING_TOOLS_DATABASE_FILE}
-
✏️ Run command. Example:
export LD_LIBRARY_PATH=/opt/senzing/er/lib/ serve-grpc
-
Remove
serve-grpc
from system. Example:sudo apt-get remove serve-grpc
-
Determine if
serve-grpc
is installed. Example:yum list installed | grep serve-grpc
-
✏️ Install
serve-grpc
. Theserve-grpc-...
filename will need modification. Example:cd ${GIT_REPOSITORY_DIR}/target sudo yum install ./serve-grpc-0.0.0.rpm
-
✏️ Identify database. One option is to bring up PostgreSql as see in Test using Docker-compose stack with PostgreSql database. Example:
export SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@nowhere/tmp/sqlite/G2C.db
-
Run command. Example:
export LD_LIBRARY_PATH=/opt/senzing/er/lib/ serve-grpc
-
Remove
serve-grpc
from system. Example:sudo yum remove serve-grpc
The following instructions show how to bring up a test stack to be used
in testing the sz-sdk-go-core
packages.
-
Bring up the docker-compose stack. Example:
cd ${GIT_REPOSITORY_DIR} docker-compose up
-
Optional: View the PostgreSQL database.
Visit localhost:9171. For the initial login, review the instructions at the top of the web page. For server password information, see the
POSTGRES_PASSWORD
value in docker-compose.yaml. Usually, it's "postgres". -
Example programs using gRPC:
-
Cleanup.
cd ${SENZING_DEMO_DIR} docker-compose down cd ${GIT_REPOSITORY_DIR} make clean
Using a (deprecated) BloomRPC client, test the Senzing gRPC Server. For other gRPC tools, visit Awesome gRPC.
-
Install the bloomrpc gRPC test client.
-
Example for Ubuntu.
-
Find latest release.
-
✏️ Install. Example:
wget https://github.com/bloomrpc/bloomrpc/releases/download/1.5.3/bloomrpc_1.5.3_amd64.deb sudo apt install ./bloomrpc_1.5.3_amd64.deb
-
-
-
Start the test server. Example:
cd ${GIT_REPOSITORY_DIR} make clean run-serve-grpc
-
In a separate terminal, start the gRPC test client. Example:
bloomrpc
-
In
bloomrpc
:- Near top-center, use the address of
0.0.0.0:8258
to reach the local gRPC server. - In upper-left, click on plus sign ("+").
- Navigate to the ${GIT_REPOSITORY_DIR}/proto directory
- Choose one or more
.proto
files.
- In left-hand pane,
-
Choose the
Init
message. -
Set the request values. Example:
{ "moduleName": "Test of gRPC", "iniParams": "{\"PIPELINE\":{\"CONFIGPATH\":\"/etc/opt/senzing\",\"RESOURCEPATH\":\"/opt/senzing/er/resources\",\"SUPPORTPATH\":\"/opt/senzing/data\"},\"SQL\":{\"CONNECTION\":\"sqlite3://na:na@nowhere/tmp/sqlite/G2C.db\"}}", "verboseLogging": 0 }
-
Near the center, click the green "play" button.
-
- The Senzing object is initialized and other messages can be tried.
- Near top-center, use the address of