Compare commits
No commits in common. "6a9959f98d494752c3c4331df4e329f7ee465e6c" and "5a23aa8e0f8ee233461cf56094e470b7d3fc35c3" have entirely different histories.
6a9959f98d
...
5a23aa8e0f
@ -1,36 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
FROM ubuntu:22.10
|
|
||||||
LABEL description="Verilog playground"
|
|
||||||
|
|
||||||
# Prepare OS
|
|
||||||
RUN apt-get -y update \
|
|
||||||
&& apt-get -y install iverilog guile-3.0 locales git
|
|
||||||
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
|
|
||||||
&& locale-gen
|
|
||||||
|
|
||||||
# Environment
|
|
||||||
ENV GIT_SSL_NO_VERIFY=1
|
|
||||||
ENV GUILE_LOAD_PATH=/server/embddr-scheme-library
|
|
||||||
ENV LANG=en_US.UTF-8
|
|
||||||
ENV DONOTUSEFIREJAIL=1
|
|
||||||
|
|
||||||
# Copy server files
|
|
||||||
WORKDIR /server
|
|
||||||
COPY server/* ./
|
|
||||||
RUN git clone https://git.embddr.com/np/embddr-scheme-library.git
|
|
||||||
RUN mkdir play-work /verilog-playground-store
|
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
VOLUME /verilog-playground-store
|
|
||||||
|
|
||||||
CMD [ "guile", "-e", "main", \
|
|
||||||
"./playground-server.scm", \
|
|
||||||
"--port=8080", \
|
|
||||||
"--addr=0.0.0.0", \
|
|
||||||
"--host=https://play.embddr.com", \
|
|
||||||
"--iverilog-exe=./iverilog", \
|
|
||||||
"--vvp-exe=./vvp", \
|
|
||||||
"--max-len=10000", \
|
|
||||||
"--work-base=play-work", \
|
|
||||||
"--stor-base=/verilog-playground-store", \
|
|
||||||
"--log-level=2" ]
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
docker build -t playground .
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if [ 0 -eq "$#" ]; then
|
|
||||||
echo "Usage $0 start/stop/status"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
|
|
||||||
action=$1
|
|
||||||
container=playground
|
|
||||||
|
|
||||||
case $action in
|
|
||||||
"start")
|
|
||||||
cid=$(docker container ls -q -a -f name=$container)
|
|
||||||
|
|
||||||
if [ -z "$cid" ]; then
|
|
||||||
docker run -d --name $container \
|
|
||||||
-p 127.0.0.1:8089:8080 \
|
|
||||||
-v /srv/playground/storage:/verilog-playground-store \
|
|
||||||
--cpus=1 --memory=16g --memory-swap=16g \
|
|
||||||
$container
|
|
||||||
else
|
|
||||||
docker start $container
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"stop")
|
|
||||||
# Press twice CRTL-C
|
|
||||||
docker kill -s SIGINT $container
|
|
||||||
docker kill -s SIGINT $container
|
|
||||||
;;
|
|
||||||
|
|
||||||
"status")
|
|
||||||
cid=$(docker container ls -q -f name=$container)
|
|
||||||
|
|
||||||
if [ -z "$cid" ]; then
|
|
||||||
echo "Stopped"
|
|
||||||
else
|
|
||||||
echo "Started"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
|
|
||||||
"*")
|
|
||||||
echo "Unknown action $action. Actions start, stop and status are allowed"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
9
_web_server/server/firejailed.sh
Executable file
9
_web_server/server/firejailed.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
exe=$(basename $0)
|
||||||
|
|
||||||
|
exec firejail --noprofile --quiet \
|
||||||
|
--rlimit-cpu=1 \
|
||||||
|
--rlimit-as=100m \
|
||||||
|
--rlimit-fsize=1m \
|
||||||
|
"$exe" "$@"
|
||||||
@ -1,7 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8"/>
|
|
||||||
<title>Verilog Playground</title>
|
<title>Verilog Playground</title>
|
||||||
<style type="text/css" media="screen">
|
<style type="text/css" media="screen">
|
||||||
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap');
|
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap');
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
run-restricted
|
./firejailed.sh
|
||||||
@ -291,7 +291,7 @@
|
|||||||
(values status compile-log)
|
(values status compile-log)
|
||||||
|
|
||||||
;; Execute
|
;; Execute
|
||||||
(let ((cmdline (format "~a -N ~a" vvp-exe exe-file)))
|
(let ((cmdline (format "~a ~a" vvp-exe exe-file)))
|
||||||
(let-values (((status out)
|
(let-values (((status out)
|
||||||
(system-to-string cmdline)))
|
(system-to-string cmdline)))
|
||||||
(let ((execution-log
|
(let ((execution-log
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
exe=$(basename $0)
|
|
||||||
|
|
||||||
if [ -z "$DONOTUSEFIREJAIL" ]; then
|
|
||||||
exec firejail \
|
|
||||||
--quiet --noprofile \
|
|
||||||
--rlimit-cpu=5 \
|
|
||||||
--rlimit-as=250m \
|
|
||||||
--rlimit-fsize=250k \
|
|
||||||
"$exe" "$@"
|
|
||||||
else
|
|
||||||
exec timeout -v -s INT 5 "$exe" "$@"
|
|
||||||
fi
|
|
||||||
@ -1 +1 @@
|
|||||||
run-restricted
|
./firejailed.sh
|
||||||
Loading…
x
Reference in New Issue
Block a user