Compare commits

...

2 Commits

4
.gitignore vendored

@ -15,6 +15,8 @@ backend/repo/
# autoconf products # autoconf products
**/Makefile **/Makefile
nginx/yacswa.conf
configure.scan configure.scan
config.log config.log
config.status config.status
autom4te.cache/

@ -1,22 +1,37 @@
.PHONY: all back front install .PHONY: all back front install up down clean
all: back front all: back front
back: back:
cd backend && ${MAKE} @echo "Building backend..."
@cd backend && ${MAKE}
front: front:
cd frontend && ${MAKE} @echo "Building frontend..."
@cd frontend && ${MAKE}
@public_dir@: @public_dir@:
cd frontend && ${MAKE} install @echo "Installing frontend assets..."
@cd frontend && sudo ${MAKE} install
@nginx_config@: m4/environment.m4 nginx/yacswa.conf.m4 @nginx_dir@sites_available/@nginx_config@: nginx/yacswa.conf
m4 m4/environment.m4 nginx/yacswa.conf.m4 > @nginx_config@ @echo "Installing nginx config..."
@mkdir -p @nginx_dir@sites_available
@cp nginx/yacswa.conf @nginx_dir@sites_available/@nginx_config@
install: @public_dir@ @nginx_config@ install: @public_dir@ @nginx_dir@sites_available/@nginx_config@
up: install up: install @nginx_dir@sites_enabled/@nginx_config@
sudo $(LN_S) /etc/nginx/sites_available/yacswa.conf /etc/nginx/sites_enabled/ @cd backend && ${MAKE} up
cd backend && ${MAKE} up
@nginx_dir@sites_enabled/@nginx_config@:
@sudo mkdir -p @nginx_dir@sites_enabled
@sudo @LN_S@ @nginx_dir@sites_available/@nginx_config@ @nginx_dir@sites_enabled/
down:
@sudo rm -f @nginx_dir@sites_enabled/@nginx_config@
@cd backend && ${MAKE} down
clean:
@cd frontend && make clean

@ -6,15 +6,16 @@ all: deps
deps: tk csv deps: tk csv
tk: tk:
cd deps/guile-toolkit && ${MAKE} && sudo ${MAKE} install @cd deps/guile-toolkit && ${MAKE} && sudo ${MAKE} install
csv: csv:
cd deps/guile-csv && ${MAKE} && sudo ${MAKE} install @cd deps/guile-csv && ${MAKE} && sudo ${MAKE} install
up: deps .backend.lock up: .backend.lock
.backend.lock: main.scm .backend.lock: main.scm
@nohup $(GUILE) ./main.scm > yacswa-backend.log & export PID=$$! & echo "Server spawned with PID $${PID}"; echo $${PID} > .backend.lock; unset PID @@GUILE@ ./main.scm > yacswa-backend.log & export PID=$$!; echo $${PID} > .backend.lock
@echo "Server spawned with PID $${PID}" && echo $${PID} > .backend.lock && unset PID
down: down:
@export PID=`cat .backend.lock`; kill -15 $${PID}; rm .backend.lock; echo "Server on PID $${PID} down."; unset PID @export PID=`cat .backend.lock` && kill -15 $${PID} && rm .backend.lock && echo "Server on PID $${PID} down."; unset PID

@ -1 +1 @@
Subproject commit 0d1e98c17262ba7c85b2427cdca54ebe401200e9 Subproject commit 21938812546c90e39d3b353c1c99acb36467fd3e

@ -122,21 +122,21 @@
(sleep (sec/mins 9)))) (sleep (sec/mins 9))))
(loop))) (loop)))
#! As the git repository is no longer updated there is no need to ;; As the git repository is no longer updated there is no need to
establish a job loop or populate the statistics tables asynchronously ;; establish a job loop or populate the statistics tables asynchronously
(begin-thread (with-mutex %json-lock ;;(begin-thread (with-mutex %json-lock
(git:fetch) ;; (git:fetch)
(set! mcron-locked (mutex-owner %json-lock)) ;; (set! mcron-locked (mutex-owner %json-lock))
(process-stats! $stat-tree) ;; (process-stats! $stat-tree)
(calculate-strings!)) ;; (calculate-strings!))
(sleep (next-timestamp)) ;; (sleep (next-timestamp))
(job-loop)) ;; (job-loop))
(sleep 1) ;;(sleep 1)
(while (mutex-locked? %json-lock) ;;(while (mutex-locked? %json-lock)
(sleep 1)) ;; (sleep 1))
!#
; Functional parts of the asynchronous code above ; Functional parts of the asynchronous code above
(git:fetch) (git:fetch)

