Comments (3)
I'm trying to understand how it works. I have persistence, whitelist, keys and users set to true. I've added a hash to whitelist, tried to announce to the tracker, to make it work I have to add a key through the api and then says working and it adds a record in the torrents table, yet nothing is persisted in the keys table. I tried to add a used through the API, says "OK", but also not persisted in the DB.
Can someone help me understand how it works? How to persist users. Now after I add a key and use it, if I stop the client, the key is lost.
I'll look at it tomorrow.
Could be something is not "saving" when persistency is enabled.
I've not looked at this part of the code for some time, since I've been busy with the public tracking system.
from torrust-actix.
Thank you @Power2All
These are the steps I did after adding a whitelist hash.
My guess is I'm doing something wrong, but I can't seem to find out what.
- Add seeder with announce
https://tracker.domain.com:6969/announce/2234567890123456789012345678901234567890
( 'Invalid Key' ) - Add key using API: POST
/api/keys/2234567890123456789012345678901234567890/0?token=mytoken
( Now in the client status 'Working' ) - Did the same with a leecher
https://tracker.domain.com:6969/announce/1234567890123456789012345678901234567890
- Trying to add a user using POST
https://tracker.domain.com:8080/api/user?token=mytoken
and JSON data
{
"uuid":"11scbeca840-e9f7-44d5-a1e4-51e9aef864a7",
"key":"1234567890123456789012345678901234567890",
"uploaded":0,
"downloaded":0,
"completed":0,
"updated":1686302997,
"active":1
}
Get response
{
"status": "ok"
}
- Then if I list the users
/api/users?token=mytoken
response is
{
"status": "json parse error"
}
This is in the console
2024-02-06 14:37:37.000367710 [INFO ][torrust_actix] [KEYS] Checking now for old keys, and remove them.
2024-02-06 14:37:37.000406821 [INFO ][torrust_actix] [KEYS] Keys cleaned up.
2024-02-06 14:37:37.000410662 [INFO ][torrust_actix] [STATS] Torrents: 1 - Updates: 0 - Shadow 0: - Seeds: 1 - Peers: 1 - Completed: 0
2024-02-06 14:37:37.000446561 [INFO ][torrust_actix] [STATS] Whitelists: 1 - Blacklists: 0 - Keys: 0
2024-02-06 14:37:37.000472682 [INFO ][torrust_actix] [STATS TCP IPv4] Connect: 8 - API: 5 - Announce: 3 - Scrape: 0
2024-02-06 14:37:37.000481342 [INFO ][torrust_actix] [STATS TCP IPv6] Connect: 0 - API: 0 - Announce: 0 - Scrape: 0
2024-02-06 14:37:37.000488396 [INFO ][torrust_actix] [STATS UDP IPv4] Connect: 0 - Announce: 0 - Scrape: 0
2024-02-06 14:37:37.000496987 [INFO ][torrust_actix] [STATS UDP IPv6] Connect: 0 - Announce: 0 - Scrape: 0
2024-02-06 14:37:37.017203426 [INFO ][torrust_actix] [SAVING] Starting persistence saving procedure.
2024-02-06 14:37:37.017223960 [INFO ][torrust_actix] [SAVING] Moving Updates to Shadow...
2024-02-06 14:37:37.017236671 [INFO ][torrust_actix] [SAVING] Saving data from Shadow to database...
2024-02-06 14:37:37.017848276 [INFO ][torrust_actix] [SAVING] Clearing shadow, saving procedure finishing...
2024-02-06 14:37:37.017868809 [INFO ][torrust_actix] [SAVING] Torrents saved.
2024-02-06 14:37:37.017878307 [INFO ][torrust_actix] [SAVING] Saving data from Whitelist to database...
2024-02-06 14:37:37.018239529 [INFO ][torrust_actix] [SAVING] Whitelists saved.
2024-02-06 14:37:37.018251263 [INFO ][torrust_actix] [SAVING] Saving data from Keys to database...
2024-02-06 14:37:37.018444375 [INFO ][torrust_actix] [SAVING] Keys saved.
2024-02-06 14:37:37.018453385 [INFO ][torrust_actix] [SAVING] Saving data from Users to database...
2024-02-06 14:37:37.018638536 [INFO ][torrust_actix] [SAVING] Users saved.
2024-02-06 14:37:37.018647615 [INFO ][torrust_actix] [SAVING] Saving persistent data procedure done.
Now I changed it to MySQL, but first I tried SQlite file. It created whitelist, keys and torrents table by itself, but no users table.
After I changed to MySQL, no tables were created, in the console was trowing errors when trying to save torrents and whitelist, I created manually the tables and it worked.
In both SQLite and MySQL I did not have a user table, but also never seen an error in the console.
And this is the config I used
log_level = "info"
log_console_interval = 60
statistics_enabled = true
global_check_interval = 10
db_driver = "mysql"
db_path = "mysql://root:password@localhost:3306/tracker"
persistence = true
persistence_interval = 60
api_key = "mytoken"
whitelist = true
blacklist = false
keys = true
keys_cleanup_interval = 60
users = true
maintenance_mode_enabled = false
interval = 1800
interval_minimum = 1800
peer_timeout = 2700
peers_returned = 200
interval_cleanup = 900
cleanup_chunks = 100000
[[udp_server]]
enabled = false
bind_address = "0.0.0.0:6969"
[[http_server]]
enabled = true
bind_address = "0.0.0.0:6969"
ssl = true
ssl_key = "/home/user/torrust-actix/target/release/privkey.pem"
ssl_cert = "/home/user/torrust-actix/target/release/cert.pem"
[[api_server]]
enabled = true
bind_address = "0.0.0.0:8080"
ssl = true
ssl_key = "/home/user/torrust-actix/target/release/privkey.pem"
ssl_cert = "/home/user/torrust-actix/target/release/cert.pem"
[db_structure]
db_torrents = "torrents"
table_torrents_info_hash = "info_hash"
table_torrents_completed = "completed"
db_whitelist = "whitelist"
table_whitelist_info_hash = "info_hash"
db_blacklist = "blacklist"
table_blacklist_info_hash = "info_hash"
db_keys = "keys"
table_keys_hash = "hash"
table_keys_timeout = "timeout"
db_users = "users"
table_users_uuid = "uuid"
table_users_key = "key"
table_users_uploaded = "uploaded"
table_users_downloaded = "downloaded"
table_users_completed = "completed"
table_users_updated = "updated"
table_users_active = "active"
from torrust-actix.
Problem might have been found.
The table was not created of an "bug".
Will be fixed anyway on the v3.2.2 release when it's done.
You can use the following query in MySQL to create the table:
CREATE TABLE IF NOT EXISTS `users` ( `uuid` varchar(36) NOT NULL, `key` varchar(40) NULL, `uploaded` int NOT NULL DEFAULT '0', `downloaded` int NOT NULL DEFAULT '0', `completed` int NOT NULL DEFAULT '0', `updated` int NOT NULL DEFAULT '0', `active` int NOT NULL DEFAULT '0', PRIMARY KEY (`uuid`) USING BTREE, UNIQUE KEY `uuid` (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
And for SQLite:
CREATE TABLE users (uuid VARCHAR(36) PRIMARY KEY, key VARCHAR(40) NULL, uploaded INTEGER DEFAULT 0 NOT NULL, downloaded INTEGER DEFAULT 0 NOT NULL, completed INTEGER DEFAULT 0 NOT NULL, updated INTEGER DEFAULT 0 NOT NULL, active INTEGER DEFAULT 0 NOT NULL)
from torrust-actix.
Related Issues (20)
- Database structure configurable HOT 1
- Refactoring HOT 1
- Broken UDP IPv4 handling HOT 1
- SQLite3 saving is very slow, even when using :memory:, needs testing and optimization HOT 1
- Defragmentation of BTreeMaps HOT 4
- [v3.2.0] Adding memory efficiency HOT 1
- [v3.2.0] Adding support for "plugins" HOT 1
- [v3.2.0] Adding a plugin for handling user accounts HOT 1
- [v3.2.0] Adding a conversion code, to switch things between database engines HOT 1
- [v3.2.0] Replace RwLock with Crossbeam Channel, for performance reasons HOT 1
- Any way we can use postgres and assign a table to write to HOT 9
- Get info of file from torrent hash HOT 1
- How to configure it to work with both ipv4 and ipv6? HOT 5
- Adding WebTorrent support
- Complete overhaul of the code, after discussion with friends
- Removing web interface, will be separate project
- Adding testing code for specific things to be sure it is working as intended
- Error SSL HOT 2
- Allowing Dual Stack Peers (IPv4 and IPv6) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torrust-actix.