Starting a connector (using in-memory database and in-memory Redis)
The connector requires a SQL database and Redis to run. By default, the docker image will run using an in-memory H2 database and in-memory Redis cache. This mode is intended to quickly get a connector up and running but all data will be lost on container restarts. As such, this mode should not be used for any real world applications.
To start the latest nightly image of the java-ilpv4-connector in an interactive terminal, run:
1
docker run -p 8080:8080 -it interledger4j/java-ilpv4-connector:nightly
Copied!
You should see a log message like the following once the container has successfully started:
1
Started ConnectorApplication in 6.912 seconds
Copied!
You can now send HTTP requests to the connector to verify it's working:
Starting a connector (using external Postgres database and external Redis)
This mode requires having a Postgres database and Redis cache already running. This mode allows the java-ilpv4-connector to be restarted without loss of data (so long as the Postgres database and Redis cache are not lost).
Running Postgres and Redis in docker
If you already have a Postgres database and Redis cache running, skip this section. Otherwise, we'll start up a Postgres container and Redis container in docker.
Note that you should pick a password properly above.
To start a Redis cache, run:
1
docker run -d -p 6379:6379 redis
Copied!
You can verify the containers are running via:
1
docker ps
Copied!
Configuring java-ilpv4-connector to connect to external Postgres and Redis instances:
The docker container needs to be configured with the postgres and redis connection details. This is done by passing environment variables in the docker run command. Docker supports passing each environment variable as a separate argument or by providing a env file that contains environment variable mappings.
For example, here is how to configure and run the connector using separate env args:
docker run -p 8080:8080 --env-file ~/connector.env -it interledger4j/java-ilpv4-connector:nightly
Copied!
Configuration flags available via docker
java-ilpv4-connector uses Spring Boot for external configuration. Spring properties specific to the java-ilpv4-connector can be found under Connector Configuration Properties. Spring makes it easy to set/override a Spring property via environment variables. For example, a Spring property specified via yaml configuration like this