libkookie: add several server modules

These have been running on hyperion for a while now but have never
been published.
wip/nixpkgs-raku
Katharina Fey 3 years ago
parent 83d9261905
commit bd35993adc
Signed by: kookie
GPG Key ID: F972AEEA2887D547
  1. 53
      infra/libkookie/configuration/server/gitea/default.nix
  2. 63
      infra/libkookie/configuration/server/hazelweb/default.nix
  3. 11
      infra/libkookie/configuration/server/starmade/Dockerfile
  4. 28
      infra/libkookie/configuration/server/starmade/default.nix
  5. 102
      infra/libkookie/overlays/kookie/brook-frontend/index.html
  6. 2
      infra/libkookie/overlays/kookie/brook-frontend/static/ajax.min.js
  7. 95
      infra/libkookie/overlays/kookie/brook-frontend/static/main.css
  8. 51
      infra/libkookie/overlays/patches/cgit/0002-store-tree-path.patch
  9. 29
      infra/libkookie/overlays/patches/cgit/0003-correct-about-links.patch
  10. 30
      infra/libkookie/overlays/patches/cgit/0004-cmd-set.patch

@ -0,0 +1,53 @@
{ ... }:
{
services.gitea = {
enable = true;
useWizard = true;
};
services.nginx.virtualHosts."dev.spacekookie.de" = {
enableACME = false;
useACMEHost = "spacekookie.de";
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:3000";
};
};
}
# http {
# server {
# listen 443 ssl;
# server_name my.domain;
# ssl_certificate /ssl/cert.pem;
# ssl_certificate_key /ssl/key.pem;
# location / {
# proxy_http_version 1.1;
# proxy_set_header Host $host;
# proxy_ssl_server_name on;
# proxy_set_header X-Forwarded-Host $host:$server_port;
# proxy_set_header X-Forwarded-Server $host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_pass http://gitea:3000/x/;
# }
# }
# server {
# listen 443 ssl;
# server_name api.my.domain;
# ssl_certificate /ssl/cert.pem;
# ssl_certificate_key /ssl/key.pem;
# location / {
# proxy_http_version 1.1;
# proxy_set_header Host $host;
# proxy_ssl_server_name on;
# proxy_set_header X-Forwarded-Host $host:$server_port;
# proxy_set_header X-Forwarded-Server $host;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_pass http://gitea:3000/;
# }
# }
# }

