radian-software / riju

⚡ Extremely fast online playground for every programming language.

Home Page:https://riju.codes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Questions about self-hosting outside AWS

Nevalicjus opened this issue · comments

Hi;
I wanted to build riju locally, to test it (and it is my second time), to in the future host it myself but I don't wanna host it on AWS and rather do it on a VPS I'm already using.

I have two questions:

  1. I have failed to build riju for the second time, and I'm not sure what I'm doing wrong whilst following the docs.

I have cloned the repo and ran make shell I=admin which gives me a root shell but I can't run latter commands inside it as it just returns me a make: *** No rule to make target '<make's arg>'. Stop.
I've tried running make tmux outside of this shell, and it seems it works? I had to update the commander package, but then it throws

sudo chown root:riju system/out/riju-system-privileged
chown: invalid group: ‘root:riju’
make: *** [Makefile:160: system] Error 1
Error: command exited with code 2
    at runCommand (file:///home/maciej/archive/riju/tools/util.js:42:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async main (file:///home/maciej/archive/riju/tools/depgraph.js:678:3)

when I run dep image:runtime.

  1. Even If I build it, is the project too AWS'y to run it not on AWS?

Hmm, can you show the full terminal session which leads to you getting make: *** No rule to make target '<make's arg>'. Stop.? I'm not sure how that happens.

You definitely don't want to try running Riju outside of Docker, as you'll run into a fair number of environmental quirks like the one you ran into there. (I wouldn't object to a pull request making the scripts more robust so that they're more likely to succeed outside of the standardized environment of the admin shell, but it's not really supported at present.)

In terms of running without AWS, you can definitely do it, it's just that you won't be able to make the same uptime guarantees during deployments. All you need to do is build all the Docker images (for the supported languages and for the app), and then docker run the app image. Everything should work fairly transparently, and there is still support for passing in TLS configuration to the app server so that it will use a Let's Encrypt cert rather than relying on AWS ACM. You can look at the supervisor script to see what arguments are used to run the app image.

We don't currently have explicit documentation on running it manually, so I filed #122 to track that.

The whole shell I can paste in now is I guess

maciej@w10-nevalicjus:~/archive/riju $ make shell I=admin
docker run -it --rm --hostname admin -v /home/maciej/archive/riju:/src -v /var/cache/riju:/var/cache/riju -v /var/run/docker.sock:/var/run/docker.sock -v /home/maciej/.aws:/var/cache/riju/.aws -v /home/maciej/.docker:/var/cache/riju/.docker -v /home/maciej/.ssh:/var/cache/riju/.ssh -v /home/maciej/.terraform.d:/var/cache/riju/.terraform.d -e NI -e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e DOCKER_REPO -e PUBLIC_DOCKER_REPO -e S3_BUCKET -e DOMAIN -e VOLUME_MOUNT=/home/maciej/archive/riju  -e Z -e CI -e TEST_PATIENCE -e TEST_CONCURRENCY -e TEST_TIMEOUT_SECS -e FATHOM_SITE_ID -e RIJU_IMAGE_HASH="$(docker inspect riju:admin -f '{{ index .Config.Labels "riju.image-hash" }}')" --network host riju:admin
yarn install v1.22.5
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 0.10s.
0 root@admin:/src# make tmux
make: *** No rule to make target 'tmux'.  Stop.

This one was done on WSL2, which I guess contributed to it not being able to 'make' itself.
I've tried doing it on the final VPS which runs linux natively and it also got the same tmux error at the first attempt but after stepping out of that admin shell and running it again it miracolously worked 🎉

Thanks for the notes as to running it on not-AWS, I was just worried.

Looks like there are two issues there:

  • For some reason you're running as root inside the container, so something may be wrong with how we drop permissions based on environment variables.
  • Unless your Makefile was somehow modified, it definitely does have a tmux target, which suggests that something is wrong with your volume mount (i.e. /src is empty). Not sure what could be going on there.

I don't have any objection to WSL support for local development, so feel free to open an issue to track that if you'd like.