{"id":1068,"date":"2022-06-06T12:00:00","date_gmt":"2022-06-06T19:00:00","guid":{"rendered":"https:\/\/letsbuildroboticswithshadow8472.com\/?p=1068"},"modified":"2022-06-07T02:15:14","modified_gmt":"2022-06-07T09:15:14","slug":"i-switched-my-operations-to-caddy-web-server","status":"publish","type":"post","link":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2022\/06\/06\/i-switched-my-operations-to-caddy-web-server\/","title":{"rendered":"I Switched My Operations to Caddy Web Server"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Good Morning from my Robotics Lab! This is Shadow_8472, and today I am rebuilding my home server, Button Mash, from the operating system up. Let\u2019s get started!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Caddy Over Nginx<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I spent well over a month obsessing over Nginx, so why would I start over now? As far as I am concerned, Caddy is <em>the<\/em> piece of software for my use case. While I am sure Nginx is great at what it does, I keep slamming into its learning curve \u2013 especially with integrating Let\u2019s Encrypt, a tool for automating SSL encryption (HTTPS\/the green padlock). Caddy builds that functionality in while still doing everything I wanted Nginx for.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The official Caddy install instructions [1] for Fedora, Red Hat, and CentOS systems are as follows:<\/p>\n\n\n\n<pre class=\"wp-block-verse\">$ dnf install \u2018dnf-command(copr)\u2019\n$ dnf copr enable @caddy\/caddy\n$ dnf install caddy<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">First of all, new command: copr. Background research time! COPR (Cool Other Package Repositories) is a Fedora project I feel comfortable comparing to the Arch User Repository (AUR) or Personal Package Archive (PPA): it lets users make their own software repositories.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Installation went smoothly. When I enabled the repository, I had to accept a GPG key that wasn\u2019t mentioned in the instructions at all. From a user point of view, they appear to fill a similar purpose here to a SSH keys: special numbers use math to prove you are still you in case you get lost.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Caddy uses an HTML interface (a REST API \u2013 Don\u2019t ask, I don\u2019t understand myself) on the computer\u2019s internal network known as loopback or localhost on port 2019. Caddy additionally serves everything over HTTPS by default. If it cannot convince Let\u2019s Encrypt to give it a security certificate, it will sign one itself and tell the operating system to trust it. In other words, if I were not running ButtonMash headless (without a graphical interface), I\u2019d be able to try connecting to localhost:2019 with a favorite browser, like at least one of the limited supply of Caddy tutorials did.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">IP Range Transplant<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I should have just done my experimentation on DerpyChips or something. Instead, I pressed on with trying to point a family-owned domain name at Button Mash. This side adventure sprouted into last week\u2019s post. In short: ButtonMash\u2019s static IP kept was in conflict with what my ISP-provided equipment kept trying to assign it, resulting in an estimated 50% downtime from a confused router. Upgrading to the next gateway may have allowed us to free up the IP range for the gaming router\u2019s use, but it\u2019s not out for our area yet. My father and I switched our network connections over to a \u201cgaming router\u201d we had laying about and enabled bridge mode on the gateway to supposedly disable its router part. I have my doubts about how it\u2019s actually implemented.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Most of our computers gladly accepted the new IP range, but GoldenOakLibry and ButtonMash \u2013having static IP\u2019s\u2013 were holdouts. I temporarily reactivated a few lines of configuration on my laptop to set a static IP so I could talk with them directly and manually transfer them over to the new IP range, breaking NFS shares and Vaultwarden on them respectively.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the confusion, ButtonMash lost its DNS settings; those were easy enough to fix by copying a config line to point those requests to the router. GoldenOakLibry took a bit longer to figure out because the NFS shares themselves had to accept traffic from the new IP range with settings buried deep within the web interface. Once that was sorted, I had to adjust the .mount files in or around \/etc\/systemd\/system on several computers. Editing note: While trying to upload, I found I could not access GoldenOakLibry on at least a couple of my machines. Note 2: I had to change the DHCP settings to the new IP range on my Raspberry Pi reverse Wi-Fi router. Systemd on both goofed systems needed a &#8220;swift kick&#8221; to fix them.<\/p>\n\n\n\n<pre class=\"wp-block-verse\">sudo systemctl start &lt;mount-path-with-hyphens>.mount<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Repairs Incomplete<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">That left Vaultwarden. I was already in a it\u2019s-broken:-fix-it-properly mentality from the modem\/router spinoff project. I got as far as briefly forwarding the needed ports for an incompletely configured Caddy to respond with an error message before deciding I wanted to ensure Bitwarden was locked down tightly before exposing it to the Internet. That wasn\u2019t happening without learning Caddy\u2019s reverse proxy, as I put Vaultwarden exclusively onto a loopback port.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Speaking of loopback, I found the official Caddy tutorials lacking. They \u2013like many others after them\u2013 never consider a pupil with a headless server. I have not yet figured out how to properly convince my other computers to trust Caddy\u2019s self-signed certificates and open up the administration endpoint. That will come in another post. I did get it to serve stuff over HTTP by listing IP\u2019s as http:\/\/&lt;LAN address&gt;, but Bitwarden\/Vaultwarden won\u2019t let me log in on plain HTTP, even over a trusted network and confine the annoying log to a file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As far as I can tell, the administration API on port 2019 does not serve a normal web page. Despite my efforts, the most access I have gotten to it was for it to error out with \u201chost not allowed.\u201d I haven\u2019t made total sense of it yet. I recognize some of the jargon being used, but its exact mechanics are beyond me for the time being.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Takeaway<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Caddy is a powerful tool. The documentation is aesthetically presented and easy enough to understand if you aren\u2019t skimming. But you will have a much better time teaching yourself when you aren\u2019t trying to learn it over the network like I did.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final Question<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Do you know Caddy? I can tell I\u2019m close, but I can\u2019t know for sure if I\u2019m there in terms of the HTTP API and just don\u2019t recognize it yet. I look forward hearing from you in the comments below or on my Discord server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Works Cited<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">[1] \u201cInstall,\u201d<em> Caddy Documentation<\/em>. [Online], Available: <a href=\"https:\/\/caddyserver.com\/docs\/install\">https:\/\/caddyserver.com\/docs\/install<\/a>. [Accessed: June 6, 2022].<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Good Morning from my Robotics Lab! This is Shadow_8472, and today I am rebuilding my home server, Button Mash, from the operating system up. Let\u2019s get started! Caddy Over Nginx I spent well over a month obsessing over Nginx, so why would I start over now? As far as I am concerned, Caddy is the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2022\/06\/06\/i-switched-my-operations-to-caddy-web-server\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;I Switched My Operations to Caddy Web Server&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[3,2,18,14,60],"tags":[128,127,129,54,58],"class_list":["post-1068","post","type-post","status-publish","format-standard","hentry","category-computer-maintenance-and-repair","category-linux","category-nas","category-networking","category-router","tag-caddy","tag-caddy-server","tag-netwroking-gateway","tag-nfs","tag-router"],"_links":{"self":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1068","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/comments?post=1068"}],"version-history":[{"count":4,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1068\/revisions"}],"predecessor-version":[{"id":1073,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1068\/revisions\/1073"}],"wp:attachment":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/media?parent=1068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/categories?post=1068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/tags?post=1068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}