Skip to content

Commit e61fee9

Browse files
authored
#334 Add in-memory database (#346)
* #334 Savepoint * #334 Savpoint * #334 Update dependencies * #334 Prepare for versioned release * #334 Improve workflows * #334 Improve workflows * #334 Prepare for versioned release * #334 Fix docker build test * #334 Fix docker build test
1 parent 2fdcb7b commit e61fee9

9 files changed

+46
-101
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: docker push containers to dockerhub - manual
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
docker-push-containers-to-dockerhub-manual:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Get repo name
15+
id: repo-basename
16+
run: |
17+
echo "repo=$(basename ${{ github.repository }})" >> "$GITHUB_OUTPUT"
18+
shell: bash
19+
20+
- name: Build docker image and push to DockerHub
21+
uses: senzing-factory/github-action-docker-buildx-build@v1
22+
with:
23+
build-options: "--push"
24+
image-repository: senzing/${{ steps.repo-basename.outputs.repo }}
25+
image-tag: latest
26+
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
27+
username: ${{ secrets.DOCKERHUB_USERNAME }}

.github/workflows/docker-push-containers-to-dockerhub.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ jobs:
2626
image-repository: senzing/${{ steps.repo-basename.outputs.repo }}
2727
image-tag: ${{ github.ref_name }}
2828
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
29-
platforms: linux/amd64
3029
username: ${{ secrets.DOCKERHUB_USERNAME }}

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning].
99

1010
-
1111

12+
## [0.8.5] - 2024-10-21
13+
14+
### Changed in 0.8.5
15+
16+
- Add ephemeral database to Dockerfile
17+
1218
## [0.8.4] - 2024-10-09
1319

1420
### Changed in 0.8.4

Dockerfile

+4-8
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Stages
33
# -----------------------------------------------------------------------------
44

5-
ARG IMAGE_BUILDER=golang:1.22.4-bullseye
6-
ARG IMAGE_FINAL=senzing/senzingapi-runtime-staging:latest
5+
ARG IMAGE_BUILDER=golang:1.23.2-bullseye
6+
ARG IMAGE_FINAL=senzing/senzingapi-runtime-beta:latest
77

88
# -----------------------------------------------------------------------------
99
# Stage: senzingapi_runtime
@@ -69,18 +69,14 @@ COPY ./rootfs /
6969

7070
COPY --from=builder "/output/linux/serve-grpc" "/app/serve-grpc"
7171

72-
# Install database
73-
74-
COPY ./testdata/sqlite/G2C.db /tmp/sqlite/G2C.db
75-
RUN chmod --recursive 777 /tmp/sqlite
76-
7772
# Run as non-root container
7873

7974
USER 1001
8075

8176
# Runtime environment variables.
8277

83-
ENV SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@nowhere/tmp/sqlite/G2C.db
78+
ENV SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@nowhere/tmp/sqlite/G2C.db?mode=memory&cache=shared
79+
ENV SENZING_TOOLS_ENABLE_ALL=true
8480
ENV LD_LIBRARY_PATH=/opt/senzing/er/lib/
8581

8682
# Runtime execution.

README.md

+3-87
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ the recommendation is not to use it yet.
1616

1717
## Synopsis
1818

19-
`serve-grpc` is a command in the [senzing-tools] suite of tools.
20-
This command is a [gRPC] server application that supports requests to the Senzing SDK via network access.
21-
2219
[![Go Reference Badge]][Package reference]
2320
[![Go Report Card Badge]][Go Report Card]
2421
[![License Badge]][License]
@@ -39,85 +36,16 @@ Senzing SDKs for accessing the gRPC server:
3936
1. Go: [sz-sdk-go-grpc]
4037
1. Python: [sz-sdk-python-grpc]
4138

42-
A simple demonstration using `senzing-tools` and a SQLite database.
43-
44-
```console
45-
export LD_LIBRARY_PATH=/opt/senzing/er/lib/
46-
export SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@nowhere/tmp/sqlite/G2C.db
47-
senzing-tools init-database
48-
senzing-tools serve-grpc --enable-all
49-
50-
```
51-
5239
## Install
5340

