Skip to content

Latest commit

 

History

History

querier

The querier service handles request for entry querying. It exposes an HTTP
interface which accepts the sql and user information which it then uses to
generate and execute a query against the extracted processing data.

The SQL query is rewritten so that it is able to be executed in the application
database (converts columns into json selectors for the `data` column, converts
book in `from` clause into a filter and uses correct table) and add filters to
the query for the appropriate user and book.


=== Requirements

- See requirements for web application


=== Development

    go generate ./...   # execute code generators
    go build            # build the service
    go run .            # run the service locally
    go test ./...       # run all tests


=== Configuration

The services needs to know what database to connect to and port binding
information for the HTTP service. This is done using the following environment
variables:

    QUERIER_DB_CONN     # database connection url, example "postgres://ro_user@localhost:5432/captainslog"
    QUERIER_HTTP_LISTEN # http host/port string, example ":8082"


=== Container

    # Build image with querier binary. Make sure to run this in this
    # directory (<captainslogroot>/querier)
    docker build -t minond/captainslog-querier -f Dockerfile .

    # Run it using local configuration and binding to the correct host and
    # container port Make sure you have a .env file with the required environment
    # variables in the directory where you run this command.
    docker run -d --env-file .env --name cl-querier -p 8082:8082 minond/captainslog-querier

    # Push to container repo.
    docker push minond/captainslog-querier:latest