From 6077c3c279e69b84e9c225c810e3e0b453b90845 Mon Sep 17 00:00:00 2001 From: lennart <lennkrad@gmail.com> Date: Mon, 8 Feb 2021 12:34:49 +0100 Subject: [PATCH] adjust maximal number of threads 32 also add /goemaxima to paths --- .gitignore | 1 + Dockerfile | 6 +++--- README.md | 6 ++++++ src/maxima_fork.c | 4 +++- src/web/web.go | 11 +++++++---- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index fa44107..1b2f190 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ tags [._]*.un~ bin +src/web/web diff --git a/Dockerfile b/Dockerfile index 8a1d927..4e02f16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM debian:stable # e.g. 5.41.0 ARG MAXIMA_VERSION -# e.g. 2.0.22.0.2 +# e.g. 2.0.2 ARG SBCL_VERSION ENV SRC=/opt/src \ @@ -35,7 +35,7 @@ RUN grep stackmaximaversion ${LIB}/stackmaxima.mac | grep -oP "\d+" >> /opt/maxi && cd ${ASSETS} \ && maxima -b optimize.mac \ && mv maxima-optimised ${BIN}/maxima-optimised \ - && for i in $(seq 16); do \ + && for i in $(seq 32); do \ useradd -M "maxima-$i"; \ done @@ -45,7 +45,7 @@ COPY ./bin/web ${BIN}/goweb ENV GOEMAXIMA_LIB_PATH=/opt/maxima/assets/maximalocal.mac ENV LANG C.UTF-8 -EXPOSE 80 +EXPOSE 8080 # rm /dev/tty because we do not want it to be opened by maxima for security reasons, # and clear tmp because when kubernetes restarts a pod, it keeps the /tmp content even if it's tmpfs, diff --git a/README.md b/README.md index e555132..2deef32 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,12 @@ $ ./buildimage.sh 2020061000 The image should then be available as `goemaxima:2020061000-dev`. +Using the Docker Image +====================== + +The prebuilt docker images are available from the docker hub at `mathinstitut/goemaxima:[version]-latest`. + +The port of the server in the container is `8080` and the path that has to be input into stack is `http://[address:port]/goemaxima`. License ======= diff --git a/src/maxima_fork.c b/src/maxima_fork.c index 6c4dd21..c32298b 100644 --- a/src/maxima_fork.c +++ b/src/maxima_fork.c @@ -14,7 +14,9 @@ #include <bsd/unistd.h> #include <limits.h> #include <grp.h> -#define N_SLOT 16 +#ifndef N_SLOT +#define N_SLOT 32 +#endif #define RNOFILE 256 #define FILEPATH_LEN (PATH_MAX + 1) char filepath[FILEPATH_LEN]; diff --git a/src/web/web.go b/src/web/web.go index 75f34ea..6402eeb 100644 --- a/src/web/web.go +++ b/src/web/web.go @@ -463,7 +463,7 @@ func main() { log.Fatal("Fatal: wrong cli-argument usage: web [path to maxima executable]") } // number of maxima users - user_number, err := get_env_number_positive("GOEMAXIMA_NUSER", 16) + user_number, err := get_env_number_positive("GOEMAXIMA_NUSER", 32) if err != nil { log.Fatal("Fatal: GOEMAXIMA_NUSER contains invalid number"); } @@ -522,10 +522,13 @@ func main() { go generate_maximas(os.Args[1], os.Getenv("GOEMAXIMA_LIB_PATH"), queue, user_queue, &metrics) http.Handle("/metrics", promhttp.Handler()) - http.HandleFunc("/maxima/", - func (w http.ResponseWriter, r *http.Request) { + handler := func (w http.ResponseWriter, r *http.Request) { handler(w, r, queue, user_queue, &metrics) - }) + } + http.HandleFunc("/maxima", handler) + http.HandleFunc("/maxima/", handler) + http.HandleFunc("/goemaxima", handler) + http.HandleFunc("/goemaxima/", handler) log.Print("Info: goe handler started") err = http.ListenAndServe(":8080", nil) log.Printf("Fatal: http handler closed unexpectedly, %s", err) -- GitLab