54-
1. The `serve-grpc` command is installed with the [senzing-tools] suite of tools.
55-
See [senzing-tools install](https://github.com/senzing-garage/senzing-tools#install).
56-
5741
## Use
5842

59-
```console
60-
export LD_LIBRARY_PATH=/opt/senzing/er/lib/
61-
senzing-tools serve-grpc [flags]
62-
```
63-
64-
1. For options and flags:
65-
1. [Online documentation](https://hub.senzing.com/senzing-tools/senzing-tools_serve-grpc.html)
66-
1. Runtime documentation:
67-
68-
```console
69-
export LD_LIBRARY_PATH=/opt/senzing/er/lib/
70-
senzing-tools serve-grpc --help
71-
```
72-
73-
1. In addition to the following simple usage examples, there are additional [Examples](docs/examples.md).
74-
75-
### Using command line options
76-
77-
1. :pencil2: Specify database using command line option.
43+
1. Docker container with internal, ephemeral database and
44+
gRPC accessable on port 8261.
7845
Example:
7946

8047
```console
81-
export LD_LIBRARY_PATH=/opt/senzing/er/lib/
82-
senzing-tools serve-grpc \
83-
--database-url postgresql://username:[email protected]:5432/G2 \
84-
--enable-all
85-
86-
```
87-
88-
1. Run `senzing-tools serve-grpc --help` or see [Parameters](#parameters) for additional parameters.
89-
90-
### Using environment variables
91-
92-
1. :pencil2: Specify database using environment variable.
93-
Example:
94-
95-
```console
96-
export LD_LIBRARY_PATH=/opt/senzing/er/lib/
97-
export SENZING_TOOLS_DATABASE_URL=postgresql://username:[email protected]:5432/G2
98-
export SENZING_TOOLS_ENABLE_ALL=true
99-
senzing-tools serve-grpc
100-
```
101-
102-
1. Run `senzing-tools serve-grpc --help` or see [Parameters](#parameters) for additional parameters.
103-
104-
### Using Docker
105-
106-
This usage shows how to initialze a database with a Docker container.
107-
108-
1. This usage specifies a URL of an external database.
109-
Example:
110-
111-
```console
112-
docker run \
113-
--env SENZING_TOOLS_DATABASE_URL=postgresql://username:[email protected]:5432/G2 \
114-
--env SENZING_TOOLS_ENABLE_ALL=true \
115-
--interactive \
116-
--publish 8258:8258 \
117-
--rm \
118-
--tty \
119-
senzing/senzing-tools serve-grpc
120-
48+
docker run -it --name senzing-serve-grpc -p 8261:8261 --rm senzing/serve-grpc
12149
```
12250

12351
1. See [Parameters](#parameters) for additional parameters.
@@ -126,11 +54,6 @@ This usage shows how to initialze a database with a Docker container.
12654

12755
- **[SENZING_TOOLS_DATABASE_URL]**
12856
- **[SENZING_TOOLS_ENABLE_ALL]**
129-
- **[SENZING_TOOLS_ENABLE_G2CONFIG]**
130-
- **[SENZING_TOOLS_ENABLE_G2CONFIGMGR]**
131-
- **[SENZING_TOOLS_ENABLE_G2DIAGNOSTIC]**
132-
- **[SENZING_TOOLS_ENABLE_G2ENGINE]**
133-
- **[SENZING_TOOLS_ENABLE_G2PRODUCT]**
13457
- **[SENZING_TOOLS_ENGINE_CONFIGURATION_JSON]**
13558
- **[SENZING_TOOLS_ENGINE_LOG_LEVEL]**
13659
- **[SENZING_TOOLS_ENGINE_MODULE_NAME]**
@@ -159,7 +82,6 @@ This usage shows how to initialze a database with a Docker container.
15982
[go-test-windows.yaml]: https://github.com/senzing-garage/serve-grpc/actions/workflows/go-test-windows.yaml
16083
[golangci-lint.yaml Badge]: https://github.com/senzing-garage/serve-grpc/actions/workflows/golangci-lint.yaml/badge.svg
16184
[golangci-lint.yaml]: https://github.com/senzing-garage/serve-grpc/actions/workflows/golangci-lint.yaml
162-
[gRPC]: https://github.com/senzing-garage/knowledge-base/blob/main/WHATIS/grpc.md
16385
[License Badge]: https://img.shields.io/badge/License-Apache2-brightgreen.svg
16486
[License]: https://github.com/senzing-garage/serve-grpc/blob/main/LICENSE
16587
[Package reference]: https://pkg.go.dev/github.com/senzing-garage/serve-grpc
@@ -168,17 +90,11 @@ This usage shows how to initialze a database with a Docker container.
16890
[Senzing Quick Start guides]: https://docs.senzing.com/quickstart/
16991
[SENZING_TOOLS_DATABASE_URL]: https://github.com/senzing-garage/knowledge-base/blob/main/lists/environment-variables.md#senzing_tools_database_url
17092
[SENZING_TOOLS_ENABLE_ALL]: https://github.com/senzing-garage/knowledge-base/blob/main/lists/environment-variables.md#senzing_tools_enable_all
171-
[SENZING_TOOLS_ENABLE_G2CONFIG]: https://github.com/senzing-garage/knowledge-base/blob/main/lists/environment-variables.md#senzing_tools_enable_g2config
172-
[SENZING_TOOLS_ENABLE_G2CONFIGMGR]: https://github.com/senzing-garage/knowledge-base/blob/main/lists/environment-variables.md#senzing_tools_enable_g2configmgr
173-
[SENZING_TOOLS_ENABLE_G2DIAGNOSTIC]: https://github.com/senzing-garage/knowledge-base/blob/main/lists/environment-variables.md#senzing_tools_enable_g2diagnostic
174-
[SENZING_TOOLS_ENABLE_G2ENGINE]: https://github.com/senzing-garage/knowledge-base/blob/main/lists/environment-variables.md#senzing_tools_enable_g2engine
175-
[SENZING_TOOLS_ENABLE_G2PRODUCT]: https://github.com/senzing-garage/knowledge-base/blob/main/lists/environment-variables.md#senzing_tools_enable_g2product
17693
[SENZING_TOOLS_ENGINE_CONFIGURATION_JSON]: https://github.com/senzing-garage/knowledge-base/blob/main/lists/environment-variables.md#senzing_tools_engine_configuration_json
17794
[SENZING_TOOLS_ENGINE_LOG_LEVEL]: https://github.com/senzing-garage/knowledge-base/blob/main/lists/environment-variables.md#senzing_tools_engine_log_level
17895
[SENZING_TOOLS_ENGINE_MODULE_NAME]: https://github.com/senzing-garage/knowledge-base/blob/main/lists/environment-variables.md#senzing_tools_engine_module_name
17996
[SENZING_TOOLS_GRPC_PORT]: https://github.com/senzing-garage/knowledge-base/blob/main/lists/environment-variables.md#senzing_tools_grpc_port
18097
[SENZING_TOOLS_LOG_LEVEL]: https://github.com/senzing-garage/knowledge-base/blob/main/lists/environment-variables.md#senzing_tools_log_level
181-
[senzing-tools]: https://github.com/senzing-garage/senzing-tools
18298
[Senzing]: https://senzing.com/
18399
[senzing/sz-sdk-go-core]: https://github.com/senzing-garage/sz-sdk-go-core
184100
[sz-sdk-go-grpc]: https://github.com/senzing-garage/sz-sdk-go-grpc

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ require (
4343
golang.org/x/net v0.30.0 // indirect
4444
golang.org/x/sys v0.26.0 // indirect
4545
golang.org/x/text v0.19.0 // indirect
46-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
46+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
4747
google.golang.org/protobuf v1.35.1 // indirect
4848
gopkg.in/ini.v1 v1.67.0 // indirect
4949
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
7878
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
7979
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
8080
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
81-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc=
82-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
81+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE=
82+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
8383
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
8484
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
8585
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=

makefiles/darwin.mk

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
SENZING_DIR ?= /opt/senzing/er
88
SENZING_TOOLS_SENZING_DIRECTORY ?= $(SENZING_DIR)
9-
109
LD_LIBRARY_PATH ?= $(SENZING_TOOLS_SENZING_DIRECTORY)/lib:$(SENZING_TOOLS_SENZING_DIRECTORY)/lib/macos
10+
11+
CGO_LDFLAGS := "-Wl,-no_warn_duplicate_libraries"
1112
DYLD_LIBRARY_PATH := $(LD_LIBRARY_PATH)
12-
SENZING_TOOLS_DATABASE_URL ?= sqlite3://na:na@nowhere/tmp/sqlite/G2C.db
1313
PATH := $(MAKEFILE_DIRECTORY)/bin:/$(HOME)/go/bin:$(PATH)
14+
SENZING_TOOLS_DATABASE_URL ?= sqlite3://na:na@nowhere/tmp/sqlite/G2C.db
1415

1516
# -----------------------------------------------------------------------------
1617
# OS specific targets

rootfs/tmp/sqlite/G2C.db

300 KB
Binary file not shown.

0 commit comments

Comments
 (0)