THE README HAS CONFLICTS WITH THE MAIN BRANCH AND WILL BE UPDATED SOON

OxiTraffic

Self-hosted, simple and privacy respecting website traffic tracker 🌐

Demonstration

My website mo8it.com is an example website that uses OxiTraffic. Visit the website and look for the image of Ferris (happy crab 🦀) on the bottom. Click on it to see a plot of the call history for that page. Each page on the website has its own call history.

You can visit the dashboard: oxitraffic.mo8it.com/dashboard

Try out the following API endpoints (with curl for example):

Features

How it works

TODO: Update README

How does OxiTraffic know if a newly requested path is a valid one for your tracked website?

Only for the first request to a new path, OxiTraffic sends a request to that path prefixed by the configuration option tracked_origin. If the status code is 200 (OK), the path is added to the database. Otherwise, the request is rejected.

Setup

Data directory

The binary expects the environment variable DATA_DIR_OXITRAFFIC to point to a directory that stores the YAML configuration file config.yaml.

The log file oxitraffic.log will be also placed in that directory.

Hosting

If you want to host OxiTraffic in a container, check Containerfile and compose.yaml as a starting point. The container expects the data directory to be mounted as a volume at /volumes/data.

You can also host OxiTraffic directly with the binary that you can install with Cargo:

fish cargo install oxitraffic

Make sure to provide the environment variable DATA_DIR_OXITRAFFIC when using the binary directly.

In both cases (container or binary), you need a PostgreSQL database. There are many guides in the internet that explain how to host one either in a container or directly on the host. You could use my blog post about hosting PostgreSQL using Podman.

Configuration

| Parameter | Description | Default | | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | | socketaddress | Use 127.0.0.1:8080 for testing on http://localhost:8080. 0.0.0.0 is important for usage in a container, but you can pick another port. | "0.0.0.0:80" | | trackedorigin | The origin of your tracked website | | | db.host | PostgreSQL host | | | db.port | PostgreSQL port | | | db.username | PostgreSQL username | | | db.password | PostgreSQL password | | | db.database | PostgreSQL database | | | utcoffset.hours | The hours of your UTC offset | 0 | | utcoffset.minutes | The minutes of your UTC offset | 0 |

Example configuration

```yaml socketaddress: 0.0.0.0:80 trackedorigin: https://mo8it.com

db: host: oxitraffic-db port: 5432 username: postgres password: CHANGE_ME database: postgres

utc_offset: hours: 2 minutes: 0 ```

Usage

OxiTraffic has the following endpoints:

Questions?

Don't hesitate to open an issue ^^

Contributing

You are welcome to contribute to the project!

You can always open an issue. Wait for a response on the issue before starting with a pull request (Rejected pull request are very disappointing).

Use Clippy and rustfmt before submitting code :)