Commit graph

35 commits

Author SHA1 Message Date
e96234488f Add BUILDER_WEB_DATADIR env, fix bug
The builder-web commands now understand the BUILDER_WEB_DATADIR
environment variable which is used as --datadir.

During a change the transaction when vacuuming was committed twice which
is an error in sqlite. This was found during testing.
2024-02-13 14:23:25 +01:00
bfa06c95f8 whitespace-cleanup 2023-09-19 15:07:47 +02:00
848186bd1a make the expiry of jobs configurable via cli (default 30) 2023-09-19 15:07:47 +02:00
fde834ad02 Initialize rng 2023-09-19 15:07:12 +02:00
f666c9d0d1 Improve builder-web setup error messages
Give hints what to do in case the database file does not exist, or when
the database is not of the expected version.

Addresses #82
2022-07-15 12:52:21 +02:00
rand00
3e23b4a5bf Implemented general error-handler + Added special error-page for iframes/vizs 2022-07-15 10:51:57 +02:00
rand00
c533ea7c07 Made Builder_web.routes be a list of methods, routes and handlers - to become testable without depending on DB 2022-07-12 13:14:52 +02:00
09a180c3cd Automatic viz migration on builder-web startup (#111)
Co-authored-by: rand00 <oth.rand@gmail.com>
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/111
Co-authored-by: Reynir Björnsson <reynir@reynir.dk>
Co-committed-by: Reynir Björnsson <reynir@reynir.dk>
2022-06-08 10:18:46 +00:00
3de78b1113 Update to dream.1.0.0~alpha4
- Dream.path is deprecated. For now the deprecation is suppressed.

- Remove unused dream_svg.

- Remove datadir global. The datadir variable is in scope already, and
  global variables were removed in alpha3.

- Dream_tar.tar_response: flush before closing. It's unclear if this is
  necessary.

- Change Builder_web.add_routes to Builder_web.routes returning a list
  of routes, and in Builder_web_app construct the router.

- Builder_web.not_found is removed due to changes in Dream.router. It
  seems an error handler might be the way forward.
2022-04-22 12:37:01 +01:00
rand
0f493e9b47 Removing trailing slashes (#80)
This PR solves the issue of there being both "<url>/" and "<url>" paths, that in the builder-web context shouldn't mean different things.

The slashes are now removed using a `Dream` middleware, and the request is redirected using a permanent redirect (that doesn't change the method used): https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location

Notable changes:
* Trailing slashes from the hardcoded link urls were removed, as unneccesary redirects are then avoided.
* All links in `Views` were rewritten to be absolute instead of relative.
* As `Dream` deprecated `path` - `Utils.Path` was created containing some helpers for manipulating paths. *Note that `String.split_on_char` has a different semantics.*
* A blacklist `routeprefix_blacklist_when_removing_trailing_slash` was added, containing `Dream` route-prefixes to ignore.
* Only `GET` and `HEAD` requests are redirected.
* `redirect_parent` helper was rewritten using new `Utils.Path` functions to avoid brittle string manipulation + fixed the edgecase of redirecting to `/`.
* Added `Uri` dependency to make URL manipulation safer.

Co-authored-by: rand00 <oth.rand@gmail.com>
Co-authored-by: Reynir Björnsson <reynir@reynir.dk>
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/80
Co-authored-by: rand <rand@r7p5.earth>
Co-committed-by: rand <rand@r7p5.earth>
2022-04-21 10:40:21 +00:00
rand00
6a1c8b0ecd Builder_web_app: Fixed type-error + some 80-column fixes 2022-04-11 18:12:23 +02:00
1adc67c297 minor nits 2022-04-11 16:26:58 +02:00
rand00
68849fecf3 Fixed that cachedir should default to being relative to given datadir 2022-04-06 13:47:07 +02:00
rand00
ab3be6ec8e builder-web: Added --cachedir CLI arg for staging new vizs 2022-03-29 22:27:24 +02:00
rand00
f68f383ba6 Fixed all binaries using cmdliner to avoid newly deprecated functions 2022-03-16 10:40:35 +00:00
f7bc55f2e3 execute all executables in <conigdir>/upload-hooks when an upload succeeded
Only uploads with a single main binary invoke the hooks (since they use the
main_binary)
2022-02-21 13:05:16 +00:00
rand00
550dd59a19 Builder-web: Implemented better page-not-found 2022-02-21 12:13:51 +00:00
Robur
b43c6f4d79 Refactor default_datadir into library builder_system 2021-11-12 13:22:43 +00:00
977678b325 Detect datadir by platform 2021-11-12 13:04:51 +00:00
Robur
d986d614a8 Add http status metrics middleware 2021-06-08 12:36:53 +00:00
8f4a45bf76 Revise error handling
- also validate UUID to be 36 characters
- also error with not_found for unknown jobs
2021-06-08 10:26:57 +00:00
Robur
10351c65bd Migrate to dream 2021-06-01 14:06:36 +00:00
User Builder
af1ed4cbc7 ignore sigpipe 2021-06-01 08:38:25 +00:00
User Builder
8a8dd9a14b Add influx metrics reporting 2021-06-01 08:38:25 +00:00
User Builder
f7eafc56c5 prefix log lines with timestamp 2021-06-01 08:38:24 +00:00
fbe8748c02 Fix --datadir
It was erroneously specified as ----datadir
2021-05-18 17:02:45 +02:00
759172c4a7 Add --datadir parameter 2021-05-17 11:52:52 +02:00
8d211dc831 Check database version
Exit if the application id and user version are not as expected.
2021-02-17 14:15:57 +01:00
af505853e6 Database file is in /var/db/builder-web/ 2021-01-22 10:59:03 +01:00
0f98541feb Store files on disk 2021-01-21 17:51:58 +01:00
01babd0d0d User authentication and upload endpoint 2021-01-21 10:11:37 +01:00
5298108d1a Implement sqlite database backed builder-web 2021-01-19 10:44:32 +01:00
cd1cdcc9bb Implement meta data caching
Also print builds by their start time instead of UUID
2020-12-07 15:43:54 +01:00
41b0b6c031 Implement job, job run 2020-12-07 10:17:49 +01:00
0a92bdae65 Initial commit 2020-12-04 18:10:21 +01:00