diff --git a/.github/OTHER/ig_story_58m.png b/.github/OTHER/ig_story_58m.png new file mode 100644 index 0000000..2f21858 Binary files /dev/null and b/.github/OTHER/ig_story_58m.png differ diff --git a/README.md b/README.md index 2877dc2..06ed5f4 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,6 @@ Reverse engineering documentation: [about](/about/) Deploy: [via docker compose](/deploy.md) -## Updates again: -My main production server, news.yuanhau.com, is currently NOT serving any requests, as the server failed to deploy new versions of my app, and I tried to debug the server's DNS, as it turns out, my ISP 中華電信 actively changes my DNS to 192.168.1.1 which cannot get the IP from ghcr.io, and me trying to update the config & restarting the server killed it. :( - ## Demo: You can try out the app RIGHT NOW via this link: https://yhw.tw/news?goto=desktop @@ -27,8 +24,8 @@ This code is absolutly NOT designed to be spinned up at Vercel or Netlify, it ha ## Note for developing. The desktop enviroment is super unstable when even using a beefy computer, even so, the desktop will lag when opening the newsView, like it's just hates being in a dev env. Prod app works tho, so you can demo it using `bun run build && bun run preview` for demoing. Please don't file a issue request for this matter. If you have the fix, please contribute using Github PRs. - +## news.yuanhau.com is now back up and running (again)! +I fixed most issues of the server, including the nameserver stuff, if you want to know how I fixed it, you can view how I fixed it [here](/server_fixes.md) or on [My broken blog](https://4-1-2.yuanhau.com/posts/) ## Why? diff --git a/server_fixes.md b/server_fixes.md new file mode 100644 index 0000000..73b2435 --- /dev/null +++ b/server_fixes.md @@ -0,0 +1,64 @@ +# Server Fixed +(This file is NOT related to neighbourhood, but it is some stuff I learned during the down time of the server) + +## Timeline +Aprox. 10 PM UTC+8 - I found out that the server is running an outdated version of the app and tried using `docker compose pull`, but saw 192.168.1.1:53 is not a Server, and tried to fix it, and broke off the connection to the internet. + +11:40-ish PM UTC+8 Server is back online. + +## So what is the issue? +Well, My issue is one of my config files included a "on", which is why the PPPoE conenction does not work anymore. + +Image: +![](/.github/OTHER/ig_story_58m.png) + +And also I wrote a super stupid cron fix, which is below. + +## My stupid cron fix: +Cron Job: +``` +0 1 * * * "cd / && bun run hardpushrevolvconf.ts" > /dev/null +``` + +Here is the script I used to force the change of my resolv.conf file: +```typescript +import { file, $ } from "bun"; + +function sendDataToSlack(text: string) { + fetch("{slack_web_hook_to_one_of_my_channels_in_hackclub}", { + method: "POST", + headers: { + "Content-Type": "application-json" + }, + body: JSON.stringify({ text: text }) + }) + return; +} + +const resolvConfPath = "/etc/resolv.conf"; +const resolvConf = file(resolvConfPath); +const resolvConfText = await resolvConf.text(); + +if (resolvConfText.includes("192.168.1.1")) { + // Auto git config + await $`git add .` + await $`git commit -a -m "Auto Commit by the server ${Date().now}, before doing stuff into resolvConf"` + try { + await resolvConf.write("nameserver 8.8.8.8\n"); + sendDataToSlack(`${resolvConfPath} updated successfully.`); + } catch (error) { + sendDataToSlack(`Failed to write to ${resolvConfPath}:`, error); + sendDataToSlack( + "This likely happened because you didn't run the script with root privileges (e.g., 'sudo bun run script.ts')." + ); + } + await $`git add .` + await $`git commit -a -m "Auto Commit by the server ${Date().now}, after doing stuff into resolvConf"` + await $`git push` +} else { + sendDataToSlack( + "Did not find '192.168.1.1'. No changes have been made." + ); +} + +```