Improve WASM client reusability
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
# PhoeBench
|
||||
*Introduction to be done*
|
||||
|
||||
## Setup
|
||||
### Server
|
||||
The server ZIP files in the releases contain all dependencies, so just unzip it where you want to run the server.
|
||||
|
||||
First, set up the environment variables (this cannot currently be done using `.env` files, I think):
|
||||
- `JWT_AUDIENCE`: the audience to use for the JSON Web Tokens authentication, typically set to your URL;
|
||||
- `JWT_ISSUER`: the issuer for the authentication tokens, typically also set to your URL;
|
||||
- `JWT_REALM`: the realm for which the authentication tokens are valid, doesn't matter as there is only one "realm" (I use `phoebench`);
|
||||
- `JWT_SECRET`: a strong secret key to encrypt the authentication tokens (e.g. generated by `gpg --gen-random --armor 1 128`);
|
||||
- `PORT`: the port to host the server on;
|
||||
- `PHOEBENCH_SAFE_CLIENT`: (optional) if you plan on hosting a web client, set this to its URL (for CORS requests);
|
||||
- `PHOEBENCH_DEV_CLIENT_PORT`: (development only) port to enable CORS requests from `localhost` and `127.0.0.1`.
|
||||
|
||||
Next, set up the database variables (recommended through a `.env` file):
|
||||
- `DATABASE_URL`: JDBC URL to connect to the database;
|
||||
- `DATABASE_DRIVER`: fully-qualified name of the JDBC driver to connect to the database with;
|
||||
- `DATABASE_USER`: (if needed) username for the database;
|
||||
- `DATABASE_PASSWORD`: (if needed) password for the database.
|
||||
|
||||
The server currently supports SQLite and MariaDB as databases, using the following settings:
|
||||
```
|
||||
# SQLite
|
||||
DATABASE_URL=jdbc:sqlite:/path/to/db/file.db
|
||||
DATABASE_DRIVER=org.sqlite.JDBC
|
||||
# SQLite does not need user/password
|
||||
|
||||
# MariaDB
|
||||
DATABASE_URL=jdbc:mariadb://host:port/database-name
|
||||
DATABASE_DRIVER=org.mariadb.jdbc.Driver
|
||||
DATABASE_USER=username
|
||||
DATABASE_PASSWORD=pass
|
||||
```
|
||||
For SQLite, don't forget to substitute `/path/to/db/file.db` (with the path to where the database should be stored).
|
||||
For MariaDB, don't forget to substitute `host`, `port`, `database-name`, `username`, and `pass` (`host:port` will typically be `localhost:3306`).
|
||||
To use MariaDB, you will need to create the database and user through its administration interface.
|
||||
|
||||
### JVM Client
|
||||
The JVM client does not require any additional setup.
|
||||
Simply unzip the client ZIP for your platform (currently only built for Linux), and run `bin/com.jaytux.phoebench.clients` from the unzip location.
|
||||
|
||||
However, to avoid having to log in again every time you start the app, it is recommended to ensure you have a working keyring set up.
|
||||
|
||||
### WASM Client
|
||||
The WASM/JS client ZIP contains files that can be statically served, including all dependencies.
|
||||
As the WASM files can take some time to load over the network, it is recommended to modify the `index.html` file to contain some sort of loading screen.
|
||||
|
||||
As for setup - you need to create a file called `config.json` with the following content:
|
||||
```json
|
||||
{
|
||||
"server": "server url"
|
||||
}
|
||||
```
|
||||
Replace `server url` with the URL of the server to connect to (don't forget to add it as `PHOEBENCH_SAFE_CLIENT` to the server, see above).
|
||||
For deployment, this file should be in the same directory where the ZIP was extracted.
|
||||
For development, it should be under `/clients/compose/src/wasmJsMain/resources/` to ensure correct loading.
|
||||
|
||||
### CLI Client
|
||||
The CLI client does not require any additional setup, simply use Java to run the JAR: `java -jar phoebench-cli.jar`.
|
||||
To use the CLI client in scripts, it is recommended to suppress certain warnings: `java --enable-native-access=ALL_UNNAMED -jar phoebench-cli.jar`, as it will otherwise output warning messages that might trip up your scripts.
|
||||
Reference in New Issue
Block a user