Skip to content

Commit

Permalink
Split build for ksi and naskoc
Browse files Browse the repository at this point in the history
  • Loading branch information
BorysekOndrej committed May 20, 2022
1 parent 7346e34 commit 44731ba
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 9 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@ __pycache__
config.py
ksi-py3-venv
.ipynb_checkpoints
build

ksi_build/*.html
naskoc_build/*.html
docker_build/*.html

.env

!**/.gitkeep
!**/index.html
28 changes: 22 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
TARGETS=$(patsubst notebooks/%.ipynb, build/%.html, $(wildcard notebooks/*.ipynb))
KSI_TARGETS=$(patsubst notebooks/%.ipynb, ksi_build/%.html, $(wildcard notebooks/*.ipynb))
NASKOC_TARGETS=$(patsubst notebooks/%.ipynb, naskoc_build/%.html, $(wildcard notebooks/*.ipynb))
DOCKER_TARGETS=$(patsubst notebooks/%.ipynb, docker_build/%.html, $(wildcard notebooks/*.ipynb))

all: $(TARGETS)
docker_all: $(DOCKER_TARGETS)
ksi: $(KSI_TARGETS)
naskoc: $(NASKOC_TARGETS)
docker: $(DOCKER_TARGETS)
all: $(KSI_TARGETS) $(NASKOC_TARGETS)

build/%.html: notebooks/%.ipynb
include .env

# Note: Race condition on file db_uri.secret

ksi_build/%.html: notebooks/%.ipynb
echo $(DB_URI_KSI) > db_uri.secret
ksi-py3-venv/bin/python3 export_monitoring_notebook $< $@

rm db_uri.secret

naskoc_build/%.html: notebooks/%.ipynb
echo $(DB_URI_NASKOC) > db_uri.secret
ksi-py3-venv/bin/python3 export_monitoring_notebook $< $@
rm db_uri.secret

docker_build/%.html: notebooks/%.ipynb
python3 export_monitoring_notebook $< $@

clean:
rm -rf $(TARGETS)
rm -rf $(KSI_TARGETS)
rm -rf $(NASKOC_TARGETS)
rm -rf $(DOCKER_TARGETS)

.PHONY: all clean
File renamed without changes.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ services:
build: .
volumes:
# - ./:/myapp
- ./build:/myapp/docker_build
- ./docker_build:/myapp/docker_build
ports:
- "8080:8080"
entrypoint: /myapp/build_in_docker.sh
# entrypoint: /myapp/build_in_docker.sh

# If you want manual bash, do the following.
# 1. Uncomment the following line:
Expand Down
File renamed without changes.
File renamed without changes.
Empty file added ksi_build/custom.css
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added naskoc_build/.gitkeep
Empty file.
11 changes: 11 additions & 0 deletions naskoc_build/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<FilesMatch deploy.sh>
Options +ExecCGI
AddHandler cgi-script .sh
AuthType Basic
AuthName "Restricted Content!"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</FilesMatch>

Header always unset Content-Security-Policy
Header always unset Content-Security-Policy-Report-Only
Empty file added naskoc_build/custom.css
Empty file.
8 changes: 8 additions & 0 deletions naskoc_build/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

export LC_ALL=C.UTF-8

echo -e "Content-type: text/html\n"

OUTPUT+=$(cd .. && ./kleobis-deploy.sh 2>&1)$'\n\n'
echo "$OUTPUT" | mail "[email protected]" -s "[ksi-monitoring] Deploy status"
22 changes: 22 additions & 0 deletions naskoc_build/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="author" content="KSI,Jan Horacek">
<meta name="robots" content="noindex,nofollow">
<meta name="viewport" content="width=device-width,maximum-scale=2">
<link rel=stylesheet title=Default href='style.css' type='text/css' media=all>
<title>KSI monitoring</title>
</head>
<body>
<h1>KSI monitoring</h1>

<ul>
<li><a href="years.html">Ročníky</a></li>
<li><a href="waves.html">Vlny</a></li>
<li><a href="tasks.html">Úlohy</a></li>
<li><a href="feedback.html">Zpětná vazba (strukturovaná) na úlohy</a></li>
<li><a href="feedback-text.html">Zpětná vazba (text) na úlohy</a></li>
</ul>
</body>
</html>
22 changes: 22 additions & 0 deletions naskoc_build/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
body {
font-family: sans-serif;
max-width: 800px;
min-width: 200px;
margin: auto;
padding-left: 20px;
padding-right: 20px;
}

a:hover {
text-decoration: none;
color: red;
}

#logo {
float:right;
}

strong {
font-weight: bold;
text-decoration: underline;
}

0 comments on commit 44731ba

Please sign in to comment.