Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A database should be optional #151

Closed
mickvandijke opened this issue Dec 29, 2022 · 5 comments
Closed

A database should be optional #151

mickvandijke opened this issue Dec 29, 2022 · 5 comments
Labels
- Admin - Enjoyable to Install and Setup our Software Enhancement / Feature Request Something New Optimization Make it Faster

Comments

@mickvandijke
Copy link
Member

mickvandijke commented Dec 29, 2022

The tracker only needs a database if it wants to persist torrent statistics and private tracker keys between reboots. In all other cases a database should not be necessary.

@josecelano
Copy link
Member

Hi @WarmBeer, the tracker can persist:

  • Authentication keys for the HTTP tracker
  • Torrents that are whitelisted
  • Number of completed peers (seeders) for each torrent. That's what you call "torrent statistics", don't you?

Right now, the database is mandatory, but you can switch off "statistics persistence" with the core config option: persistent_torrent_completed_stat, right?

Could you elaborate on how you think we should implement this issue?

I suppose you want to have an extra config option to totally disable the database or maybe one independent flag for each feature?:

  • persistent_whitelist
  • persistent_http_auth_keys
  • persistent_torrent_completed_stat

@mickvandijke
Copy link
Member Author

Hi @josecelano ,

Hi @WarmBeer, the tracker can persist:

  • Authentication keys for the HTTP tracker
  • Torrents that are whitelisted
  • Number of completed peers (seeders) for each torrent. That's what you call "torrent statistics", don't you?

Right now, the database is mandatory, but you can switch off "statistics persistence" with the core config option: persistent_torrent_completed_stat, right?

Correct.

Could you elaborate on how you think we should implement this issue?

I suppose you want to have an extra config option to totally disable the database or maybe one independent flag for each feature?:

  • persistent_whitelist
  • persistent_http_auth_keys
  • persistent_torrent_completed_stat

Yes I think an independent flag for each feature would be nice. We could add a ‘[persistency]’ section to the config options with these three flags. And I suppose that the database url config option could also move to this section.

@josecelano
Copy link
Member

josecelano commented Aug 8, 2023

Making the database optional would allow running the tracker without depending on the file system. We could:

  • Not use the database file (data.db) required for SQLite.
  • Not use the config file (config.toml). Use the env var instead. This is already possible.

With no file system dependency, we could run more straightforward docker commands to run a tracker using the docker. Instead of running:

export TORRUST_TRACKER_USER_UID=1000 \
  && docker run -it \
    --user="$TORRUST_TRACKER_USER_UID" \
    --publish 6969:6969/udp \
    --publish 7070:7070/tcp \
    --publish 1212:1212/tcp \
    --volume "$(pwd)/storage":"/app/storage" \
    --volume "$(pwd)/config.toml":"/app/config.toml":ro \
    torrust/tracker:3.0.0-alpha.3

We could run:

export TORRUST_TRACKER_USER_UID=1000 \
  && docker run -it \
    --user="$TORRUST_TRACKER_USER_UID" \
    --publish 6969:6969/udp \
    --publish 7070:7070/tcp \
    --publish 1212:1212/tcp \
    torrust/tracker:3.0.0-alpha.3

Without mounting any volume.

See #367

@da2ce7 da2ce7 added - Admin - Enjoyable to Install and Setup our Software Optimization Make it Faster labels Oct 10, 2023
@josecelano
Copy link
Member

I'm going to close this issue @WarmBeer. I think it's only a reminder that we should not make the database mandatory unless you are using a feature that requires persistence.

@josecelano
Copy link
Member

@WarmBeer if you want, we can create an ADR like this as a reminder that we would prefer the core tracker not to use persistence or allow running it without persistence (if you do not enable a feature that requires persistence).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- Admin - Enjoyable to Install and Setup our Software Enhancement / Feature Request Something New Optimization Make it Faster
Projects
Status: Done
Archived in project
Development

No branches or pull requests

4 participants