|
| 1 | +# Versioned Storage Service (Java) |
| 2 | + |
| 3 | +This directory hosts the Java-based implementation of the Versioned Storage Service (VSS). |
| 4 | + |
| 5 | +### Prerequisites |
| 6 | + |
| 7 | +- Install Gradle (https://gradle.org/install/). |
| 8 | +- Install JDK 17 (https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/). |
| 9 | +- Install Docker (https://docs.docker.com/desktop/). |
| 10 | +- Install PostgreSQL 15 (https://www.postgresql.org/download/). |
| 11 | + |
| 12 | +### Building |
| 13 | + |
| 14 | +``` |
| 15 | +git clone https://github.com/lightningdevkit/vss-server.git |
| 16 | +cd vss-server/java |
| 17 | +
|
| 18 | +gradle wrapper --gradle-version 8.1.1 |
| 19 | +./gradlew build -x test # Running tests requires docker-engine to be running. |
| 20 | +``` |
| 21 | + |
| 22 | +* WAR file for deployment should be generated at `./app/build/libs/vss-1.0.war` |
| 23 | + |
| 24 | +#### Only required for development: |
| 25 | + |
| 26 | +* Generating updated [protobuf] objects: |
| 27 | + ``` |
| 28 | + ./gradlew generateProto |
| 29 | + ``` |
| 30 | +
|
| 31 | +* Generating updated [Jooq] objects: |
| 32 | + ``` |
| 33 | + ./gradlew generateJooq |
| 34 | + ``` |
| 35 | +
|
| 36 | +### Running |
| 37 | +
|
| 38 | +#### For local testing with a PostgreSQL container: |
| 39 | +
|
| 40 | +``` |
| 41 | + docker-compose up --build |
| 42 | + |
| 43 | + # To inspect the database: |
| 44 | + `psql postgresql://postgres:YOU_MUST_CHANGE_THIS_PASSWORD@localhost:5432/postgres` |
| 45 | +``` |
| 46 | +
|
| 47 | +#### To run just the VSS-server: |
| 48 | +
|
| 49 | +1. **Edit Configuration**: Modify the Dockerfile or application.properties to set application configurations and |
| 50 | + environment variables as needed. Add PostgreSQL endpoint configuration. |
| 51 | +2. Create table in PostgreSQL using `./app/src/main/java/org/vss/impl/postgres/sql/` |
| 52 | +3. **Build the Docker Image**: |
| 53 | + ``` |
| 54 | + docker build --tag 'vss_server_java' |
| 55 | + ``` |
| 56 | +3. **Run the Docker Container**: |
| 57 | + ``` |
| 58 | + docker run --detach -p 8080:8080 'vss_server_java' |
| 59 | + ``` |
| 60 | +4. VSS endpoint should be reachable at `http://localhost:8080/vss`. |
| 61 | +
|
| 62 | +### Configuration |
| 63 | +
|
| 64 | +Refer `./app/src/main/resources/application.properties` to see available configuration options. |
| 65 | +
|
| 66 | +Each property can be overridden by setting an environment variable with the same name. |
| 67 | +For example, to override `vss.jdbc.url`, set an environment variable `vss.jdbc.url` with the new value. |
| 68 | +
|
| 69 | +### Support |
| 70 | +
|
| 71 | +If you encounter any issues or have questions, feel free to open an issue on |
| 72 | +the [GitHub repository](https://github.com/lightningdevkit/vss-server/issues). For further assistance or to discuss the |
| 73 | +development of VSS, you can reach out to us in the [LDK Discord](https://discord.gg/5AcknnMfBw) in the `#vss` channel. |
| 74 | +
|
| 75 | +[LDK Discord]: https://discord.gg/5AcknnMfBw |
| 76 | +
|
| 77 | +[protobuf]: https://protobuf.dev/ |
| 78 | +
|
| 79 | +[Jooq]: https://www.jooq.org/ |
0 commit comments