matrix-org / panopticon

panopticon records usage metrics from homeservers
Apache License 2.0
13 stars 6 forks source link

Support mysql backend #6

Closed NegativeMjark closed 7 years ago

erikjohnston commented 7 years ago

I have zero idea if this works.

NegativeMjark commented 7 years ago

I've tested it locally using:

./panopticon --port 9001 --db-driver mysql --db "root:aaaaa@tcp/panopticon" &
curl -d '{"daily_active_users": 10, "timestamp": 20, "total_users": 123, "total_room_count": 17, "daily_messages": 9, "uptime_seconds": 19, "homeserver": "many.turtles"}' http://localhost:9001/push

It seems to successfully create the table and write the stats.

NegativeMjark commented 7 years ago

It looks like all the changes needed were the usual mysql annoyances.

I've left the sqlite3 support for now, but it would be reasonably easy to remove it to make the code simpler.