It went okay? I’m just kinda stupid. (And so is Nginx).
Installation
The easy part.
This went without a hitch.
I installed node to my server, cloned the quartz repo and ran npm i [1].
Getting my notes onto the server.
This went mostly smooth.
I mainly write on my phone[2]. So I wanted an easy way to get my notes from my phone to my server. Since I don’t want to upload my notes via GitHub.
Since I already use Termux on my phone I settled on a simple shellscript with rsync.
This is the script I ended up writing.
#!/data/data/com.termux/files/usr/bin/bash
LOCAL_ROOT_VAULT="/storage/emulated/0/Documents/[VAULTNAME]/"
SSH_ALIAS="[SSH-ALIAS]"
VPS_QUARTZ_DIR="~/quartz"
echo "Syncing root vault to VPS..."
rsync -avz --delete \
--exclude '.obsidian/' \
--exclude '.trash/' \
--exclude '.git/' \
"$LOCAL_ROOT_VAULT" "$SSH_ALIAS:$VPS_QUARTZ_DIR/content/"
echo "Building Quartz site..."
ssh "$SSH_ALIAS" "cd $VPS_QUARTZ_DIR && npx quartz build"
echo "Done!"Nice and simple!
troubleshooting the script
I ran it, boom, errors.
Whoops, turns out I didn’t install rsync on my server. Not the smartest move. So I installed it.
Run it again, node starts tweaking why is that? So I check the node version, which says I am on the correct version. Okay, so what’s wrong then? I haven’t touched anything yet?
I proceed to run ls in the quartz folder, and notice a suspiciously node_modules shaped hole. Finally figure out I haven’t run npm i like a dumb ass. Oops.
Nginx and Certificates and DNS
Oh no…
Okay so I point observatory.sisterfrott.ing at my server IP in the DNS panel.
I set up the Nginx config and link it to the enabled sites.
I run certbot.
Wow, it all seems to work and suprised! So I navigate to the site… Firefox tells me “Something suspicious is going on”.
Well fuck. Okay show me what’s wrong.
Turns out it has the certificate for my matrix server subdomain? How did that happen? I clearly ran it with -d observatory.sisterfrott.ing?
Okay, let’s just run certbot certonly --nginx[3] and pick the domain manually. It completes normally, so I reload the page, expecting it to be working.
No, no, ofcourse not, Firefox gives me the same error.
Then this popped into my head:
“It’s not DNS
There’s no way it’s DNS
It was DNS”
So I check the DNS again, it was all fine?
So I get ready to run the certbot command for a third time, hmm wait a second, what is that certonly doing there? Whoops, so it was creating the certificates, just not adding the to the Nginx config.
I rerun it for the third time, removing the certonly part, and it works! Almost…
The problems don’t end at Certbot.
I no longer get a warning from my browser, so I’m moving in the right direction!
Now I just get a 404 instead. Great.
I check wether my config point at the right directory. It does (or so I thought), it’s pointing at ~/quartz/public.
That’s where all the files compiled files should be.
Turns out that Nginx doesn’t automatically expand ~/ to /home/[name]. How was I supposed to know? That seemed like basic Linux functionality to me. After correcting that everything seemed to work!
one last small issue
When I went to a newly created note that wasn’t in an index it returning a 404, unless I added .html to the url, weird.
Turns out I forgot to add $yuri.htmlto my try_ files directive in the config. Whoops, that’s on me.
After fixing that everything worked fine!
What I learned from this
Nginx can’t handle ~/. Which had me pretty stumped.
Want to continue reading about my quartz set up?
Read: Quartz continued. :3