From 039a25acd35d086416227c05cff9f3404d64f06e Mon Sep 17 00:00:00 2001 From: isakal Date: Thu, 4 Jun 2020 21:47:26 +0200 Subject: [PATCH 1/5] Add instructions on how to instal deps on arch --- readme.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/readme.md b/readme.md index f9c9fd6..5416a11 100644 --- a/readme.md +++ b/readme.md @@ -19,6 +19,9 @@ systemctl start libvirtd # ubuntu server 18.04: apt install lxc lxc-templates debootstrap libvirt0 +# arch: +sudo pacman -S lxc libvirt + # everything else: # not documented, please open pull requests with commands for debian/arch/macos From b7c8329ea12bb4040f122896adc1dd76c05e0636 Mon Sep 17 00:00:00 2001 From: isakal Date: Thu, 4 Jun 2020 22:12:29 +0200 Subject: [PATCH 2/5] Add instructions on how to get elixir installed --- readme.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 5416a11..bad26c7 100644 --- a/readme.md +++ b/readme.md @@ -20,7 +20,7 @@ systemctl start libvirtd apt install lxc lxc-templates debootstrap libvirt0 # arch: -sudo pacman -S lxc libvirt +sudo pacman -S lxc libvirt unzip # everything else: # not documented, please open pull requests with commands for debian/arch/macos @@ -148,6 +148,23 @@ tar -xzf julia-1.4.1-linux-x86_64.tar.gz echo 'export PATH=$PATH:/opt/julia/julia-1.4.1/bin' >> /opt/.profile source /opt/.profile +# install elixir and erlang +# final binary: /opt/elixir/bin/elixir --version +# erlang +cd /opt && mkdir erlang && cd erlang +wget http://erlang.org/download/otp_src_23.0.tar.gz +gunzip -c otp_src_23.0.tar.gz | tar xf - +cd otp_src_23.0 && ./configure +make +echo 'export PATH=$PATH:/opt/erlang/otp_src_23.0/bin' >> /opt/.profile +source /opt/.profile +#elixir +cd /opt && mkdir elixir && cd elixir +wget https://github.com/elixir-lang/elixir/releases/download/v1.10.3/Precompiled.zip +mkdir elixir-1.10.3 && unzip Precompiled.zip -d elixir-1.10.3/ +echo 'export PATH=$PATH:/opt/elixir/elixir-1.10.3/bin' >> /opt/.profile +source /opt/.profile + # create runnable users and apply limits for i in {1..150}; do From 6076f88bb94ecbaad34dda405dbe466bd65e5b25 Mon Sep 17 00:00:00 2001 From: isakal Date: Thu, 4 Jun 2020 22:24:04 +0200 Subject: [PATCH 3/5] Add julia executor and enable elixir in api --- api/main.go | 1 + lxc/execute | 3 +++ lxc/executors/elixir | 2 ++ 3 files changed, 6 insertions(+) create mode 100644 lxc/executors/elixir diff --git a/api/main.go b/api/main.go index 9cd0b3e..4c1d0d1 100644 --- a/api/main.go +++ b/api/main.go @@ -70,6 +70,7 @@ func Execute(res http.ResponseWriter, req *http.Request) { "c", "cpp", "c++", "csharp", "cs", "c#", + "elixir", "exs", "go", "java", "julia", "jl", diff --git a/lxc/execute b/lxc/execute index e8a9f50..fab1706 100755 --- a/lxc/execute +++ b/lxc/execute @@ -57,6 +57,9 @@ case "$lang" in "csharp" | "cs" | "c#") bin=csharp ;; +"elixir" | "exs") + bin=elixir + ;; "go") bin=go ;; diff --git a/lxc/executors/elixir b/lxc/executors/elixir new file mode 100644 index 0000000..bee79a4 --- /dev/null +++ b/lxc/executors/elixir @@ -0,0 +1,2 @@ +cd /tmp/$2 +runuser runner$1 -c "cd /tmp/$2 ; cat args.args ; xargs -d '\n' timeout -s KILL 3 elixir code.code" From 767b37fa4654cd0b438fabc9a6227c9f4a04fecd Mon Sep 17 00:00:00 2001 From: isakal Date: Thu, 4 Jun 2020 22:30:05 +0200 Subject: [PATCH 4/5] Add tests for elixir --- tests/test.exs | 1 + tests/test_all_lxc | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 tests/test.exs diff --git a/tests/test.exs b/tests/test.exs new file mode 100644 index 0000000..4c8d8b0 --- /dev/null +++ b/tests/test.exs @@ -0,0 +1 @@ +IO.puts("good") diff --git a/tests/test_all_lxc b/tests/test_all_lxc index e3cf275..29d73b9 100755 --- a/tests/test_all_lxc +++ b/tests/test_all_lxc @@ -8,6 +8,8 @@ echo 'testing cpp' ../lxc/execute cpp test.cpp echo 'testing cs' ../lxc/execute cs test.cs +echo 'testing elixir' +../lxc/exexute exs test.exs echo 'testing go' ../lxc/execute go test.go echo 'testing java' From 5cde78c41f5ad001106803aadf502966bd4ca9f3 Mon Sep 17 00:00:00 2001 From: isakal Date: Thu, 4 Jun 2020 22:38:12 +0200 Subject: [PATCH 5/5] Add elixir version and alias --- api/main.go | 2 ++ lxc/versions | 3 +++ 2 files changed, 5 insertions(+) diff --git a/api/main.go b/api/main.go index 4c1d0d1..a9cc087 100644 --- a/api/main.go +++ b/api/main.go @@ -139,6 +139,8 @@ func launch(request Inbound, res http.ResponseWriter) { execlang = "cpp" case "cs", "c#": execlang = "csharp" + case "elixir", "exs": + execlang = "elixir" case "asm": execlang = "nasm" case "js", "javascript": diff --git a/lxc/versions b/lxc/versions index f53836e..a0c9977 100755 --- a/lxc/versions +++ b/lxc/versions @@ -24,6 +24,9 @@ echo '---' echo 'julia' lxc-attach --clear-env -n piston -- /bin/bash -l -c "julia --version" echo '---' +echo "elixir" +lxc-attach --clear-env -n piston -- /bin/bash -l -c "elixir --version" +echo "---" echo 'nasm' lxc-attach --clear-env -n piston -- /bin/bash -l -c "nasm -version" echo '---'