Commit Graph

245 Commits

Author SHA1 Message Date
0d30011a33 break down release versions and fix server tests 2023-09-12 15:44:03 -04:00
60a0e20dd9 extract server object to its own package 2023-09-12 15:44:03 -04:00
02b1e8287d isolate all server handlers into a single struct, without using global variables 2023-09-12 15:44:01 -04:00
50c74e5881 Rename a bunch of DB functions + add error checking for DB table creation (follow up to #104) 2023-09-12 08:30:43 -07:00
eaa837d17d fix check for empty array result (II) 2023-09-11 16:37:55 -04:00
ff2ac2194d fix %w 2023-09-11 13:03:29 -04:00
f9ee8ed189 use DateOnly as local constant instead of using the imported time package 2023-09-11 10:15:42 -04:00
3c18f62d99 finishing removing direct DB instructions from http handlers 2023-09-08 10:58:01 -04:00
0d6aa081d8 remove direct db instructions from apiRegisterHandler and statsHandler 2023-09-08 10:58:01 -04:00
382f234c09 remove usage_data related queries from the main package into a database package 2023-09-08 10:58:01 -04:00
a3e6d5a940 docker improvements:
* use alpine for small docker images
* use docker compose to wait for the database to be ready
* use a single Dockerfile with parameters to determine the correct GOARCH
* update makefile to account for the new GOARCH parameter on the Dockerfile
* remove native-arch-Dockerfile
2023-09-07 11:06:32 -04:00
aa3c7fc41a Follow up to #103: assign err from fmt.Fprintf to _ to ensure go-errcheck doesn't flag it 2023-09-07 07:57:20 -07:00
68e3a813c9 Follow up to #103: pull context from r.Context() when used rather than at the start of functions 2023-09-07 07:56:03 -07:00
e6d922709d fix tests 2023-09-07 09:50:36 -04:00
37670230af Merge remote-tracking branch 'origin/master' into sergio/handlers 2023-09-07 09:33:42 -04:00
589b99e500 do not use http.StatusNoContent 2023-09-07 08:34:21 -04:00
2a95553fdf Fix install.py script for arm7 so installs work on raspberry pis 2023-09-06 21:35:28 -07:00
2b1ba7e3ba use single context and always return a status to the client
api handlers do not need an extra context. http.Request already has a context that is being ignored, so we leverage it and stop creating a new one.
make the endpoints return http.StatusNoContent instead of just closing the connection from the client.
2023-09-06 11:37:14 -04:00
83ad8c7b1f wrap errors with %w instead of using %v 2023-09-05 15:08:55 -04:00
f1aefdbf30 Fix download URL for arm7 2023-02-18 22:29:01 -08:00
27cd544524 Add support for arm7 for #63 to support raspberry pis 2023-02-18 22:00:39 -08:00
8dc5168c64 Set max open conns to 1 for test code to fix race conditions that lead to flaky tests 2023-02-13 20:50:33 -08:00
f502cbee1d Fix memory leak caused by not closing resp.Body (#62) and also fix the server to work when the DD integration is disabled 2022-12-23 17:17:44 -08:00
06a4bf0bcb Add code to deep clean the DB to remove entries from people with 1 device that haven't been active in at least 90 days 2022-12-17 21:27:00 -08:00
956377d472 linux arm is called aarch64, see #48 2022-12-12 19:45:54 -08:00
83667a52f4 Fix #51 by changing if --> elif 2022-12-12 19:44:02 -08:00
7c86b812bf Add support for linux arm64 for #48 2022-12-11 20:39:45 -08:00
857e423e10 Fix linter errors + some general clean up 2022-12-11 20:31:50 -08:00
9ed325e0a5 Add support for limiting the number of registrations to fix #46 2022-12-11 19:42:51 -08:00
35444bf56e Swap ioutil to non-deprecated alternatives + clean up pre-commit errors 2022-11-27 11:59:06 -08:00
3985010a17 Add test for the healthcheck endpoint 2022-11-26 22:53:14 -08:00
22330f3ee1 Ensure that tests assert a lack of leaked connections 2022-11-26 22:40:43 -08:00
f77eb38618 Rename misleading var 2022-11-26 22:16:11 -08:00
2ba535b650 Call Close() on sql.Rows to prevent connection leak 2022-11-26 22:15:16 -08:00
4e84f49de9 Revert "Move usage data into tx to optimize updating usage data"
This reverts commit aa501262e6.
2022-11-26 18:59:32 -08:00
aa501262e6 Move usage data into tx to optimize updating usage data 2022-11-26 18:46:20 -08:00
865ce06b95 Optimize healthcheck handler to avoid unnecessary ping in prod + add prod-only config for connection reuse 2022-11-26 18:33:54 -08:00
a98bff0db8 Optimize query latency by moving the read count incrementing to a background task 2022-11-26 12:10:18 -08:00
c603537137 Optimize the apiSubmit function to ensure that it doesn't lead to errors from large insertions 2022-11-26 10:31:43 -08:00
8d87110405 Optimize the healthcheck analyzer to avoid a full table scan 2022-11-25 20:35:17 -08:00
1ce20157c7 Add datadog integration for monitoring the server 2022-11-25 20:04:40 -08:00
8dd9c1d9e4 Create the feedback table in pg 2022-11-20 00:12:41 -08:00
97d7c7e310 Add last registration date to internal status page 2022-11-19 09:41:40 -08:00
0bd9249df3 Update the healthcheck endpoint so it also writes to the DB to detect future cases of #38 2022-11-17 23:43:25 -08:00
d4efc62df1 Add client-side code to ask for feedback when uninstalling 2022-11-16 21:54:05 -08:00
48c77d88f7 Add endpoint to handle feedback reports 2022-11-16 21:42:07 -08:00
78d33cf437 Make the healthcheck endpoint work for non-global production instance usages to fix #35 2022-11-16 20:58:19 -08:00
fd3d932e9d Document that the server can use sqlite 2022-11-16 20:54:47 -08:00
4aacd8b5e2 Merge pull request #31 from matthewcmead/sqlite_for_server
allow for sqlite backend database for low-profile self-hosting deploy…
2022-11-16 20:50:34 -08:00
35208680d8 Improve debug logs in server.go 2022-11-16 20:26:44 -08:00