2023-09-15: Linode server
Tags: devjournal
Published: 2023-09-16 00:20:50

This week was another short week for myself since I was out of town last weekend.

Our boss was extremely stressed out this week due to the execs pressuring him on timelines and that sort of thing. They don't seem to understand that a good product will take time. However, they are growing impatient, and as such, he has to modify our schedule and we need to pick up the past to follow suit. He is a good guy and pledged to insulate us from any heat from them. I am very thankful for his kindness and having to work under this much duress, juggling a million different hats at once.

As for the work I did, I pretty cleanly finished whatever I was working on last Friday so I needed a new task.

This time, he wanted us to hook some sort of connection between a frontend and our testing backend Linode server.

First thing I did on Tuesday was work with my other coworker to create a little addition to our original original Svelte app (the one with the to-do items and favorite foods list) and add a button to send a POST request to the Linode server. That worked pretty easily after we spent an hour or two trying to figure out the nginx stuff since neither of us ever had experience with it.

The POST request would send a message and then the FastAPI code on the Linode server would send a message back with a 200. Pretty simple.

He also wanted us to set up an egress policy on Cloudflare, but apparently we needed to pay for dedicated IP addresses, which my boss did not have set up yet. So we left it there.

After that, he wanted us to expand the POST request functionality to a Cloudflare worker. This proved to be more challenging.

Creating the code for the worker was simple enough: we just used ChatGPT to generate that based off the Svelte button that we created earlier. However, the real issue was figuring out why it was refusing to connect to the Linode server. After implementing some logging in the worker, I found out that it was returning a packet, but with 403 HTTP error with a "1003 error" as the body. I didn't see any connection attempts in the FastAPI log, so I figured there was something in the middle blocking the connection.

My initial instinct was that the Linode server needed to have Cloudflare IP addresses whitelisted, but my boss informed me that there was actually no configuration on their website to actually do that. I also realized that I was able to do my work on the server through a VPN and that random webcrawlers were scanning our ports, so I should have reasoned as such.

I then decided to look up error 1003, and it seemed like it had something to do with Cloudflare not allowing direct IP address connections, which was our case since that's how I was making the connection to the Linode server (we don't have an entire DNS set up for our testing server, duh).

After researching, I found out that you can just use localtunnel to create a temporary domain name for a computer address, which was simple enough to set up. After I set that up (and the nginx again), I was finally able to have the Cloudflare worker send a cron job request to the Linode server.

So basically, that was the extent of my work this week. I think our next task is to start setting up more useful workers.

Until next time. Cheers.