diff --git a/_navbar.yml b/_navbar.yml index a79e8ba..ede36c3 100644 --- a/_navbar.yml +++ b/_navbar.yml @@ -15,10 +15,8 @@ left: - text: "Blog Posts" menu: - - text: "Example Project 1" - href: ./example_project1.html - - text: "Example Project 2" - href: ./example_project2.html + - text: "owncast.nix" + href: ./owncast.nix.html right: - text: "Source" diff --git a/_site.yml b/_site.yml index bb3fde3..6fb5a04 100644 --- a/_site.yml +++ b/_site.yml @@ -2,7 +2,7 @@ name: "HermitCollective Blogs" output_dir: 'docs' output: html_document: - theme: darkly + css: main.css highlight: zenburn toc: true toc_depth: 2 diff --git a/docs/example_project1.html b/docs/example_project1.html index b444b39..fa7950c 100644 --- a/docs/example_project1.html +++ b/docs/example_project1.html @@ -17,7 +17,7 @@ - + @@ -151,6 +151,7 @@ code span.wa { color: #7f9f7f; font-weight: bold; } /* Warning */ + @@ -443,10 +444,7 @@ div.tocify { diff --git a/docs/example_project2_files/figure-html/pressure-1.png b/docs/example_project2_files/figure-html/pressure-1.png deleted file mode 100644 index 0f00f6f..0000000 Binary files a/docs/example_project2_files/figure-html/pressure-1.png and /dev/null differ diff --git a/docs/index.html b/docs/index.html index 4211d7b..0747ee4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -16,7 +16,7 @@ - + @@ -46,6 +46,7 @@ + @@ -259,10 +260,7 @@ $(document).ready(function () { @@ -285,18 +283,19 @@ $(document).ready(function () { -

Welcome to my website!

-
-

This is still very much work in progress

-

Click the links in the menu above to look around.

+

Welcome to blog archive and directory of HermitCollective!

+
+

Info

+

Blogs can be found under the “Blog Posts” tab.
+Under the “HermitCollective” tab you will find all of HermitCollective’s +services.

Notes

-

This website is a collection of regular (R)Markdown document, so you -can use all the usual formatting.

-

If you are new to R Markdown, you can learn more about it on the R Markdown website.

+

Every blog will have a link the the authors website and a link to a +fediverse post +where you can comment on the blog.

diff --git a/docs/main.css b/docs/main.css new file mode 100644 index 0000000..9f28688 --- /dev/null +++ b/docs/main.css @@ -0,0 +1,68 @@ +body { + background: #1E1E1E; + color: white; +} + +.bg { + background: #242424; +} + +h1 { + background: #1E1E1E; + color: white; +} + +dive { + background: #1E1E1E; + color: white; +} + +a:link { + color: #b30000; +} + +a:hover { + color: #EFEEEE; +} + +.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + padding: 5px 0; + margin: 2px 0 0; + margin-top: 2px; + list-style: none; + font-size: 15px; + text-align: left; + background-color: #242424; +} + +.dropdown-menu > li > a { + display: block; + padding: 3px 20px; + clear: both; + font-weight: normal; + line-height: 1.42857143; + color: #EFEEEE; + white-space: nowrap; +} + +.list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus { + z-index: 2; + color: #b30000; + background-color: #242424; + border-color: #242424; +} + +.list-group-item:last-child { + margin-bottom: 0; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 4px; + background-color: #242424; +} + diff --git a/docs/example_project2.html b/docs/owncast.nix.html similarity index 62% rename from docs/example_project2.html rename to docs/owncast.nix.html index bfcf342..4f0ee61 100644 --- a/docs/example_project2.html +++ b/docs/owncast.nix.html @@ -9,15 +9,16 @@ + - + -Example Project 2 +Setting Up Owncast with NixOS - + @@ -46,111 +47,11 @@ - - - + @@ -443,10 +344,7 @@ div.tocify { @@ -464,38 +362,129 @@ div.tocify { -

Example Project 2

-

2023-10-26

+

Setting Up Owncast with NixOS

+

Hertog

+

2023-10-27

-
-

R Markdown

-

This is an R Markdown document. Markdown is a simple formatting -syntax for authoring HTML, PDF, and MS Word documents. For more details -on using R Markdown see http://rmarkdown.rstudio.com.

-

When you click the Knit button a document will be -generated that includes both content as well as the output of any -embedded R code chunks within the document. You can embed an R code -chunk like this:

-
summary(cars)
-
##      speed           dist       
-##  Min.   : 4.0   Min.   :  2.00  
-##  1st Qu.:12.0   1st Qu.: 26.00  
-##  Median :15.0   Median : 36.00  
-##  Mean   :15.4   Mean   : 42.98  
-##  3rd Qu.:19.0   3rd Qu.: 56.00  
-##  Max.   :25.0   Max.   :120.00
+
+

What is Owncast?

+

Owncast is a lightweight +program to set up your own livestreaming website as an alternative to +streaming on twitch or youtube.

+

It is fully free and open source licensed under the MIT license and can even be linked +with the fediverse!

+

Which to me is perfect! I really wanted to get back into +livestreaming (I used to do this on twitch allot) but I wanted a +platform without adds or corporate influence and thus owncast.

+
+
+

As for NixOS

+

I use NixOS to selfhost everything I can (including this website!) +but I couldn’t find any wiki pages or concrete owncast configurations +online, I did eventually get it working and will share my configuration +here.

+
+

The Owncast part of the config

+

This part is the easiest it is simply enabling it setting an unused +port (the default and recommended is 8080) and then let owncast open +that part of the firewall.

+
services.owncast = {
+    enable = true;
+    port = 8080;
+    openFirewall = true;
+  };
+
+
+

The nginx part!

+

Nginx is needed to setup a proxy so we can link owncast to our domain +and ensure everything will run securely. We begin by setting the +(sub)domain that we wish to point at owncast and we enable SSL and ACME. +The locations part needs to point at the port we set earlier so that +nginx knows to point at owncast. Owncast also needs websockets so we set +that to true as wel, the extra config is to ensure our proxy works.

+
 services.nginx.virtualHosts."live.hermitcollective.net" = {
+      forceSSL = true;
+      enableACME = true;
+      locations."/" = {
+        proxyPass = "http://localhost:8080";
+        proxyWebsockets = true; # needed if you need to use WebSocket
+        extraConfig =
+          # required when the target is also TLS server with multiple hosts
+          "proxy_ssl_server_name on;" +
+          # required when the server wants to use HTTP Authentication
+          "proxy_pass_header Authorization;"
+          ;
+      };
+  };
+
+
+

The full config and some extra information

+

Your entire config should look something like this now at which point +you can sudo nixos-rebuild switch!:

+
{ config, pkgs, ... }:
+
+{
+  services.owncast = {
+    enable = true;
+    port = 8080;
+    openFirewall = true;
+  };
+  # Homepages
+  services.nginx.virtualHosts."yourdomain.net" = {
+      forceSSL = true;
+      enableACME = true;
+      locations."/" = {
+        proxyPass = "http://localhost:8080";
+        proxyWebsockets = true; # needed if you need to use WebSocket
+        extraConfig =
+          # required when the target is also TLS server with multiple hosts
+          "proxy_ssl_server_name on;" +
+          # required when the server wants to use HTTP Authentication
+          "proxy_pass_header Authorization;"
+          ;
+      };
+  };
+}
+

We are not done yet however there is one more this that is required +on the nixos side of things and quite a few things in your owncast +webpage.

+

While we did setup nginx for this owncast we didn’t do a full nginx +setup, this is because in my homeserver nginx is used for many things +and I want to avoid duplicate nix code so I have a separate nginx config +which can be found here.

+

Now that that is done we can go into our owncast web page at https://yourdomain.net/admin. Here it will ask you to +log in the default for this is Username: Admin and Password: abc123 you +want to replace this as soon as possible! Luckely there is the owncast +admin page you just logged into for that, either hit view next to +streaming keys in the home page or head to Stream Keys in Server Setup +under the Configuration tab.

+

When you are done with that open your favourite streaming application +set the livestreaming service to custom and use this link rtmp://yourdomain.net:1935/live with the streamkey you +just set!

+
+
+

Further help

+

If you need extra configuring (and know what you are doing) more +owncast options can be found here +and the owncast documentation can be found here. Is your version not up to +date with Nix pkgs? run nix-channel --update. Lastely if +this guide gets out of date my current owncast config can be found here.

-
-

Including Plots

-

You can also embed plots, for example:

-

-

Note that the echo = FALSE parameter was added to the -code chunk to prevent printing of the R code that generated the -plot.

diff --git a/example_project2.Rmd b/example_project2.Rmd deleted file mode 100644 index 8a17e55..0000000 --- a/example_project2.Rmd +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "Example Project 2" -output: html_document -date: "2023-10-26" ---- - -```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = TRUE) -``` - -## R Markdown - -This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see . - -When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this: - -```{r cars} -summary(cars) -``` - -## Including Plots - -You can also embed plots, for example: - -```{r pressure, echo=FALSE} -plot(pressure) -``` - -Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot. diff --git a/index.Rmd b/index.Rmd index 422bdd9..4154277 100644 --- a/index.Rmd +++ b/index.Rmd @@ -8,19 +8,19 @@ output: -**Welcome to my website!** +**Welcome to blog archive and directory of [HermitCollective](https://hermitcollective.net/)!** -# This is still very much work in progress +# Info -Click the links in the menu above to look around. +Blogs can be found under the "Blog Posts" tab. +Under the "HermitCollective" tab you will find all of HermitCollective's services. # Notes - -This website is a collection of regular (R)Markdown document, so you can use all the usual formatting. - -If you are new to R Markdown, you can learn more about it [on the R Markdown website](https://rmarkdown.rstudio.com/). +Every blog will have a link the the authors website and a link to a [fediverse](https://en.wikipedia.org/wiki/Fediverse) post where you can comment on the blog. + + diff --git a/main.css b/main.css new file mode 100644 index 0000000..9f28688 --- /dev/null +++ b/main.css @@ -0,0 +1,68 @@ +body { + background: #1E1E1E; + color: white; +} + +.bg { + background: #242424; +} + +h1 { + background: #1E1E1E; + color: white; +} + +dive { + background: #1E1E1E; + color: white; +} + +a:link { + color: #b30000; +} + +a:hover { + color: #EFEEEE; +} + +.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + padding: 5px 0; + margin: 2px 0 0; + margin-top: 2px; + list-style: none; + font-size: 15px; + text-align: left; + background-color: #242424; +} + +.dropdown-menu > li > a { + display: block; + padding: 3px 20px; + clear: both; + font-weight: normal; + line-height: 1.42857143; + color: #EFEEEE; + white-space: nowrap; +} + +.list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus { + z-index: 2; + color: #b30000; + background-color: #242424; + border-color: #242424; +} + +.list-group-item:last-child { + margin-bottom: 0; + border-bottom-right-radius: 4px; + border-bottom-left-radius: 4px; + background-color: #242424; +} + diff --git a/owncast.nix.Rmd b/owncast.nix.Rmd new file mode 100644 index 0000000..6ac9e3f --- /dev/null +++ b/owncast.nix.Rmd @@ -0,0 +1,95 @@ +--- +title: "Setting Up Owncast with NixOS" +output: html_document +date: "2023-10-27" +author: "[Hertog](https://hertog.hermitcollective.net)" +--- + +## What is Owncast? + +[Owncast](https://owncast.online/) is a lightweight program to set up your own livestreaming website as an alternative to streaming on twitch or youtube. + +It is fully free and open source licensed under the [MIT license](https://mit-license.org/) and can even be linked with the [fediverse!](https://en.wikipedia.org/wiki/Fediverse) + +Which to me is perfect! I really wanted to get back into livestreaming (I used to do this on twitch allot) but I wanted a platform without adds or corporate influence and thus owncast. + +## As for NixOS +I use NixOS to selfhost everything I can (including this website!) but I couldn't find any wiki pages or concrete owncast configurations online, I did eventually get it working and will share my configuration here. + +### The Owncast part of the config +This part is the easiest it is simply enabling it setting an unused port (the default and recommended is 8080) and then let owncast open that part of the firewall. + +``` +services.owncast = { + enable = true; + port = 8080; + openFirewall = true; + }; +``` + +### The nginx part! +Nginx is needed to setup a proxy so we can link owncast to our domain and ensure everything will run securely. +We begin by setting the (sub)domain that we wish to point at owncast and we enable SSL and ACME. +The locations part needs to point at the port we set earlier so that nginx knows to point at owncast. +Owncast also needs websockets so we set that to true as wel, the extra config is to ensure our proxy works. + +``` + services.nginx.virtualHosts."live.hermitcollective.net" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://localhost:8080"; + proxyWebsockets = true; # needed if you need to use WebSocket + extraConfig = + # required when the target is also TLS server with multiple hosts + "proxy_ssl_server_name on;" + + # required when the server wants to use HTTP Authentication + "proxy_pass_header Authorization;" + ; + }; + }; +``` + +### The full config and some extra information +Your entire config should look something like this now at which point you can sudo nixos-rebuild switch!: +``` +{ config, pkgs, ... }: + +{ + services.owncast = { + enable = true; + port = 8080; + openFirewall = true; + }; + # Homepages + services.nginx.virtualHosts."yourdomain.net" = { + forceSSL = true; + enableACME = true; + locations."/" = { + proxyPass = "http://localhost:8080"; + proxyWebsockets = true; # needed if you need to use WebSocket + extraConfig = + # required when the target is also TLS server with multiple hosts + "proxy_ssl_server_name on;" + + # required when the server wants to use HTTP Authentication + "proxy_pass_header Authorization;" + ; + }; + }; +} +``` +We are not done yet however there is one more this that is required on the nixos side of things and quite a few things in your owncast webpage. + +While we did setup nginx for this owncast we didn't do a full nginx setup, this is because in my homeserver nginx is used for many things and I want to avoid duplicate nix code so I have a separate nginx config which can be found [here](https://git.saragerretsen.nl/Hertog/HermitCollective.nix/src/branch/main/services/nginx.nix). + +Now that that is done we can go into our owncast web page at https://yourdomain.net/admin. +Here it will ask you to log in the default for this is Username: Admin and Password: abc123 you want to replace this as soon as possible! +Luckely there is the owncast admin page you just logged into for that, either hit view next to streaming keys in the home page or head to Stream Keys in Server Setup under the Configuration tab. + +When you are done with that open your favourite streaming application set the livestreaming service to custom and use this link rtmp://yourdomain.net:1935/live with the streamkey you just set! + + +### Further help +If you need extra configuring (and know what you are doing) more owncast options can be found [here](https://search.nixos.org/options?channel=unstable&from=0&size=50&sort=relevance&type=packages&query=owncast) and the owncast documentation can be found [here](https://owncast.online/docs/). +Is your version not up to date with Nix pkgs? run ``` nix-channel --update ```. +Lastely if this guide gets out of date my current owncast config can be found [here](https://git.saragerretsen.nl/Hertog/HermitCollective.nix/src/branch/main/services/owncast.nix).