From 2cf790d7b8c6325aef4d13ff3ee8c1dfadedabc1 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sat, 18 Sep 2021 11:20:03 -0700 Subject: [PATCH 1/7] [#98] Promtail should also ship Promtail logs --- packer/promtail.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packer/promtail.yaml b/packer/promtail.yaml index 0309713..f2e1c5d 100644 --- a/packer/promtail.yaml +++ b/packer/promtail.yaml @@ -22,13 +22,18 @@ scrape_configs: relabel_configs: - source_labels: - __journal__systemd_unit - regex: "(docker|riju)\\.service" + regex: "(docker|promtail|riju)\\.service" action: keep - source_labels: - __journal__systemd_unit regex: "docker\\.service" target_label: source replacement: "dockerd" + - source_labels: + - __journal__systemd_unit + regex: "promtail\\.service" + target_label: source + replacement: "promtail" - source_labels: - __journal__systemd_unit regex: "riju\\.service" From b2e0eb122d52a98423e1890431a86561c6968387 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sat, 18 Sep 2021 11:45:28 -0700 Subject: [PATCH 2/7] Omg really --- docker/runtime/install.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/runtime/install.bash b/docker/runtime/install.bash index 47f19c1..03fc37b 100755 --- a/docker/runtime/install.bash +++ b/docker/runtime/install.bash @@ -38,6 +38,7 @@ clang docker-ce-cli make nodejs +python3-pip yarn # packaging tools From dd1b851c3ccaa0e089f726b2e0c4676675af9fea Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sat, 18 Sep 2021 12:47:15 -0700 Subject: [PATCH 3/7] Thsnks https://stackoverflow.com/a/58742504 --- packer/cloudwatch.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packer/cloudwatch.json b/packer/cloudwatch.json index a7397c2..36ec712 100644 --- a/packer/cloudwatch.json +++ b/packer/cloudwatch.json @@ -5,7 +5,6 @@ }, "metrics": { "append_dimensions": { - "RijuInstanceGroup": "Webserver", "ImageId": "${aws:ImageId}", "InstanceId": "${aws:InstanceId}", "InstanceType": "${aws:InstanceType}" @@ -16,15 +15,24 @@ ], "metrics_collected": { "cpu": { + "append_dimensions": { + "RijuInstanceGroup": "Webserver" + }, "measurement": ["usage_active"], "metrics_collection_interval": 60 }, "disk": { + "append_dimensions": { + "RijuInstanceGroup": "Webserver" + }, "measurement": ["used_percent"], "metrics_collection_interval": 60, "resources": ["/", "/mnt/riju"] }, "mem": { + "append_dimensions": { + "RijuInstanceGroup": "Webserver" + }, "measurement": ["mem_used_percent"], "metrics_collection_interval": 60 } From 4a14b2c6c1321ac9641dfd9edc032fcb2a2c61e8 Mon Sep 17 00:00:00 2001 From: Philip London Date: Sun, 19 Sep 2021 09:13:28 -0400 Subject: [PATCH 4/7] Update selfhosting.md After the deprecation of auto scaling groups I needed to follow the changes here to get riju back online. Hope this helps others! --- doc/selfhosting.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/selfhosting.md b/doc/selfhosting.md index 9bae4cc..aa9fc1f 100644 --- a/doc/selfhosting.md +++ b/doc/selfhosting.md @@ -212,6 +212,17 @@ install it as a CNAME record in your DNS panel. After DNS propagates, you should now be able to receive a 502 from Riju with no body content. +## Launch instance + +Navigate to your EC2 dashboard instances. Select "Launch instance from template" +and select riju-server for the launch template. + +## Attach to target group + +Once your instance is running you can attach it to a target group. Navigate to +Load Balancing > Target groups. Select riju-server-http and register the instance +that you just launched. + ## Build and deploy *(Note: Although it's easy to build Riju locally, you have to be able From 24bac2f1e04004c793f335f99e19f37e2170df5e Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sun, 19 Sep 2021 13:20:19 -0700 Subject: [PATCH 5/7] Add tutorial on running locally --- CONTRIBUTING.md | 3 +- README.md | 2 +- doc/local.md | 110 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 doc/local.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 72fbf25..6009098 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,7 @@ -# Contributing guide +# Contributing guide / Documentation * [Criteria for language inclusion](doc/what-languages.md) +* [Running Riju locally](doc/local.md) * [How to add your own language to Riju](doc/tutorial.md) * [Deep dive on Riju build system](doc/build.md) * [Riju infrastructure layout](doc/infra.md) diff --git a/README.md b/README.md index c9e6a3c..bd037c1 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ being nice include: * *Mining cryptocurrency.* Since hosting Riju comes out of my paycheck, this is exactly equivalent to stealing, which isn't nice. -## Can I help? +## Can I help? / Documentation Absolutely, please see [Contributing guide](CONTRIBUTING.md). diff --git a/doc/local.md b/doc/local.md new file mode 100644 index 0000000..29ce8be --- /dev/null +++ b/doc/local.md @@ -0,0 +1,110 @@ +# Running Riju locally + +This document has the steps necessary to build and run Riju locally, +without modifications. See the other documentation pages for +information about customizing and rebuilding Riju, or extending it by +adding or modifying the supported languages. + +If you run into any trouble following the guide, please do not +hesitate to open an issue! + +## Project setup + +Fork this repository to your account on GitHub, and clone it locally: + +``` +$ git clone https://github.com/yourname/riju.git +$ cd riju +``` + +Install [Docker](https://www.docker.com/). Then you can build and +start the admin shell: + +``` +$ make image shell I=admin +``` + +All future operations can be done inside the admin shell, where Riju's +dependencies are already installed. + +## Start tmux + +Start a tmux session: + +``` +$ make tmux +``` + +If you don't know how to use tmux, see [a +cheatsheet](https://danielmiessler.com/study/tmux/). The useful +keybindings are: + +* `control-b c`: open new tab +* `control-b p/n`: previous/next tab +* `control-b "`: split tab into top and bottom panes +* `control-b %`: split tab into left and right panes +* `control-b `: move between panes +* `control-b control-b `: if you have two tmuxes nested, + use `control-b` twice to do a command on the inner one instead of + the outer one + +## Fetch base Ubuntu image + +Make sure you're using the same version of Ubuntu as the mainline +Riju: + +``` +$ make sync-ubuntu +``` + +## Start Riju server + +Use `dep`, the Riju build tool, to compile the Docker image that the +Riju server will run inside: + +``` +$ dep image:runtime +``` + +Start Riju in development mode: + +``` +$ make shell I=runtime E=1 CMD="make dev" +``` + +You should now be able to navigate to and see +that Riju is running, although it does not have any languages +installed. + +## Build languages + +Building all languages supported by Riju is a lengthy process which +often requires some debugging as something upstream has broken since +the last time I built everything. You may be more interested in +getting your favorite language(s) up and running. To do that, find the +relevant language (say `foo.yaml`) in the `langs` subdirectory, and +run: + +``` +$ dep image:lang-foo +``` + +After this completes successfully, you'll automatically be able to use +that language in the web interface without needing to restart. + +You can also run: + +``` +$ dep test:lang-foo +``` + +This will, in addition to building the language image, run the defined +integration tests to make sure it is functioning properly. + +If you *do* want to build and test all supported languages, run: + +``` +$ dep deploy:ready +``` + +Expect this to take many hours. From 15f959bbeb62b4db985c57a814751f69d880a4a8 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sun, 19 Sep 2021 13:22:06 -0700 Subject: [PATCH 6/7] Fork not needed --- doc/local.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/local.md b/doc/local.md index 29ce8be..2218ed9 100644 --- a/doc/local.md +++ b/doc/local.md @@ -10,10 +10,10 @@ hesitate to open an issue! ## Project setup -Fork this repository to your account on GitHub, and clone it locally: +Clone locally: ``` -$ git clone https://github.com/yourname/riju.git +$ git clone https://github.com/raxod502/riju.git $ cd riju ``` From 59559ee12562d7b222e841d25cfb8fa32df1a142 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sun, 19 Sep 2021 14:05:12 -0700 Subject: [PATCH 7/7] More --- doc/selfhosting.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/selfhosting.md b/doc/selfhosting.md index aa9fc1f..60f62f2 100644 --- a/doc/selfhosting.md +++ b/doc/selfhosting.md @@ -209,19 +209,21 @@ This is the URL for your public ECR repository. Obtain the DNS record for Riju's ALB from `terraform output` and install it as a CNAME record in your DNS panel. After DNS propagates, -you should now be able to receive a 502 from Riju with no body -content. +you should now be able to receive a 502 from the load balancer. ## Launch instance -Navigate to your EC2 dashboard instances. Select "Launch instance from template" -and select riju-server for the launch template. +Navigate to your EC2 dashboard instances. Select "Launch instance from +template" and select `riju-server` for the launch template. ## Attach to target group -Once your instance is running you can attach it to a target group. Navigate to -Load Balancing > Target groups. Select riju-server-http and register the instance -that you just launched. +Once your instance is running you can attach it to the target group. +Navigate to Load Balancing > Target Groups. Select `riju-server-http` +and register the instance that you just launched. Within a minute or +two, you should still be getting 502s, but now with an empty response +body (these are now coming from the Riju server itself rather than +from the load balancer). ## Build and deploy