Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
codefuboard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hans-Nikolai Viessmann
codefuboard
Commits
546cbb8b
Verified
Commit
546cbb8b
authored
Jul 28, 2020
by
Hans-Nikolai Viessmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expand readme, add service files
parent
17ddf5bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
149 additions
and
3 deletions
+149
-3
README.md
README.md
+86
-3
scripts/watch-codefu.service
scripts/watch-codefu.service
+13
-0
scripts/watch-codefu.sh
scripts/watch-codefu.sh
+50
-0
No files found.
README.md
View file @
546cbb8b
...
...
@@ -27,11 +27,94 @@ We use Flask-AppConfig, as such various config values can be found in
**
Remember to update the
`SECRET_KEY`
, use some random value before using
this app in production!
**
### ReCaptcha
This application can make use of ReCaptcha for all forms (including admin
login). Generate a the ReCaptacha keys and add these to the
`default_config.py`
file.
### Webserver Setup
To run this app in a production environment one needs to proxy the Python driven process
through a webserver. For this I use Nginx together with uWSGI to handle the Python process.
In this example, I have cloned the app into
`/srv/http/lb/codefuboard`
. Additionally I created
a system user
`codefu`
which will _run_ the app. The uWSGI configuration for this is below:
```
ini
[uwsgi]
strict
=
true
plugins
=
python
chdir
=
/srv/http/lb/codefuboard
module
=
wsgi
callable
=
app
master
=
true
processes
=
4
threads
=
2
vacuum
=
true ; Delete sockets during shutdown
single-interpreter
=
true
die-on-term
=
true
need-app
=
true
enable-threads
=
true
buffer-size
=
65535
lazy
=
true
chmod-socket
=
775
socket
=
/srv/http/lb/run/%n.sock
pidfile
=
/srv/http/lb/run/.pid
disable-logging
=
false
log-4xx
=
true
log-5xx
=
true
logto
=
/srv/http/lb/log/%n.log
uid
=
codefu
gid
=
codefu
```
I then setup Nginx with the following server configuration:
```
nginx
server
{
server_name
<SERVER
DOMAIN>
;
#charset koi8-r;
#access_log logs/host.access.log main;
root
/srv/http/lb
;
error_log
/srv/http/lb/log/error.log
;
access_log
/srv/http/lb/log/access.log
;
location
/
{
try_files
$uri
@context
;
}
location
/leaderboard/
{
rewrite
^/leaderboard/(.*)
$
/lb/
$1
permanent
;
}
location
@context
{
include
uwsgi_params
;
uwsgi_pass
unix:/srv/http/lb/run/lb.sock
;
}
# redirect server error pages to the static page /50x.html
#
error_page
500
502
503
504
/50x.html
;
location
=
/50x.html
{
root
/usr/share/nginx/html
;
}
}
```
### Database
The app was initially built supporting pickledb as its db-backend. This proved
not to scale well at all in production. So I moved it to use Redis together with
MsgPack. The latter can encode most Python structures into strings, making it easy
to store complex structures in Redis.
Todo
====
-
fix the HUGE variability of runtime measurements!
-
support notion of students and teams
-
teams need to pre-register?
-
admin panel?
-
to modify db mainly (external scripts?)
scripts/watch-codefu.service
0 → 100644
View file @
546cbb8b
[Unit]
Description
=
CodeFu watcher
After
=
network-online.target
[Service]
ExecStart
=
/home/codefu/watch-codefu.sh
Restart
=
always
RestartSec
=
2
User
=
codefu
Group
=
codefu
[Install]
WantedBy
=
multi-user.target
scripts/watch-codefu.sh
0 → 100644
View file @
546cbb8b
#!/usr/bin/env bash
SBATCH
=
"/cm/shared/apps/slurm/17.11.12/bin/sbatch"
inotifywait
-m
/home/codefu/codefu/jobs
-e
create
-e
moved_to |
while
read
path action file
;
do
echo
"detected change (
$action
) in
$path$file
..."
sleep
5
# really?!
if
[
-e
"
$path$file
/.type-cseq"
]
;
then
echo
"launching sbatch for C-seq"
if
$SBATCH
-D
"
$path$file
"
-J
"codefu c
$file
"
/home/codefu/git/codefuboard/scripts/run-c-opt.sh
"
$file
"
;
then
touch
"
$path$file
/.RUNNING"
else
echo
"Unable to launch SBATCH script!"
>>
"
${
path
}${
file
}
/log"
touch
"
$path$file
/.ERROR"
fi
elif
[
-e
"
$path$file
/.type-omp"
]
;
then
echo
"launching sbatch for OMP"
if
$SBATCH
-D
"
$path$file
"
-J
"codefu omp
$file
"
/home/codefu/git/codefuboard/scripts/run-openmp.sh
"
$file
"
;
then
touch
"
$path$file
/.RUNNING"
else
echo
"Unable to launch SBATCH script!"
>>
"
${
path
}${
file
}
/log"
touch
"
$path$file
/.ERROR"
fi
elif
[
-e
"
$path$file
/.type-mpi"
]
;
then
echo
"launching sbatch for MPI"
if
$SBATCH
-D
"
$path$file
"
-J
"codefu mpi
$file
"
/home/codefu/git/codefuboard/scripts/run-mpi.sh
"
$file
"
;
then
touch
"
$path$file
/.RUNNING"
else
echo
"Unable to launch SBATCH script!"
>>
"
${
path
}${
file
}
/log"
touch
"
$path$file
/.ERROR"
fi
elif
[
-e
"
$path$file
/.type-openclcpu"
]
;
then
echo
"launching sbatch for OpenCL CPU"
if
$SBATCH
-D
"
$path$file
"
-J
"codefu clcpu
$file
"
/home/codefu/git/codefuboard/scripts/run-opencl-cpu.sh
"
$file
"
;
then
touch
"
$path$file
/.RUNNING"
else
echo
"Unable to launch SBATCH script!"
>>
"
${
path
}${
file
}
/log"
touch
"
$path$file
/.ERROR"
fi
elif
[
-e
"
$path$file
/.type-openclgpu"
]
;
then
echo
"launching sbatch for OpenCL GPU"
if
$SBATCH
-D
"
$path$file
"
-J
"codefu clgpu
$file
"
/home/codefu/git/codefuboard/scripts/run-opencl-gpu.sh
"
$file
"
;
then
touch
"
$path$file
/.RUNNING"
else
echo
"Unable to launch SBATCH script!"
>>
"
${
path
}${
file
}
/log"
touch
"
$path$file
/.ERROR"
fi
fi
done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment