Skip to content

Commit

Permalink
Update dependencies, add worker events.
Browse files Browse the repository at this point in the history
  • Loading branch information
plietar committed Nov 20, 2024
1 parent 427e1e4 commit 45c34aa
Show file tree
Hide file tree
Showing 19 changed files with 2,558 additions and 17,931 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
web/node_modules
web/dist
2 changes: 1 addition & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: docker/build-push-action@v5
with:
build-args:
PUBLIC_URL=/rrq
BASE_URL=/rrq/
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
web/node_modules
web/dist
19 changes: 10 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
ARG PUBLIC_URL=/
ARG BASE_URL=/

FROM node:22
ARG PUBLIC_URL
ARG BASE_URL
WORKDIR /src

COPY web/package.json /src
COPY web/package-lock.json /src
RUN npm ci

COPY web /src
RUN PUBLIC_URL=${PUBLIC_URL} npm run build
RUN npm run build -- --base=${BASE_URL}

FROM rocker/r-ver:latest
ARG PUBLIC_URL
ARG BASE_URL

RUN R -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))'

COPY DESCRIPTION /src/DESCRIPTION
RUN R -e 'pak::local_install_deps("/src")'

COPY . /src
COPY NAMESPACE /src
COPY R /src/R
COPY inst /src/inst
RUN R -e 'pak::local_install("/src")'

COPY --from=0 /src/build/static /static
COPY --from=0 /src/build/index.html /static/index.html
COPY --from=0 /src/dist /static

COPY --chmod=755 <<EOF /usr/local/bin/rrq.dashboard
#!/usr/bin/env Rscript
rrq.dashboard:::main()
EOF

ENV PUBLIC_URL=${PUBLIC_URL}
CMD exec rrq.dashboard --static=/static --base-path=${PUBLIC_URL}
ENV BASE_URL=${BASE_URL}
CMD exec rrq.dashboard --static=/static --base-path=${BASE_URL}
EXPOSE 8888
7 changes: 5 additions & 2 deletions R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ redis_scan <- function(con, pattern) {

target_controller_list <- function(con) {
function() {
scan <- redis_scan(con, "rrq:*:controller")
# SCAN is really slow but is incremental,
# KEYS is much faster but is a single operation which can block.
# redis_scan(con, "rrq:*:controller")
scan <- con$KEYS("rrq:*:controller")
ids <- sub("(.*):controller$", "\\1", scan)
keys <- rrq:::rrq_keys(ids)$controller

Expand Down Expand Up @@ -246,7 +249,7 @@ router <- function(

if (!is.null(static)) {
r <- r |>
plumber::pr_static("/static", static) |>
plumber::pr_static("/assets", file.path(static, "assets")) |>
plumber::pr_get("/", function(req, res) {
plumber::include_html(file.path(static, "index.html"), res)
})
Expand Down
15 changes: 15 additions & 0 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="A dashboard for rrq tasks"/>
<title>rrq dashboard</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
</body>
</html>

Loading

0 comments on commit 45c34aa

Please sign in to comment.