Merge branch 'master' into vlang

This commit is contained in:
Radon Rosborough 2021-12-22 12:49:45 -08:00
commit 11df846f5d
26 changed files with 89 additions and 85 deletions

View File

@ -52,8 +52,8 @@ ifeq ($(I),lang)
@: $${L}
node tools/build-lang-image.js --lang $(L)
else ifeq ($(I),ubuntu)
docker pull ubuntu:rolling
hash="$$(docker inspect ubuntu:rolling -f '{{ .Id }}' | sha1sum | awk '{ print $$1 }')"; echo "FROM ubuntu:rolling" | docker build --label riju.image-hash="$${hash}" -t riju:$(I) -
docker pull ubuntu:21.04
hash="$$(docker inspect ubuntu:21.04 -f '{{ .Id }}' | sha1sum | awk '{ print $$1 }')"; echo "FROM ubuntu:21.04" | docker build --label riju.image-hash="$${hash}" -t riju:$(I) -
else ifneq (,$(filter $(I),admin ci))
docker build . -f docker/$(I)/Dockerfile -t riju:$(I) $(NO_CACHE)
else
@ -73,7 +73,7 @@ else
SHELL_PORTS :=
endif
SHELL_ENV := -e Z -e CI -e TEST_PATIENCE -e TEST_CONCURRENCY -e TEST_TIMEOUT_SECS -e FATHOM_SITE_ID
SHELL_ENV := -e Z -e CI -e TEST_PATIENCE -e TEST_CONCURRENCY -e TEST_TIMEOUT_SECS -e ANALYTICS_TAG
ifeq ($(I),lang)
LANG_TAG := lang-$(L)

View File