@ -0,0 +1,63 @@
{ pkgs, ... }:
with pkgs;
let
hazelweb =
let
pelicanNoTest = (python3Packages.pelican.overrideAttrs ({ ... }: {
doInstallCheck = false;
}));
in
stdenv.mkDerivation rec {
name = "hazelnot.xyz";
src = /var/lib/www/hazelweb;
buildInputs = with python3Packages; [ pelicanNoTest webassets markdown ];
installPhase = ''
pelican content
mkdir $out
cp -r output/* $out
mkdir -p $out/design/{algora,ccoin,deliveri,depression,fallout,mods,riot,spectrum}
ls -l output/design
cp output/design/algora.html $out/design/algora/index.html
cp output/design/ccoin.html $out/design/ccoin/index.html
cp output/design/deliveri.html $out/design/deliveri/index.html
cp output/design/depression.html $out/design/depression/index.html
cp output/design/fallout.html $out/design/fallout/index.html
cp output/design/mods.html $out/design/mods/index.html
cp output/design/riot.html $out/design/riot/index.html
cp output/design/spectrum.html $out/design/spectrum/index.html
mkdir -p $out/photos
cp output/photos.html $out/photos/index.html
mkdir -p $out/videos
cp output/videos.html $out/videos/index.html
mkdir -p $out/art
cp output/art.html $out/art/index.html
'';
meta = with stdenv.lib; {
description = "Rebecca's design website";
homepage = "https://hazelnot.xyz";
license = licenses.mit;
};
};
in
{
services.nginx.virtualHosts."hazelnot.xyz" = {
serverAliases = [ "www.hazelnot.xyz" ];
enableACME = false;
useACMEHost = "hazelnot.xyz";
forceSSL = true;
locations."/" = {
root = hazelweb;
index = "index.html";
};
};
}

@ -0,0 +1,11 @@
FROM ubuntu:20.04
LABEL maintainer="Katharina Fey <kookie@spacekookie.de>"
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y wget openjdk-11-jre
RUN wget http://files.star-made.org/StarMade-Starter.jar
RUN java -jar StarMade-Starter.jar -nogui
RUN chmod +x StarMade/StarMade-dedicated-server-linux.sh
CMD

@ -0,0 +1,28 @@
{ pkgs, ... }:
{
users.users.starmade = {
home = "/var/lib/starmade";
};
# Only add a new location to this virtualHost
services.nginx.virtualHosts."hyperion.kookie.space" = {
enableACME = false;
useACMEHost = "hyperion.kookie.space";
forceSSL = true;
locations."/starmade" = {
root = "/var/lib/starmade/www";
};
};
networking.firewall.allowedTCPPorts = [ 10042 ];
systemd.services.starmade-server = {
wantedBy = [ "multi-user.target" ];
serviceConfig.User = "starmade";
script = ''
cd /var/lib/starmade/StarMade
${pkgs.openjdk8}/bin/java -Xms1024m -Xmx24576m -jar StarMade.jar -server -port:10042
'';
};
}

@ -0,0 +1,102 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>stream.spacekookie.de</title>
<link href="/static/main.css" rel="stylesheet">
<script src="/static/ajax.min.js" charset="utf-8"></script>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="https://cdn.conversejs.org/6.0.0/dist/converse.min.css">
<script src="https://cdn.conversejs.org/6.0.0/dist/converse.min.js" charset="utf-8"></script>
<script src="https://cdn.dashjs.org/latest/dash.mediaplayer.min.js" charset="utf-8"></script>
</head>
<!-- Main site body -->
<body>
<header>
<h1>stream.spacekookie.de</h1>
<p class="stream-status">OFFLINE</p>
<!-- <p class="stream-status">LIVE</p> -->
</header>
<div class="block">
<h2>Welcome to the stream! ✨</h2>
<p>
The stream chat is backed by an XMPP
room: <a href="xmpp:stream@rooms.spacekookie.de?join"><em><code>stream@rooms.spacekookie.de</code></em></a> — Feel free to join
it from your favourite XMPP client to say hello!
</p>
<p>You can join via matrix via this link: <a href="You can join via matrix via this link: https://matrix.to/#/#xmpp_stream_rooms.spacekookie.de:matrix.org">https://matrix.to/#/#xmpp_stream_rooms.spacekookie.de:matrix.org<a></p>
</div>
<div class="content">
<iframe src="https://diode.zone/videos/embed/21a70f20-682e-4df8-b435-db6836c2eefa"
sandbox="allow-same-origin allow-scripts"
allowfullscreen="allowfullscreen"></iframe>
<!-- <video class="stream" autoplay id="stream" controls> -->
<!-- Your browser does not support the video tag! -->
<!-- </video> -->
<div class="chat">
<div id="conversejs"></div>
</div>
</div>
<div class="block">
<p id="view-count">Viewers: ?</p>
</div>
</body>
<!-- Initialise converse.js here -->
<script>
converse.initialize({
bosh_service_url: 'https://stream.spacekookie.de/xmpp-bosh',
authentication: 'anonymous',
auto_login: true,
auto_reconnect: true,
muc_disable_slash_commands: true,
auto_join_rooms: ['stream@rooms.spacekookie.de'],
singleton: true,
view_mode: 'embedded',
theme: 'concord',
jid: 'guest-xmpp.spacekookie.de',
show_controlbox_by_default: true,
});
// var client_id;
// var url = "https://stream.spacekookie.de/dash/app.mpd";
// var player = dashjs.MediaPlayer().create();
// var stream = document.getElementById("stream");
// player.initialize(stream, url, true);
// player.on(dashjs.MediaPlayer.events['PLAYBACK_ENDED'], function() {
// clearInterval(metricPoller);
// clearInterval(currentPoller);
// });
// var eventPoller = setInterval(function() {
// console.log("Letting the backend know we're watching");
// console.log("We are id: " + client_id);
// Ajax.post('https://stream.spacekookie.de/metrics/update',
// { id: client_id })
// .then(function(response) {
// console.log("We were assigned ID: " + response.id);
// client_id = response.id;
// })
// }, 5000);
// var currentPoller = setInterval(function() {
// Ajax.get('https://stream.spacekookie.de/metrics/current')
// .then(function(resp) {
// document.getElementById("view-count").innerHTML = "Viewers: " + resp.num;
// });
// }, 10000);
</script>
</html>

File diff suppressed because one or more lines are too long

@ -0,0 +1,95 @@
body {
margin: 0;
font-family: "Roboto", sans-serif;
font-weight: 300;
display: flex;
flex-direction: column;
min-height: 100vh;
background: #424242;
color: #ffffff;
font-family: "Roboto", "Open Sans", "Montserrat", sans-serif;
font-size: 1.25em;
}
header {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
background: #703f96;
padding: 0 2rem;
color: white;
}
.stream-status {
border-bottom: solid 1px white;
animation: flash 0.75s infinite alternate;
font-size: 1.5rem;
}
.content {
display: flex;
justify-content: center;
/*! margin: 2rem 0; */
/*! width: 120vh; */
margin: 2rem auto;
max-width: 100%;
flex-wrap: wrap;
/*! background: black; */
align-items: center;
}
code {
font-family: "Iosekva", "Inconsolata", monospace;
font-size: 1.25em;
}
.block {
display: flex;
flex-direction: column;
max-width: 75%;
align-self: center;
}
a {
color: #FF88FF;
text-decoration: none;
}
a:hover {
border-bottom: solid 1px #FF88FF;
}
#conversejs {
border: solid 2px black;
}
.chat {
width: 27%;
width: 20em;
flex-shrink: 0;
height: 45vh;
flex-grow: 1;
max-width: 80vh;
min-height: 25em;
}
.stream {
border: solid 2px black;
align-self: flex-start;
width: 70%;
}
iframe {
width: 80vh;
height: 45vh;
flex-shrink: 0;
border: 0;
min-height: 25em;
}
@media (max-width: 80vh) {
iframe {
height: 56.25vw;
}
}

