Skip to content

Commit

Permalink
Refine example to use docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Feb 16, 2023
1 parent db7def3 commit fcfb5f7
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
5 changes: 5 additions & 0 deletions authentication/example-providers/sql-username-password/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
COMPOSE_PROJECT_NAME=core-sql-username-password
DEEPHAVEN_PORT=10000
DEEPHAVEN_CONSOLE_TYPE=python
DEEPHAVEN_APPLICATION_DIR=/data/app.d
DEEPHAVEN_SERVER_IMAGE=deephaven/server-jetty:local-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ARG DEEPHAVEN_SERVER_IMAGE
FROM ${DEEPHAVEN_SERVER_IMAGE}

COPY build/libs/deephaven-sql-username-password-authentication-provider-*-all.jar /apps/libs/deephaven-sql-username-password-authentication-provider.jar
11 changes: 8 additions & 3 deletions authentication/example-providers/sql-username-password/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ to follow best practices in storing secure information like the password itself,
rudimentary.

## Example database setup
In this directory, run `docker-compose up` to start a SQL database. The `init-users.sql` file will be used to initialize
this database, which has one user, named `admin`, with a password of `p@ssw0rd`. This docker-compose configuration is
designed to be fast to start and ephemeral, and is not meant for production use.
In this directory, run `docker-compose up`in this directory to start a SQL database. The `init-users.sql` file will be
used to initialize this database, which has one user, named `admin`, with a password of `p@ssw0rd`. This docker-compose
configuration is designed to be fast to start and ephemeral, and is not meant for production use.

After that has run, there will be a docker container running with port 5432 exposed on localhost. The password for the
postgres account is `password`.

## Server setup
To test this when building from gradle with `:server-jetty-app:run`, specify `-Psql-username-password` to enable this.

To run this from a sample docker-compose:
* First build the project, at least `./gradlew prepareCompose :authentication:example-providers:sql-username-password:assemble`
from the top-level directory of the project.
* Then run `docker-compose -f docker-compose.yml -f docker-compose-dh.yml up` in this directory.

To use this from a pre-built installation:
* Add the sql-username-password-authentication-provider jar to your Deephaven installation's classpath:
* If running the `bin/start` script, this can be accomplished by adding it to the `EXTRA_CLASSPATH` environment variable.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3.4"

services:
server:
extends:
file: ../../../docker-compose-common.yml
service: server
image: deephaven/server-jetty-sql-username-password:local-build
build:
context: .
args:
- DEEPHAVEN_SERVER_IMAGE=${DEEPHAVEN_SERVER_IMAGE}
# volumes:
# - ./build/libs/deephaven-sql-username-password-*-all.jar:/apps/libs/deephaven-sql-username-password.jar
environment:
JAVA_OPTS: >
-DAuthHandlers=io.deephaven.authentication.sql.BasicSqlAuthenticationHandler
-Dauthentication.basic.sql.jdbc.connection=jdbc:postgresql://postgres:5432/postgres
-Dauthentication.basic.sql.jdbc.user=postgres
-Dauthentication.basic.sql.jdbc.password=password
1 change: 1 addition & 0 deletions docker/server-jetty/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ARG BASE
FROM $BASE as install

COPY licenses/ /
RUN mkdir -p /apps/libs

# Note: all of the pip installs have the --no-index flag, with the expectation that all external dependencies are
# already satisfied via the base image. If that is not the case, we want the install to error out, and we'll need to
Expand Down

0 comments on commit fcfb5f7

Please sign in to comment.