@ -15,7 +15,10 @@ const host = process.env.HOST || "localhost";
const port = parseInt(process.env.PORT || "") || 6119;
const tlsPort = parseInt(process.env.TLS_PORT || "") || 6120;
const useTLS = process.env.TLS ? true : false;
const fathomSiteId = process.env.FATHOM_SITE_ID || "";
const analyticsTag = (process.env.ANALYTICS_TAG || "").replace(
/^'(.+)'$/,
"$1"
);
const langs = await langsPromise;
const app = express();
@ -27,7 +30,7 @@ app.get("/", (_, res) => {
if (Object.keys(langs).length > 0) {
res.render(path.resolve("frontend/pages/index"), {
langs,
fathomSiteId,
analyticsTag,
});
} else {
res
@ -61,7 +64,7 @@ app.get("/:lang", (req, res) => {
}
res.render(path.resolve("frontend/pages/app"), {
config: langs[lang],
fathomSiteId,
analyticsTag,
});
});
app.use("/css", express.static("frontend/styles"));

View File

@ -263,9 +263,10 @@ enable all the fun CloudFlare options you'd like.
## Set up analytics (optional)
Sign up for Fathom Analytics, enter your domain name, and get a site
ID. Set this as `FATHOM_SITE_ID` in your `.env` file, and build and
roll out a new web AMI.
Sign up for Fathom Analytics, enter your domain name, and get a tag
for embedding. Set this as `ANALYTICS_TAG` in your `.env` file (use
single quoting, as Makefile handling of quotes is a bit nonstandard),
and build and roll out a new web AMI.
## Set up monitoring (optional)

View File

@ -1,4 +1,4 @@
FROM ubuntu:rolling
FROM ubuntu:21.04
COPY docker/admin/install.bash /tmp/
RUN /tmp/install.bash

View File

@ -19,7 +19,7 @@ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
ubuntu_ver="$(lsb_release -rs)"
ubuntu_name="$(lsb_release -cs)"
node_repo="$(curl -sS https://deb.nodesource.com/setup_current.x | grep NODEREPO= | grep -Eo 'node_[0-9]+\.x' | head -n1)"
node_repo="$(curl -sS https://deb.nodesource.com/setup_16.x | grep NODEREPO= | grep -Eo 'node_[0-9]+\.x' | head -n1)"
tee -a /etc/apt/sources.list.d/custom.list >/dev/null <<EOF
deb [arch=amd64] https://apt.releases.hashicorp.com ${ubuntu_name} main
@ -57,8 +57,9 @@ skopeo
ssh
strace
sudo
tmux
terraform
tmux
tree
unzip
uuid-runtime
vim

View File

@ -15,7 +15,7 @@ curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
ubuntu_ver="$(lsb_release -rs)"
ubuntu_name="$(lsb_release -cs)"
node_repo="$(curl -sS https://deb.nodesource.com/setup_current.x | grep NODEREPO= | grep -Eo 'node_[0-9]+\.x' | head -n1)"
node_repo="$(curl -sS https://deb.nodesource.com/setup_16.x | grep NODEREPO= | grep -Eo 'node_[0-9]+\.x' | head -n1)"
tee -a /etc/apt/sources.list.d/custom.list >/dev/null <<EOF
deb https://deb.nodesource.com/${node_repo} ${ubuntu_name} main

View File

@ -1,4 +1,4 @@
FROM ubuntu:rolling
FROM ubuntu:21.04
COPY docker/ci/install.bash /tmp/
RUN /tmp/install.bash

View File

@ -23,7 +23,7 @@ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
ubuntu_name="$(lsb_release -cs)"
node_repo="$(curl -sS https://deb.nodesource.com/setup_current.x | grep NODEREPO= | grep -Eo 'node_[0-9]+\.x' | head -n1)"
node_repo="$(curl -sS https://deb.nodesource.com/setup_16.x | grep NODEREPO= | grep -Eo 'node_[0-9]+\.x' | head -n1)"
tee -a /etc/apt/sources.list.d/custom.list >/dev/null <<EOF
deb [arch=amd64] https://deb.nodesource.com/${node_repo} ${ubuntu_name} main

View File

@ -0,0 +1,18 @@
Riju :: $106.77
EC2 :: $81.38
Data Transfer :: $0.03
EBS Snapshot :: $2.36
EBS Volume :: $28.57
EBS Volume :: $28.57
gp2 :: $1.07
gp3 :: $27.49
Instance :: $50.43
t3.large :: $23.05
t3.medium :: $27.38
ECR :: $5.14
Storage :: $5.14
ELB :: $20.14
Data Transfer :: $0.38
LCUs :: $0.07
Load Balancer :: $19.68
S3 :: $0.11

View File

@ -0,0 +1,17 @@
Riju :: $133.50
EC2 :: $108.22
Data Transfer :: $0.02
EBS Snapshot :: $3.79
EBS Volume :: $27.58
EBS Volume :: $27.58
gp2 :: $1.04
gp3 :: $26.55
Instance :: $76.82
t3.large :: $76.82
ECR :: $5.34
Storage :: $5.34
ELB :: $19.83
Data Transfer :: $0.69
LCUs :: $0.10
Load Balancer :: $19.04
S3 :: $0.11

View File

@ -22,8 +22,8 @@
window.rijuConfig = <%- JSON.stringify(config) %>;
</script>
<script src="/js/app.js" defer></script>
<% if (fathomSiteId) { %>
<script src="https://cdn.usefathom.com/script.js" data-site="<%= fathomSiteId %>" defer></script>
<% if (analyticsTag) { %>
<%- analyticsTag %>
<% } %>
</head>
<body>

View File

@ -4,6 +4,9 @@
<meta charset="utf-8" />
<title>Riju</title>
<link rel="stylesheet" href="/css/index.css" />
<% if (analyticsTag) { %>
<%- analyticsTag %>
<% } %>
</head>
<body>
<h1>Riju: <i>fast</i> online playground for every programming language</h1>
@ -30,8 +33,5 @@
<% } else { %>
<i>Riju is loading language configuration...</i>
<% } %>
<% if (fathomSiteId) { %>
<script src="https://cdn.usefathom.com/script.js" data-site="<%= fathomSiteId %>" defer></script>
<% } %>
</body>
</html>

View File

@ -16,12 +16,13 @@ install:
cargo install llvmenv
llvmenv init
# If compiler is not explicitly set to LLVM, then we get an
# error: unrecognized command-line option -Wnewline-eof.
CC=/usr/bin/clang CXX=/usr/bin/clang++ llvmenv build-entry -G Makefile -j$(nproc) 10.0.0
llvmenv global 10.0.0
# error: unrecognized command-line option '-Wnewline-eof'.
CC=/usr/bin/clang CXX=/usr/bin/clang++ llvmenv build-entry -G Makefile -j$(nproc) 10.0.1
llvmenv global 10.0.1
manual: |
git clone https://github.com/jfecher/ante.git
git clone https://github.com/jfecher/ante.git -n
pushd ante
git checkout ba940f3b492fb448a6a73b139403eefa7a0daedc
LLVM_SYS_100_PREFIX="$(llvmenv prefix)" cargo build --release
install -d "${pkg}/opt/ante"
install -d "${pkg}/usr/local/bin"

View File

@ -1,49 +0,0 @@
id: "carp"
name: "Carp"
info:
year: 2015
desc: "Programming language designed to work well for interactive and performance sensitive use cases like games, sound synthesis and visualizations"
ext: carp
web:
source: "https://github.com/carp-lang/Carp"
category: general
mode: interpreted
platform: []
syntax: lisp
typing: static
paradigm:
- functional
- imperative
usage: []
install:
manual: |
install -d "${pkg}/opt/carp"
install -d "${pkg}/usr/local/bin"
ver="$(curl -sSL "https://api.github.com/repos/carp-lang/Carp/releases" | jq '.[].tag_name' -r | grep Linux | sort -rV | grep -Eo '[0-9.]+' | head -n1)"
wget "https://github.com/carp-lang/Carp/releases/download/v${ver}_Linux/v${ver}.zip" -O carp.zip
unzip carp.zip
mv "v${ver}/bin"/* "${pkg}/usr/local/bin/"
mv "v${ver}/core" "${pkg}/opt/carp/"
repl: |
CARP_DIR=/opt/carp carp
input: |
(* 123 234)
main: "main.carp"
template: |
(use IO)
(println "Hello, world!")
run: |
CARP_DIR=/opt/carp carp main.carp
scope:
code: |
(def x (* 123 234))
timeoutFactor: 8

View File

@ -19,9 +19,9 @@ template: |
}
compile: |
mcs main.cs
mcs -debug main.cs
run: |
mono main.exe
mono --debug main.exe
format:
run: |

View File

@ -36,3 +36,5 @@ template: |
run: |
JAVA_OPTS="-Duser.home=$PWD" kotlinc -script main.kts
kotlinc
timeoutFactor: 2

View File

@ -69,4 +69,4 @@ template: |
run: |
if spago build -n; then spago run -n; (echo 'import Prelude'; echo 'import Main') > .purs-repl; spago repl; else echo 'import Prelude' > .purs-repl; spago repl -d; fi
timeoutFactor: 2
timeoutFactor: 8

View File

@ -90,3 +90,6 @@ lsp:
InterpreterPath: /usr/bin/python3
code: "import func"
item: "functools"
skip:
- lsp

View File

@ -60,3 +60,5 @@ template: |
run: |
dotnet run --project main
timeoutFactor: 4

View File

@ -23,7 +23,7 @@ setup: |
repl: |
"$(which red)"
input: |
DELAY: 1
DELAY: 5
123 * 234
main: "main.red"

View File

@ -7,6 +7,9 @@ install:
repl: |
scala
input: |
DELAY: 5
123 * 234
main: "main.scala"
template: |
@ -18,3 +21,5 @@ run: |
scope:
code: |
val x = 123 * 234
timeoutFactor: 2

View File

@ -63,11 +63,11 @@ scope:
code: |
x = 123 * 234
input: |
DELAY: 5
DELAY: 15
load main.u
DELAY: 5
add x
DELAY: 5
display x
timeoutFactor: 2
timeoutFactor: 4

View File

@ -59,7 +59,7 @@ sudo sed -Ei 's|^#?PermitRootLogin .*|PermitRootLogin no|' /etc/ssh/sshd_config
sudo sed -Ei 's|^#?PasswordAuthentication .*|PasswordAuthentication no|' /etc/ssh/sshd_config
sudo sed -Ei 's|^#?PermitEmptyPasswords .*|PermitEmptyPasswords no|' /etc/ssh/sshd_config
sudo sed -Ei "s|\\\$AWS_REGION|${AWS_REGION}|" /etc/systemd/system/riju.service
sudo sed -Ei "s|\\\$FATHOM_SITE_ID|${FATHOM_SITE_ID:-}|" /etc/systemd/system/riju.service
sudo sed -Ei "s|\\\$ANALYTICS_TAG|${ANALYTICS_TAG:-}|" /etc/systemd/system/riju.service
sudo sed -Ei "s|\\\$S3_BUCKET|${S3_BUCKET}|" /etc/systemd/system/riju.service
sudo sed -Ei "s|\\\$SENTRY_DSN|${SENTRY_DSN:-}|" /etc/systemd/system/riju.service
sudo sed -Ei "s|\\\$SUPERVISOR_ACCESS_TOKEN|${SUPERVISOR_ACCESS_TOKEN}|" /etc/systemd/system/riju.service

View File

@ -11,7 +11,7 @@ ExecStart=riju-supervisor
Restart=always
RestartSec=5
Environment=AWS_REGION=$AWS_REGION
Environment=FATHOM_SITE_ID=$FATHOM_SITE_ID
Environment=ANALYTICS_TAG=$ANALYTICS_TAG
Environment=S3_BUCKET=$S3_BUCKET
Environment=SENTRY_DSN=$SENTRY_DSN
Environment=SUPERVISOR_ACCESS_TOKEN=$SUPERVISOR_ACCESS_TOKEN

View File

@ -8,9 +8,9 @@ variable "aws_region" {
default = "${env("AWS_REGION")}"
}
variable "fathom_site_id" {
variable "analytics_tag" {
type = string
default = "${env("FATHOM_SITE_ID")}"
default = "${env("ANALYTICS_TAG")}"
}
variable "grafana_api_key" {
@ -116,7 +116,7 @@ build {
environment_vars = [
"ADMIN_PASSWORD=${var.admin_password}",
"AWS_REGION=${var.aws_region}",
"FATHOM_SITE_ID=${var.fathom_site_id}",
"ANALYTICS_TAG=${var.analytics_tag}",
"GRAFANA_API_KEY=${var.grafana_api_key}",
"S3_BUCKET=${var.s3_bucket}",
"SENTRY_DSN=${var.sentry_dsn}",

View File

@ -355,7 +355,7 @@ func (sv *supervisor) reload() error {
"-v", "/var/cache/riju:/var/cache/riju",
"-v", "/var/run/docker.sock:/var/run/docker.sock",
"-p", fmt.Sprintf("127.0.0.1:%d:6119", port),
"-e", "FATHOM_SITE_ID",
"-e", "ANALYTICS_TAG",
"-e", "RIJU_DEPLOY_CONFIG",
"-e", "SENTRY_DSN",
"--label", fmt.Sprintf("riju.deploy-config-hash=%s", deployCfgHash),