-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "How to Run a Tessera Log (MySQL)" (#163)
* Add "How to Run a Tessera Log (MySQL)" * Add warning message about the example is not fit for production use
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# How to Run a Tessera Log (MySQL) | ||
|
||
> [!WARNING] | ||
> - This is an example and is not fit for production use, but demonstrates a way of using the Tessera Log with MySQL storage backend. | ||
> - This example is built on the [tlog tiles API](https://c2sp.org/tlog-tiles) for read endpoints and exposes a /add endpoint that allows any POSTed data to be added to the log. | ||
The tessera log with the MySQL storage implementation can be started with either Docker Compose or manual `go run`. | ||
|
||
Note that all the commands are executed at the root directory of this repository. | ||
|
||
## Docker Compose | ||
|
||
### Prerequisites | ||
|
||
- [Docker Compose](https://docs.docker.com/compose/install/) | ||
|
||
### Starting | ||
|
||
```sh | ||
docker compose -f ./cmd/example-mysql/docker/compose.yaml up | ||
``` | ||
|
||
Add `-d` if you want to run the log in detached mode. | ||
|
||
### Stopping | ||
|
||
```sh | ||
docker compose -f ./cmd/example-mysql/docker/compose.yaml down | ||
``` | ||
|
||
## Manual | ||
|
||
### Prerequisites | ||
|
||
Assume you have the MySQL database ready. An alternative way is to run a MySQL database via [Docker](https://docs.docker.com/engine/install/). | ||
|
||
```sh | ||
docker run --name test-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=test_tessera -d mysql | ||
``` | ||
|
||
### Starting | ||
|
||
```sh | ||
go run ./cmd/example-mysql --mysql_uri="root:root@tcp(localhost:3306)/test_tessera" --init_schema_path="./storage/mysql/schema.sql" --private_key_path="./cmd/example-mysql/docker/testdata/key" --public_key_path="./cmd/example-mysql/docker/testdata/key.pub" | ||
``` | ||
|
||
### Stopping | ||
|
||
<kbd>Ctrl</kbd> <kbd>C</kbd> |