@ -0,0 +1,51 @@
From be2f51e1dd583cb3e03572aaab2fff682ba849ee Mon Sep 17 00:00:00 2001
From: Vincent Ambo <tazjin@google.com>
Date: Sat, 21 Dec 2019 23:27:28 +0000
Subject: feat(third_party/cgit): Generate links to about pages from subtrees
If you're on tree/foo/bar, the about link will now point to
about/foo/bar.
Currently the annoying thing about this is that it will also do it for
files.
---
third_party/cgit/ui-shared.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
(limited to 'third_party/cgit')
diff --git a/ui-shared.c b/ui-shared.c
index 0b9307f55..00efbceb2 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -330,6 +330,12 @@ void cgit_tag_link(const char *name, const char *title, const char *class,
reporevlink("tag", name, title, class, tag, NULL, NULL);
}
+void cgit_about_link(const char *name, const char *title, const char *class,
+ const char *head, const char *rev, const char *path)
+{
+ reporevlink("about", name, title, class, head, rev, path);
+}
+
void cgit_tree_link(const char *name, const char *title, const char *class,
const char *head, const char *rev, const char *path)
{
@@ -1020,10 +1026,10 @@ void cgit_print_pageheader(void)
html("<table class='tabs'><tr><td>\n");
if (ctx.env.authenticated && ctx.repo) {
- if (ctx.repo->readme.nr)
- reporevlink("about", "about", NULL,
- hc("about"), ctx.qry.head, NULL,
- NULL);
+ if (ctx.repo->readme.nr) {
+ cgit_about_link("about", NULL, hc("about"), ctx.qry.head,
+ ctx.qry.sha1, ctx.qry.vpath);
+ }
cgit_summary_link("summary", NULL, hc("summary"),
ctx.qry.head);
cgit_refs_link("refs", NULL, hc("refs"), ctx.qry.head,
--
cgit v1.2.3

@ -0,0 +1,29 @@
From f1136cde16d2ab9d8c87e615d0dfdbe7e22adab7 Mon Sep 17 00:00:00 2001
From: Vincent Ambo <tazjin@google.com>
Date: Sun, 19 Apr 2020 16:46:07 +0100
Subject: fix(third_party/cgit): Correctly make "about links" on about page
---
third_party/cgit/ui-shared.c | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'third_party/cgit')
diff --git a/ui-shared.c b/ui-shared.c
index f20422019..af2176719 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -515,6 +515,10 @@ static void cgit_self_link(char *name, const char *title, const char *class)
if (!strcmp(ctx.qry.page, "repolist"))
cgit_index_link(name, title, class, ctx.qry.search, ctx.qry.sort,
ctx.qry.ofs, 1);
+ else if (!strcmp(ctx.qry.page, "about"))
+ cgit_about_link(name, title, class, ctx.qry.head,
+ ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL,
+ ctx.qry.path);
else if (!strcmp(ctx.qry.page, "summary"))
cgit_summary_link(name, title, class, ctx.qry.head);
else if (!strcmp(ctx.qry.page, "tag"))
--
cgit v1.2.3

@ -0,0 +1,30 @@
From e70b88b3c2493129f164f2664622c24bf88197c9 Mon Sep 17 00:00:00 2001
From: Vincent Ambo <tazjin@google.com>
Date: Sun, 9 Feb 2020 17:01:21 +0000
Subject: fix(third_party/cgit): Make vpath & repo available for about cmd
This change makes cgit pass the current repo and vpath inside of the
repo on to the about cmd, which makes it possible for it to correctly
render `tree`, `log` and other links to the same vpath.
---
third_party/cgit/cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'third_party/cgit')
diff --git a/cmd.c b/cmd.c
index 0fd0a01bc..8fac7e9c0 100644
--- a/cmd.c
+++ b/cmd.c
@@ -150,7 +150,7 @@ struct cgit_cmd *cgit_get_cmd(void)
static struct cgit_cmd cmds[] = {
def_cmd(HEAD, 1, 0, 1),
def_cmd(atom, 1, 0, 0),
- def_cmd(about, 0, 0, 0),
+ def_cmd(about, 1, 1, 0),
def_cmd(blame, 1, 1, 0),
def_cmd(blob, 1, 0, 0),
def_cmd(commit, 1, 1, 0),
--
cgit v1.2.3
Loading…
Cancel
Save