Skip to content

Commit

Permalink
doc: Add Development section
Browse files Browse the repository at this point in the history
  • Loading branch information
akiradeveloper committed Apr 27, 2024
1 parent 426ca9b commit 4972eb1
Show file tree
Hide file tree
Showing 6 changed files with 1,710 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/actions/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FROM rust:latest
RUN cargo install mdbook-mermaid
RUN cargo install mdbook --no-default-features --features search --vers "^0.4" --locked
CMD ["mdbook", "build", "doc"]
8 changes: 7 additions & 1 deletion doc/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ authors = ["Akira Hayakawa"]
language = "en"
multilingual = false
src = "src"
title = "lolraft documentation"
title = "lolraft documentation"

[preprocessor.mermaid]
command = "mdbook-mermaid"

[output.html]
additional-js = ["mermaid.min.js", "mermaid-init.js"]
1 change: 1 addition & 0 deletions doc/mermaid-init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mermaid.initialize({startOnLoad:true});
1,648 changes: 1,648 additions & 0 deletions doc/mermaid.min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions doc/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

- [Multi-Raft](multi-raft.md)
- [Raft Process](raft-process.md)
- [Orbit pattern](orbit-pattern.md)
- [Orbit Pattern](orbit-pattern.md)
- [Application State](application-state.md)
- [Client Interaction](client-interaction.md)
- [Cluster Management](cluster-management.md)
- [Leadership](leadership.md)
- [Leadership](leadership.md)
- [Development](development.md)
50 changes: 50 additions & 0 deletions doc/src/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Development

## Build

(lolraft crate only) The proto file should be compiled manually if you changed the proto file.
In this case, please run `cargo run -p codegen`.

## Test

For testing, lolraft makes use of docker-compose.

A docker image called testapp is built and the tests create some instances of it for testing: test code is running on dev container and it accesses the docker deamon in the host. In GHA, the tests are run in the same way.

The log output in the stdout/stderr is collected into the log container. This is quite useful for debugging. So here is how you can run the tests for development.

- `docker compose build` to build test application.
- TERM1: `./log` to start log watcher.
- TERM2: `./dev` to start the dev container.
- TERM2: `cargo test`.

```mermaid
graph
subgraph raft_network
subgraph cluster
APP1(testapp-1)
APP2(testapp-2)
APP3(testapp-3)
end
DEV(dev)
LOG(log)
end
APP1 -->|log| LOG
APP2 -->|log| LOG
APP3 -->|log| LOG
DEV -->|command| APP1
DEV -->|command| APP2
DEV -->|command| APP3
```

## Documentation

You can modify the documentations.

For editing the mdbook under doc/ directory,
you can run `mdbook serve doc` to start the local mdbook server.

0 comments on commit 4972eb1

Please sign in to comment.