Finalize(?) the site

This commit is contained in:
askiiart 2023-09-13 21:20:16 -05:00
parent e911b82bd7
commit ab15f201e5
No known key found for this signature in database
GPG key ID: C89CBC4F981EE719
6 changed files with 71 additions and 29 deletions

View file

@ -4,7 +4,7 @@
<meta content="width=device-width, initial-scale=1" charset="utf-8" /> <meta content="width=device-width, initial-scale=1" charset="utf-8" />
<link rel="icon" href="https://askiiart.net/assets/askiiart.gif" type="image/icon"> <link rel="icon" href="https://askiiart.net/assets/askiiart.gif" type="image/icon">
<title>This website runs on a textbook</title> <title>This website runs on a textbook</title>
<link href="/style.css" type="text/css" rel="stylesheet" /> <link href="style.css" type="text/css" rel="stylesheet" />
</head> </head>
<body> <body>
<h1 id="this-website-runs-on-a-textbook">This website runs on a <h1 id="this-website-runs-on-a-textbook">This website runs on a
@ -13,13 +13,12 @@
<p>My Java class uses Zybooks, which uses some software that <p>My Java class uses Zybooks, which uses some software that
lets me pick what language and IDE to use, then gives me an lets me pick what language and IDE to use, then gives me an
Ubuntu container to code in, hosted on AWS. For example, here's Ubuntu container to code in, hosted on AWS. For example, here's
<a <a href="https://github.com/coder/code-server">code-server</a>
href="https://github.com/coder/code-server"><code>code-server</code></a>
with Java 11. And I also have remote desktop access over VNC via with Java 11. And I also have remote desktop access over VNC via
Apache Guacamole. But more interestingly, <strong>I have root Apache Guacamole. But more interestingly, <strong>I have root
access.</strong></p> access.</strong></p>
<figure> <figure>
<img src="/media/zybooks-java-code.png" <img src="media/zybooks-java-code.png"
alt="code-server running in Zybooks, configured for Java. There is a &quot;Submit for Grading&quot; button in the bottom-left corner." /> alt="code-server running in Zybooks, configured for Java. There is a &quot;Submit for Grading&quot; button in the bottom-left corner." />
<figcaption aria-hidden="true">code-server running in Zybooks, <figcaption aria-hidden="true">code-server running in Zybooks,
configured for Java. There is a "Submit for Grading" button in configured for Java. There is a "Submit for Grading" button in
@ -27,26 +26,30 @@
</figure> </figure>
<p>Here's what I did:</p> <p>Here's what I did:</p>
<ol type="1"> <ol type="1">
<li>Loaded up the bash + <code>code-server</code> <li>Loaded up the bash + code-server environment</li>
environment</li> <li>Installed and ran nginx</li>
<li>Installed and ran <code>nginx</code></li> <li>Eternally create, modify, and delete file to keep the
container alive.
<ol type="1">
<li>(In)activity detection is based off whether any files on
/usercode have been modified in <em>x</em> minutes.</li>
<li>The page also needs to be open, so I've got that running in
a little VM on my server.</li>
</ol></li>
<li>Set up remote port-forwarding from my server <li>Set up remote port-forwarding from my server
<ol type="1"> <ol type="1">
<li>See <a <li>See <a
href="https://serverfault.com/questions/861909/ssh-r-make-target-host-accept-connection-on-all-interfaces">here</a> href="https://serverfault.com/questions/861909/ssh-r-make-target-host-accept-connection-on-all-interfaces">here</a>
for details on that.</li> for details on that.</li>
</ol></li> </ol></li>
<li>Eternally create, modify, and delete file to keep the <li>Have caddy reverse-proxy <a
container alive. href="https://textbook.askiiart.net">textbook.askiiart.net</a>
<ol type="1"> to the container (via the forwarded port).</li>
<li>(In)activity detection is based off whether any files on
/usercode have been modified in <em>x</em> minutes.</li>
</ol></li>
</ol> </ol>
<h2 id="but-can-it-run-doom">But can it run DOOM?</h2> <h2 id="but-can-it-run-doom">But can it run DOOM?</h2>
<p>Yes, yes it can!</p> <p>Yes, yes it can!</p>
<figure> <figure>
<img src="/media/doom.png" alt="DOOM running in Zybooks" /> <img src="media/doom.png" alt="DOOM running in Zybooks" />
<figcaption aria-hidden="true">DOOM running in <figcaption aria-hidden="true">DOOM running in
Zybooks</figcaption> Zybooks</figcaption>
</figure> </figure>
@ -60,8 +63,8 @@
out that the 1GB I have is just enough to run a Next.js site, out that the 1GB I have is just enough to run a Next.js site,
and access it from Midori. <a and access it from Midori. <a
href="https://github.com/askiiart/this-site-runs-on-a-textbook/blob/main/install-node-npm.sh">Here's</a> href="https://github.com/askiiart/this-site-runs-on-a-textbook/blob/main/install-node-npm.sh">Here's</a>
a script for installing Node.js and <code>npm</code>.</p></li> a script for installing Node.js and npm.</p></li>
<li><p>Here's the <code>neofetch</code> results:</p> <li><p>Here's the neofetch results:</p>
<div class="sourceCode" id="cb1"><pre <div class="sourceCode" id="cb1"><pre
class="language-txt"><code class="language-default"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>➜ neofetch</span> class="language-txt"><code class="language-default"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>➜ neofetch</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> .-/+oossssoo+/-.</span> <span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> .-/+oossssoo+/-.</span>
@ -84,6 +87,22 @@
<span id="cb1-19"><a href="#cb1-19" aria-hidden="true" tabindex="-1"></a> -+sssssssssssssssssyyyssss+- Terminal: vscode </span> <span id="cb1-19"><a href="#cb1-19" aria-hidden="true" tabindex="-1"></a> -+sssssssssssssssssyyyssss+- Terminal: vscode </span>
<span id="cb1-20"><a href="#cb1-20" aria-hidden="true" tabindex="-1"></a> `:+ssssssssssssssssss+:` CPU: Intel Xeon Platinum 8259CL (4) @ 2.499GHz </span> <span id="cb1-20"><a href="#cb1-20" aria-hidden="true" tabindex="-1"></a> `:+ssssssssssssssssss+:` CPU: Intel Xeon Platinum 8259CL (4) @ 2.499GHz </span>
<span id="cb1-21"><a href="#cb1-21" aria-hidden="true" tabindex="-1"></a> .-/+oossssoo+/-. Memory: 2388MiB / 15815MiB </span></code></pre></div></li> <span id="cb1-21"><a href="#cb1-21" aria-hidden="true" tabindex="-1"></a> .-/+oossssoo+/-. Memory: 2388MiB / 15815MiB </span></code></pre></div></li>
<li><p>Other port-forwarding stuff, like <a
href="https://github.com/localtunnel/localtunnel">localtunnel</a>,
are blocked. <a
href="https://github.com/erebe/wstunnel"><code>wstunnel</code></a>
might work, and it's also rather convenient that it has a static
binary, but I haven't tried it yet.</p></li>
<li><p>My server occasionally crashes, and I'm still trying to
figure. Sorry if the site goes offline for a bit, but if it
does, it should be back up soon. Also, it's rather funny that my
textbook is more reliable than my actual server.</p>
<ol type="1">
<li>If you're interested, I'm running Debian 12 in a VM, all
I've got installed is Docker. I've checked journalctl, my RAM,
and I verified the installation media. I'm not sure what else to
check, but I'm certainly open to suggestions.</li>
</ol></li>
</ol> </ol>
</body> </body>
<footer> <footer>

