Skip to content

Commit

Permalink
docs: udpate installation docs
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed May 7, 2024
1 parent 690d1d2 commit 3dee03e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 20 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ The following services are provided by the default configuration:

## Documentation

You can read the [latest documentation][docs] from <https://docs.rs/>.

Some specific sections:

- [Management API (Version 1)][API]
- [Tracker (HTTP/TLS)][HTTP]
- [Tracker (UDP)][UDP]
Expand Down
70 changes: 50 additions & 20 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,29 +109,47 @@
//! With the default configuration you will need to create the `storage` directory:
//!
//! ```text
//! storage/
//! ├── database
//! │   └── data.db
//! └── tls
//! ├── localhost.crt
//! └── localhost.key
//! ./storage/
//! └── tracker

Check warning on line 113 in src/lib.rs

View check run for this annotation

Codecov / codecov/patch

src/lib.rs#L113

Added line #L113 was not covered by tests
//! ├── etc
//! ├── lib
//! │   ├── database
//! │   │   └── sqlite3.db
//! │   └── tls
//! └── log
//! ```
//!
//! The default configuration expects a directory `./storage/tracker/lib/database` to be writable by the tracker process.
//!
//! By default the tracker uses `SQLite` and the database file name `data.db`.
//! By default the tracker uses `SQLite` and the database file name `sqlite3.db`.
//!
//! You only need the `tls` directory in case you are setting up SSL for the HTTP tracker or the tracker API.
//! Visit [`HTTP`](crate::servers::http) or [`API`](crate::servers::apis) if you want to know how you can use HTTPS.
//!
//! ## Install from sources
//!
//! First, you need to create a folder to clone the repository.
//!
//! ```text
//! cd /tmp
//! mkdir torrust
//! ```
//!
//! ```text
//! git clone https://github.com/torrust/torrust-tracker.git \
//! && cd torrust-tracker \
//! && cargo build --release \
//! && mkdir -p ./storage/tracker/etc \
//! && mkdir -p ./storage/tracker/lib/database \
//! && mkdir -p ./storage/tracker/lib/tls
//! && mkdir -p ./storage/tracker/lib/tls \
//! && mkdir -p ./storage/tracker/log
//! ```
//!

Check warning on line 147 in src/lib.rs

View check run for this annotation

Codecov / codecov/patch

src/lib.rs#L147

Added line #L147 was not covered by tests
//! To run the tracker we will have to use the command "cargo run" this will
//! compile and after being compiled it will start running the tracker.
//!
//! ```text
//! cargo run

Check warning on line 152 in src/lib.rs

View check run for this annotation

Codecov / codecov/patch

src/lib.rs#L151-L152

Added lines #L151 - L152 were not covered by tests
//! ```
//!
//! ## Run with docker
Expand All @@ -141,9 +159,10 @@
//!
//! # Configuration
//!
//! In order to run the tracker you need to provide the configuration. If you run the tracker without providing the configuration,
//! the tracker will generate the default configuration the first time you run it. It will generate a `tracker.toml` file with
//! in the root directory.
//! In order to run the tracker you need to provide the configuration. If you

Check warning on line 162 in src/lib.rs

View check run for this annotation

Codecov / codecov/patch

src/lib.rs#L162

Added line #L162 was not covered by tests
//! run the tracker without providing the configuration, the tracker will
//! generate the default configuration the first time you run it. It will
//! generate a `tracker.toml` file with in the root directory.

Check warning on line 165 in src/lib.rs

View check run for this annotation

Codecov / codecov/patch

src/lib.rs#L164-L165

Added lines #L164 - L165 were not covered by tests
//!
//! The default configuration is:
//!
Expand Down Expand Up @@ -187,26 +206,37 @@
//! bind_address = "127.0.0.1:1313"
//!```
//!
//! The default configuration includes one disabled UDP server, one disabled HTTP server and the enabled API.
//! The default configuration includes one disabled UDP server, one disabled
//! HTTP server and the enabled API.
//!
//! For more information about each service and options you can visit the documentation for the [torrust-tracker-configuration crate](https://docs.rs/torrust-tracker-configuration).
//! For more information about each service and options you can visit the
//! documentation for the [torrust-tracker-configuration crate](https://docs.rs/torrust-tracker-configuration).
//!
//! Alternatively to the `tracker.toml` file you can use one environment variable `TORRUST_TRACKER_CONFIG` to pass the configuration to the tracker:
//! Alternatively to the `tracker.toml` file you can use one environment
//! variable `TORRUST_TRACKER_CONFIG` to pass the configuration to the tracker:
//!
//! ```text
//! TORRUST_TRACKER_CONFIG=$(cat tracker.toml)
//! cargo run
//! TORRUST_TRACKER_CONFIG=$(cat ./share/default/config/tracker.development.sqlite3.toml) ./target/release/torrust-tracker
//! ```
//!
//! In the previous example you are just setting the env var with the contents of the `tracker.toml` file.
//! In the previous example you are just setting the env var with the contents
//! of the `tracker.toml` file.
//!
//! The env var contains the same data as the `tracker.toml`. It's particularly
//! useful in you are [running the tracker with docker](https://github.com/torrust/torrust-tracker/tree/develop/docker).
//!
//! > NOTICE: The `TORRUST_TRACKER_CONFIG` env var has priority over the `tracker.toml` file.
//!
//! The env var contains the same data as the `tracker.toml`. It's particularly useful in you are [running the tracker with docker](https://github.com/torrust/torrust-tracker/tree/develop/docker).
//! By default, if you don’t specify any `tracker.toml` file, the application
//! will use `./share/default/config/tracker.development.sqlite3.toml`.
//!
//! > NOTE: The `TORRUST_TRACKER_CONFIG` env var has priority over the `tracker.toml` file.
//! > IMPORTANT: Every time you change the configuration you need to restart the
//! service.
//!
//! # Usage
//!
//! Running the tracker with the default configuration and enabling the UDP and HTTP trackers will expose the services on these URLs:
//! Running the tracker with the default configuration and enabling the UDP and
//! HTTP trackers will expose the services on these URLs:
//!
//! - REST API: <http://localhost:1212>
//! - UDP tracker: <http://localhost:6969>
Expand Down

0 comments on commit 3dee03e

Please sign in to comment.