Skip to content

Commit

Permalink
docs:
Browse files Browse the repository at this point in the history
* use sh syntax highlighting for console commands
* consistent formatting of code blocks (2 space indentation)
* remove quote blocks around code blocks
* add title's to code blocks related to file contents
* fix indentation errors (use 4 spaces by default)
* add sudo to command requiring sudo
* remove inline code blocks from headers
* fix header levels to utilize page toc
  • Loading branch information
reubenmiller authored and didier-wenzek committed Jul 3, 2023
1 parent 6b43a58 commit cc39c72
Show file tree
Hide file tree
Showing 60 changed files with 1,569 additions and 1,371 deletions.
4 changes: 2 additions & 2 deletions CODING_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ Avoid using unsafe code.
## Code formatting
Always use rustfmt before you commit as your code won't pass CI pipeline if rustfmt is not applied. We adhere to default settings.

```shell
```sh
cargo fmt
```


## Code analysis
Clippy is used to catch common mistakes and we run it as part of our CI pipeline.

```shell
```sh
cargo clippy
```

Expand Down
20 changes: 10 additions & 10 deletions configuration/init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ The systemctl is the main command in systemd, used to control services.

Create systemd service file in /etc/systemd/system/ (copy the template):

```bash
```sh
sudo cp systemd/thin-edge.service /etc/systemd/system/thin-edge.service
sudo chmod 664 /etc/systemd/system/thin-edge.service
```

Once the service file is added, you need to reload systemd daemon:

```bash
```sh
sudo systemctl daemon-reload
```

Now you should be able to start, stop, restart and check the service status

```bash
```sh
sudo systemctl start thin-edge
sudo systemctl stop thin-edge
sudo systemctl restart thin-edge
Expand All @@ -38,13 +38,13 @@ Now you should be able to start, stop, restart and check the service status

All daemons can be configured to start on boot:

```bash
```sh
sudo systemctl enable thin-edge
```

Logs are available via:

```bash
```sh
journalctl -u thin-edge
```

Expand All @@ -53,33 +53,33 @@ Logs are available via:
### Getting started

Copy thin-edge to /etc/init.d/thin-edge
```bash
```sh
cp /initd/tedge /etc/init.d/tedge
```

### Script usage

Start the app.

```bash
```sh
/etc/init.d/tedge start
```

Stop the app.

```bash
```sh
/etc/init.d/tedge stop
```

Restart the app.

```bash
```sh
/etc/init.d/tedge restart
```

Print current daemon status.

```bash
```sh
/etc/init.d/tedge status
```

Expand Down
61 changes: 29 additions & 32 deletions docs/src/contribute/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ thin-edge.io code is in git repository on github to acquire the code use followi

* via SSH:

```shell
```sh
git clone [email protected]:thin-edge/thin-edge.io.git
```

* or via HTTPS:

```shell
```sh
git clone https://github.com/thin-edge/thin-edge.io.git
```

Expand All @@ -47,28 +47,28 @@ git clone https://github.com/thin-edge/thin-edge.io.git
To install Rust follow [Official installation guide](https://www.rust-lang.org/tools/install).
To get started you need Cargo's bin directory (`$HOME/.cargo/bin`) in your `PATH` environment variable.

```shell
```sh
export PATH=$PATH:$HOME/.cargo/bin
```

And then you can run `rustc` to view current version:

```shell
```sh
rustc --version
```

```
```text title="Output"
rustc 1.65.0 (897e37553 2022-11-02)
```

:::note
Above command will add rust to path only for existing session,
after you restart the session you will have to add it again,
to add rust to the path permanently it will depend on your shell but for Bash,
you simply need to add the line from above, `export PATH=$PATH:$HOME/.cargo/bin` to your ~/.bashrc.
you simply need to add the line from above, `export PATH=$PATH:$HOME/.cargo/bin` to your `~/.bashrc`.

For other shells, you'll want to find the appropriate place to set a configuration at start time,
eg. zsh uses ~/.zshrc. Check your shell's documentation to find what file it uses.
eg. zsh uses `~/.zshrc`. Check your shell's documentation to find what file it uses.
:::

thin-edge.io operates the `MSRV` (Minimum Supported Rust Version) and uses stable toolchain.
Expand All @@ -82,7 +82,7 @@ Currently we support `Raspberry Pi 3B` for `armv7` architecture with Rust's cros