View file

@ -2,24 +2,26 @@
## What exactly's going on ## What exactly's going on
My Java class uses Zybooks, which uses some software that lets me pick what language and IDE to use, then gives me an Ubuntu container to code in, hosted on AWS. For example, here's [`code-server`](https://github.com/coder/code-server) with Java 11. And I also have remote desktop access over VNC via Apache Guacamole. But more interestingly, **I have root access.** My Java class uses Zybooks, which uses some software that lets me pick what language and IDE to use, then gives me an Ubuntu container to code in, hosted on AWS. For example, here's [code-server](https://github.com/coder/code-server) with Java 11. And I also have remote desktop access over VNC via Apache Guacamole. But more interestingly, **I have root access.**
![code-server running in Zybooks, configured for Java. There is a "Submit for Grading" button in the bottom-left corner.](/media/zybooks-java-code.png) ![code-server running in Zybooks, configured for Java. There is a "Submit for Grading" button in the bottom-left corner.](media/zybooks-java-code.png)
Here's what I did: Here's what I did:
1. Loaded up the bash + `code-server` environment 1. Loaded up the bash + code-server environment
2. Installed and ran `nginx` 2. Installed and ran nginx
3. Set up remote port-forwarding from my server 3. Eternally create, modify, and delete file to keep the container alive.
1. See [here](https://serverfault.com/questions/861909/ssh-r-make-target-host-accept-connection-on-all-interfaces) for details on that.
4. Eternally create, modify, and delete file to keep the container alive.
1. (In)activity detection is based off whether any files on /usercode have been modified in *x* minutes. 1. (In)activity detection is based off whether any files on /usercode have been modified in *x* minutes.
2. The page also needs to be open, so I've got that running in a little VM on my server.
4. Set up remote port-forwarding from my server
1. See [here](https://serverfault.com/questions/861909/ssh-r-make-target-host-accept-connection-on-all-interfaces) for details on that.
5. Have caddy reverse-proxy [textbook.askiiart.net](https://textbook.askiiart.net) to the container (via the forwarded port).
## But can it run DOOM? ## But can it run DOOM?
Yes, yes it can! Yes, yes it can!
![DOOM running in Zybooks](/media/doom.png) ![DOOM running in Zybooks](media/doom.png)
## But can it run Crysis? ## But can it run Crysis?
@ -27,8 +29,8 @@ Probably not. But if anyone knows how to run Crysis on this thing, I'd be happy
## Some other stuff ## Some other stuff
1. I have no idea how to make a fancier site, but it turns out that the 1GB I have is just enough to run a Next.js site, and access it from Midori. [Here's](https://github.com/askiiart/this-site-runs-on-a-textbook/blob/main/install-node-npm.sh) a script for installing Node.js and `npm`. 1. I have no idea how to make a fancier site, but it turns out that the 1GB I have is just enough to run a Next.js site, and access it from Midori. [Here's](https://github.com/askiiart/this-site-runs-on-a-textbook/blob/main/install-node-npm.sh) a script for installing Node.js and npm.
2. Here's the `neofetch` results: 2. Here's the neofetch results:
```txt ```txt
➜ neofetch ➜ neofetch
@ -53,3 +55,7 @@ Probably not. But if anyone knows how to run Crysis on this thing, I'd be happy
`:+ssssssssssssssssss+:` CPU: Intel Xeon Platinum 8259CL (4) @ 2.499GHz `:+ssssssssssssssssss+:` CPU: Intel Xeon Platinum 8259CL (4) @ 2.499GHz
.-/+oossssoo+/-. Memory: 2388MiB / 15815MiB .-/+oossssoo+/-. Memory: 2388MiB / 15815MiB
``` ```
3. Other port-forwarding stuff, like [localtunnel](https://github.com/localtunnel/localtunnel), are blocked. [`wstunnel`](https://github.com/erebe/wstunnel) might work, and it's also rather convenient that it has a static binary, but I haven't tried it yet.
4. My server occasionally crashes, and I'm still trying to figure. Sorry if the site goes offline for a bit, but if it does, it should be back up soon. Also, it's rather funny that my textbook is more reliable than my actual server.
1. If you're interested, I'm running Debian 12 in a VM, all I've got installed is Docker. I've checked journalctl, my RAM, and I verified the installation media. I'm not sure what else to check, but I'm certainly open to suggestions.

11
keep-alive.sh Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
# Keeps it alive
while :
do
touch /usercode/keep-alive
sleep 5
echo "bap! bap! bap! bap! stayin' alive! stayin' alive!" > /usercode/keep-alive
sleep 5
rm -f /usercode/keep-alive
sleep 5
done

View file

@ -24,7 +24,7 @@ server {
proxy_pass https://courses.cs.washington.edu/courses/cse163/20wi/files/lectures/L04/bee-movie.txt; proxy_pass https://courses.cs.washington.edu/courses/cse163/20wi/files/lectures/L04/bee-movie.txt;
} }
location / { location / {
root /usercode/this-site-runs-on-a-textbook; root /usercode;
index index.html index.htm; index index.html index.htm;
autoindex on; autoindex on;
autoindex_exact_size off; autoindex_exact_size off;
@ -36,7 +36,7 @@ server {
# redirect server error pages to the static page /50x.html # redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html; error_page 500 502 503 504 /50x.html;
location = /50x.html { location = /50x.html {
root /usercode/this-site-runs-on-a-textbook; root /usercode;
} }
# Redirect .git to source # Redirect .git to source

6
run.sh Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -e
sudo apt update
sudo apt install nginx -y
sudo cp /usercode/nginx/default.conf /etc/nginx/conf.d/
sudo nginx

View file

@ -4,7 +4,7 @@
<meta content="width=device-width, initial-scale=1" charset="utf-8" /> <meta content="width=device-width, initial-scale=1" charset="utf-8" />
<link rel="icon" href="https://askiiart.net/assets/askiiart.gif" type="image/icon"> <link rel="icon" href="https://askiiart.net/assets/askiiart.gif" type="image/icon">
<title>$title$</title> <title>$title$</title>
<link href="/style.css" type="text/css" rel="stylesheet" /> <link href="style.css" type="text/css" rel="stylesheet" />
</head> </head>
<body> <body>
$body$ $body$