@ -8,10 +8,10 @@
;; : ;; :
;; Backchannel ;; Backchannel
#!
(define repl-sock (make-unix-domain-server-socket #:path "./bc")) ;;(define repl-sock (make-unix-domain-server-socket #:path "./bc"))
(spawn-server repl-sock) ;;(spawn-server repl-sock)
!#
;; endpoint helpers ;; endpoint helpers
(define (err: text) (scm->json-string `((error . ,text)))) (define (err: text) (scm->json-string `((error . ,text))))

6
configure vendored

@ -617,6 +617,7 @@ GUILD
GUILE GUILE
SET_MAKE SET_MAKE
nginx_config nginx_config
nginx_dir
public_dir public_dir
server_name server_name
target_alias target_alias
@ -1727,6 +1728,8 @@ server_name=yacswa.home
public_dir=/srv/yacswa.home public_dir=/srv/yacswa.home
nginx_dir=/etc/nginx/
nginx_config=yacswa.home.conf nginx_config=yacswa.home.conf
@ -1957,7 +1960,7 @@ fi
ac_config_files="$ac_config_files Makefile backend/Makefile frontend/Makefile" ac_config_files="$ac_config_files Makefile backend/Makefile frontend/Makefile nginx/yacswa.conf"
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure # This file is a shell script that caches the results of configure
@ -2663,6 +2666,7 @@ do
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"backend/Makefile") CONFIG_FILES="$CONFIG_FILES backend/Makefile" ;; "backend/Makefile") CONFIG_FILES="$CONFIG_FILES backend/Makefile" ;;
"frontend/Makefile") CONFIG_FILES="$CONFIG_FILES frontend/Makefile" ;; "frontend/Makefile") CONFIG_FILES="$CONFIG_FILES frontend/Makefile" ;;
"nginx/yacswa.conf") CONFIG_FILES="$CONFIG_FILES nginx/yacswa.conf" ;;
*) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;;
esac esac

@ -7,6 +7,7 @@ AC_INIT([Yet Another Covid Statistics Web App], [1.0], [me@bradymcd.ca])
# Pull in environment variables # Pull in environment variables
AC_SUBST([server_name], [yacswa.home]) AC_SUBST([server_name], [yacswa.home])
AC_SUBST([public_dir], [/srv/yacswa.home]) AC_SUBST([public_dir], [/srv/yacswa.home])
AC_SUBST([nginx_dir], [/etc/nginx/])
AC_SUBST([nginx_config], [yacswa.home.conf]) AC_SUBST([nginx_config], [yacswa.home.conf])
# Checks for programs. # Checks for programs.
@ -24,5 +25,6 @@ AC_PROG_LN_S
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
backend/Makefile backend/Makefile
frontend/Makefile]) frontend/Makefile
nginx/yacswa.conf])
AC_OUTPUT AC_OUTPUT

@ -1,16 +1,19 @@
.PHONY: all .PHONY: all clean
all: www/elm.js all: www/elm.js
www/elm.js: www/elm.js:
$(ELM) make src/Main.elm --output=www/elm.js @ELM@ make src/Main.elm --output=www/elm.js
install: www/elm.js @public_dir@ install: www/elm.js @public_dir@
@public_dir@: @public_dir@:
mkdir @public_dir@ @mkdir -p @public_dir@
cp ./www/ @public_dir@ @cp -r ./www/ @public_dir@
uninstall: uninstall:
rm -rf @public_dir@ rm -rf @public_dir@
clean:
rm -f www/elm.js

@ -5,7 +5,7 @@ server {
server_name @server_name@ www.@server_name@; server_name @server_name@ www.@server_name@;
root _PUBLIC_DIR_; root @public_dir@;
try_files $uri $uri/ /not_found; try_files $uri $uri/ /not_found;
location /json/pc { location /json/pc {
Loading…
Cancel
Save