To install [cargo cross](https://github.com/rust-embedded/cross):

```shell
```sh
cargo install cross
```

Expand All @@ -92,7 +92,7 @@ We use [cargo deb](https://github.com/mmstick/cargo-deb) to build our debian pac

To install [cargo deb](https://github.com/mmstick/cargo-deb) use:

```shell
```sh
cargo install cargo-deb
```

Expand All @@ -106,43 +106,43 @@ As we are using `cargo workspace` for all our crates. All compiled files are pu

To compile dev profile (with debug symbols) we use following command:

```shell
```sh
cargo build
```

Build artifacts can be found in `./target/debug` and will include executables:

```shell
ls ./target/debug/tedge*
```sh
ls -l ./target/debug/tedge*
```

```
```text title="Output"
-rwxrwxr-x 2 user user 11111 Jan 1 00:00 tedge
-rwxrwxr-x 2 user user 11111 Jan 1 00:00 tedge-mapper
```

Binaries can be run eg: `./target/debug/tedge`.
Alternatively, you can use `cargo` to build and run executable in a single command:

```shell
```sh
cargo run --bin tedge
```

### Compiling release

To compile release profile we use following command:

```shell
```sh
cargo build --release
```

Build artifacts can be found in `./target/release` and will include executables:

```shell
ls ./target/release/tedge*
```sh
ls -l ./target/release/tedge*
```

```
```text title="Output"
-rwxrwxr-x 2 user user 11111 Jan 1 00:00 tedge
-rwxrwxr-x 2 user user 11111 Jan 1 00:00 tedge-mapper
```
Expand All @@ -153,21 +153,18 @@ Binaries can be run eg: `./target/release/tedge`.

Currently thin-edge.io contains 2 binaries, `tedge` (cli) and `tedge-mapper` which are packaged as separate debian packages. To create following commands are to be issued:

```shell
```sh
cargo deb -p tedge
```

```shell
cargo deb -p tedge-mapper
```

All resulting packages are going to be in: `./target/debian/` directory:

```shell
ls ./target/debian -l
```sh
ls -l ./target/debian
```

```
```text title="Output"
total 2948
-rw-rw-r-- 1 user user 11111 Jan 1 00:00 tedge_0.9.0_amd64.deb
-rw-rw-r-- 1 user user 11111 Jan 1 00:00 tedge-mapper_0.9.0_amd64.deb
Expand All @@ -177,37 +174,37 @@ total 2948

To create binaries which can run on different platform than one you are currently on you can use [cargo cross](https://github.com/rust-embedded/cross):

```shell
```sh
cross build --target armv7-unknown-linux-gnueabihf
```

Build artifacts can be found in `./target/armv7-unknown-linux-gnueabihf/debug` and will include executables:

```shell
ls ./target/armv7-unknown-linux-gnueabihf/debug/tedge*
```sh
ls -l ./target/armv7-unknown-linux-gnueabihf/debug/tedge*
```

```
```text title="Output"
-rwxrwxr-x 2 user user 11111 Jan 1 00:00 tedge
-rwxrwxr-x 2 user user 11111 Jan 1 00:00 tedge-mapper
```

To cross compile release version of the binaries just add `--release` to the above command like so:

```shell
```sh
cross build --target armv7-unknown-linux-gnueabihf --release
```

## Running tests

When contributing to thin-edge.io we ask you to write tests for the code you have written. The tests will be run by build pipeline when you create pull request, but you can easily run all the tests when you are developing with following command:

```shell
```sh
cargo test
```

This will run all tests from the repository and sometime may take long time, `cargo` allows you to run specific test or set of tests for binary:

```shell
```sh
cargo test --bin tedge
```
18 changes: 9 additions & 9 deletions docs/src/contribute/INSTALLING_DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ There are different ways to install the docker engine on MacOS, however this gui

1. Install homebrew. You can also install homebrew without `sudo` rights using this [guide](https://docs.brew.sh/Installation#untar-anywhere-unsupported)

**Tip**

* Make sure you read the homebrew instructions which are printed out on the console 😉
:::tip
Make sure you read the homebrew instructions which are printed out on the console as it will guide you to the additional setup steps.
:::

2. Install [colima](https://github.com/abiosoft/colima) and the docker cli

```
brew install colima
```
**Note**
* The installation will take a while as it will have to compile various dependencies.
:::info
The installation will take a while as it will have to compile various dependencies.
:::
3. Install the docker cli tools
Expand All @@ -49,11 +49,11 @@ There are different ways to install the docker engine on MacOS, however this gui
colima start --cpu 4 --memory 8
```
**Note**
:::info
* The extra arguments are only needed the first time you start it. You can change the settings to based on what you are need/have.
* You can adjust the number of CPUs and amount of RAM used by colima to suite your machine
* You will have to start `colima` each time your machine is restarted (as it is not configured to autostart, though there are ways on MacOS to do this)
:::
5. Check that everything is working by starting the `hello-world` container
Expand Down Expand Up @@ -101,7 +101,7 @@ After the install verify that everything is working correctly by running the fol
Some typical problems can be found here. Remember, if you don't find your error then please search online using your preferred search engine.
##### Invalid
### Invalid
Check the docker config file `~/.docker/config.json`. The credential manager setting (`credsStore`) should be set to `osxkeychain`.
Expand Down
Loading

0 comments on commit cc39c72

Please sign in to comment.