<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Home on juni&#39;s blog ٩(◕‿◕｡)۶</title>
    <link>/</link>
    <description>Recent content in Home on juni&#39;s blog ٩(◕‿◕｡)۶</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language><atom:link href="/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Tracking &amp; Syncing my dotfiles!</title>
      <link>/posts/16/managing-my-dotfiles/</link>
      <pubDate>Sun, 22 Jun 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/16/managing-my-dotfiles/</guid>
      <description>&lt;p&gt;&lt;em&gt;.dotfiles or&amp;hellip; (.)²files?&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;--using-git--github--tracking-dotfiles-with-an-alias&#34;&gt;- Using Git + Github, &amp;amp; tracking dotfiles with an alias.&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&amp;hellip; as mentioned on the &lt;a href=&#34;https://wiki.archlinux.org/title/Dotfiles#Tracking_dotfiles_directly_with_Git&#34;&gt;ever-wise &lt;em&gt;Arch Wiki&lt;/em&gt;.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 1. Create a bare Git repo to track dotfiles&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git init --bare ~/.dotfiles
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 2. Create an alias to simplify dotfiles management.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Tells (/usr/bin/git) to link the git alias directory you just created to your real .config/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;alias dotfiles&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 3. Hide untracked files in ~/ from cluttering &amp;#34;git status&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dotfiles config status.showUntrackedFiles no
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Setup &amp;amp; communicate with this repo via &lt;code&gt;ssh&lt;/code&gt;, &lt;a href=&#34;https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent?platform=linux&#34;&gt;authenticating with a local private key&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 4. Generate SSH key for GitHub auth (if you haven&amp;#39;t got one already)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ssh-keygen -t ed25519 -C &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;you@example.com&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ssh-add ~/.ssh/id_ed25519
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Add the value of ~/.ssh/id_ed25519.pub as an entry in your Github --&amp;gt; Settings --&amp;gt; SSH &amp;amp; GPG Keys, via cat + copy-pasting, or however you&amp;#39;d like.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 5. Force git on your machine to always push to github with SSH instead of HTTPS&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git config --global url.&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;git@github.com:&amp;#34;&lt;/span&gt;.insteadOf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;https://github.com/&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# 6. Set upstream branch as origin main &amp;amp; push via ssh!&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;dotfiles push --set-upstream origin main
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;then, upon changing my &lt;code&gt;dotfiles&lt;/code&gt;, can push to github with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;dotfiles status&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dotfiles add XXXXX&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dotfiles commit -m &amp;quot;Update shell and Hyprland config&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dotfiles push&lt;/code&gt; (to remote, via SSH)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;--or-using-a-dotfiles-manager-comme&#34;&gt;- or&amp;hellip; using a dotfiles manager, &lt;em&gt;comme &lt;a href=&#34;https://www.chezmoi.io/quick-start/#concepts&#34;&gt;&lt;code&gt;chezmoi&lt;/code&gt;&lt;/a&gt;.&lt;/em&gt;&lt;/h2&gt;
&lt;p&gt;&amp;hellip; which is a tool that essentially creates a copy of your &lt;code&gt;dotfiles&lt;/code&gt; folder &lt;em&gt;&lt;strong&gt;outside&lt;/strong&gt;&lt;/em&gt; of your &lt;code&gt;/home&lt;/code&gt; directory (e.g. in &lt;code&gt;~/.local/share/chezmoi/private_dot_config/&lt;/code&gt;) to act as a place to &lt;strong&gt;stage&lt;/strong&gt;, &lt;strong&gt;synchronise&lt;/strong&gt; (with &lt;code&gt;git&lt;/code&gt;) &amp;amp; &lt;strong&gt;manage&lt;/strong&gt; changes to your local &lt;code&gt;dotfiles.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I think of it as a &lt;strong&gt;remotely-connected playground for your &lt;code&gt;dotfiles&lt;/code&gt;&lt;/strong&gt;, to mess with them, pull them from remote repos etc., &lt;strong&gt;before applying the changes&lt;/strong&gt; (via symlinks, copying, or templating) into your &lt;strong&gt;local&lt;/strong&gt; home directory (e.g. &lt;code&gt;~/.config&lt;/code&gt;).&lt;/p&gt;
&lt;h3 id=&#34;--to-install&#34;&gt;- To install:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sudo pacman -S chezmoi&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chezmoi init&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Check what is &amp;amp; isn&amp;rsquo;t managed by &lt;code&gt;chezmoi&lt;/code&gt; with &lt;code&gt;chezmoi managed&lt;/code&gt;/&lt;code&gt;chezmoi unmanaged&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&amp;hellip; then follow steps on &lt;a href=&#34;https://www.chezmoi.io/quick-start/#start-using-chezmoi-on-your-current-machine&#34;&gt;this tutorial&lt;/a&gt; to connect to your repository &amp;amp; get your first commit. I&amp;rsquo;m using &lt;code&gt;chezmoi&lt;/code&gt; to push to the same remote &lt;code&gt;dotfiles&lt;/code&gt; repo created above, and so just &lt;code&gt;rebased&lt;/code&gt; my changes (overwriting the old, &lt;code&gt;chezmoi&lt;/code&gt;-less &lt;code&gt;dotfiles&lt;/code&gt; from above) to keep it nice and clean.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;--editing-your-dotfiles--using-chezmoi&#34;&gt;- Editing your dotfiles &amp;amp; using &lt;code&gt;chezmoi&lt;/code&gt;:&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;You can edit your &lt;code&gt;dotfiles&lt;/code&gt; in &lt;a href=&#34;https://www.chezmoi.io/user-guide/frequently-asked-questions/usage/#how-do-i-edit-my-dotfiles-with-chezmoi&#34;&gt;multiple ways&lt;/a&gt; with &lt;code&gt;chezmoi&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;h4 id=&#34;-you-can-work-and-make-changes-within-the-locally-created-chezmoi-copy-of-your-dotfiles-apply-them-locally-and-push-them-to-remote-repo-once-done&#34;&gt;&lt;strong&gt;(&lt;code&gt;RECOMMENDED&lt;/code&gt;)&lt;/strong&gt; You can work and make changes within the locally-created &lt;code&gt;chezmoi&lt;/code&gt; copy of your &lt;code&gt;dotfiles&lt;/code&gt;, apply them locally, and push them to remote repo once done.&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Navigate to your &lt;code&gt;chezmoi&lt;/code&gt; dotfiles copy with &lt;code&gt;chezmoi cd&lt;/code&gt; (you should be able to tell that it&amp;rsquo;s the &lt;code&gt;chezmoi&lt;/code&gt;-managed copy - e.g. it&amp;rsquo;s called &lt;code&gt;private_dot_config&lt;/code&gt; for me).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then, once you&amp;rsquo;ve made changes and are ready to see them/apply them to your &lt;strong&gt;real&lt;/strong&gt; &lt;code&gt;dotfiles&lt;/code&gt; (e.g to see changes live made to your desktop GUI), use &lt;code&gt;chezmoi status&lt;/code&gt; to list all changed files, &lt;code&gt;chezmoi diff&lt;/code&gt; to check any changes, and &lt;code&gt;chezmoi apply&lt;/code&gt; to copy the &lt;code&gt;chezmoi&lt;/code&gt;-managed files over to your &lt;em&gt;&lt;strong&gt;local&lt;/strong&gt;&lt;/em&gt; &lt;code&gt;dotfiles.&lt;/code&gt; Now, you should see any changes made &lt;strong&gt;reflected on your live system&lt;/strong&gt; (after reloading the given services, if applicable)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Then²&lt;/em&gt;, once you&amp;rsquo;re ready to update your remote repo with your changes, go through the usual &lt;code&gt;git commit&lt;/code&gt; process within the &lt;code&gt;chezmoi&lt;/code&gt;-managed directory.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;git status&lt;/code&gt; to see all changed files (within the &lt;code&gt;chezmoi&lt;/code&gt;-managed copy)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;git add .&lt;/code&gt; (or whatever files you want to add)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;git commit -m &amp;quot;cool changes&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;git push origin main&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;However&lt;/strong&gt;&lt;/em&gt;, you also have the option of&amp;hellip;&lt;/p&gt;
&lt;h3 id=&#34;-ie-not-within-the-chezmoi-managed-copy-of-your-dotfiles&#34;&gt;&lt;strong&gt;&amp;hellip;making changes to your dotfiles normally&lt;/strong&gt; (i.e. not within the &lt;code&gt;chezmoi&lt;/code&gt;-managed copy of your &lt;code&gt;dotfiles&lt;/code&gt;)&lt;/h3&gt;
&lt;p&gt;So, after you&amp;rsquo;re finished a &lt;a href=&#34;https://i.ytimg.com/vi/GlSa_gh8xaQ/maxresdefault.jpg&#34;&gt;particularly spicy ricing session&lt;/a&gt;, you can run:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chezmoi status&lt;/code&gt; - to see what&amp;rsquo;s changed between your local &lt;code&gt;dotfiles&lt;/code&gt; and &lt;code&gt;chezmoi&lt;/code&gt;&amp;rsquo;s copy.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chezmoi add ~/.config/path/to/file.config&lt;/code&gt; - to add any &lt;strong&gt;locally-changed files&lt;/strong&gt; to &lt;code&gt;chezmoi&lt;/code&gt;&amp;rsquo;s tracked &amp;amp; &lt;code&gt;git&lt;/code&gt;-managed copy.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chezmoi apply -v&lt;/code&gt; to write these local changes to &lt;code&gt;chezmoi&#39;s&lt;/code&gt; working copy of your &lt;code&gt;dotfiles&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Then switch to the &lt;code&gt;chezmoi&lt;/code&gt;-managed copy with &lt;code&gt;cd chezmoi&lt;/code&gt;, and go through the usual &lt;code&gt;git commit&lt;/code&gt; process to &lt;strong&gt;update your remote repo if desired.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;code&gt;chezmoi&lt;/code&gt;, importantly, allows you to do some of the following cool things:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up your &lt;code&gt;dotfiles&lt;/code&gt; on a new machine with a single command:
&lt;code&gt;chezmoi init --apply https://github.com/$GITHUB_USERNAME/dotfiles.git&lt;/code&gt; (public repo - private requires &lt;a href=&#34;https://docs.github.com/en/get-started/git-basics/about-remote-repositories#cloning-with-https-urls&#34;&gt;other methods&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Using &lt;strong&gt;&lt;a href=&#34;https://www.chezmoi.io/reference/templates/&#34;&gt;templates&lt;/a&gt;&lt;/strong&gt; to manage &lt;code&gt;dotfiles&lt;/code&gt; between different machines/distros.&lt;/li&gt;
&lt;li&gt;Encrypting your &lt;code&gt;dotfiles&lt;/code&gt; using &lt;strong&gt;&lt;a href=&#34;https://www.chezmoi.io/user-guide/password-managers/&#34;&gt;secrets from your password manager&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Git CLI Basics - branching &amp; stashing!</title>
      <link>/posts/15/git-cli-refresher---branching--stashing/</link>
      <pubDate>Tue, 22 Apr 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/15/git-cli-refresher---branching--stashing/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Smol Objective:&lt;/strong&gt; &lt;em&gt;&lt;strong&gt;Revisiting &lt;code&gt;branch&lt;/code&gt;ing, &lt;code&gt;checkout&lt;/code&gt;&amp;rsquo;s, and &lt;code&gt;stash&lt;/code&gt;ing!&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Via:&lt;/strong&gt; creating a new local branch to save recent experimental changes on, publishing the branch to a remote Github repository, and then switching back to the functional, remote main branch locally. Oh, and stashing changes as I switch between the two to compare.&lt;/p&gt;
&lt;h2 id=&#34;--branching--checkouts&#34;&gt;- Branching &amp;amp; Checkouts&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Check the current status (ensure connected to remote origin)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git status                      
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# checkout - create (argument -b) and switch to a new branch.&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git checkout -b branch-name 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Stage all changes at the HEAD of this new branch (or select specific files/changes by specifying them, instead of &amp;#39;.&amp;#39;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git add .
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Commit changes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git commit -m &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Describe changes here&amp;#34;&lt;/span&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Publish changes to upstream branch on Github&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git push origin branch-name
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;--in-the-wild&#34;&gt;- in the wild:&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;./posts/15/Screenshot%202025-04-22%20at%203.13.48%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;To switch back to the remote &lt;code&gt;main&lt;/code&gt; branch locally (which will also change your working file tree in &lt;code&gt;VSCode&lt;/code&gt; to match what&amp;rsquo;s on &lt;code&gt;main&lt;/code&gt;), use:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Switch back to the main branch&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git checkout main
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Verify you&amp;#39;re on the main branch&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git branch                      
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# or&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git status          
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;--stashing&#34;&gt;- Stashing&lt;/h2&gt;
&lt;p&gt;To briefly save your working changes, you can &amp;ldquo;&lt;code&gt;stash&lt;/code&gt;&amp;rdquo; them. Useful when you&amp;rsquo;re switching between branches or pulling from a remote repository, and don&amp;rsquo;t want to commit your current changes yet.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## saves your modified tracked files and reverts the working directory to match the HEAD commit (a pointer indicating the current commit your directory is based on).&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git stash 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## stashing, with a message:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git stash save &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;message here&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## list current stashes with:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git stash list
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## apply them to your current working directory with:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git stash apply stash@&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;index&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## &amp;#34;pop&amp;#34; them - aka, apply the stash &amp;amp; then remove it from the list&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git stash pop 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## &amp;#34;drop&amp;#34; them - aka, remove them from the stash list&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git stash drop stash@&lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;index&lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## clears all stashed changes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;git stash clear
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div style=&#34;text-align: center&#34;&gt;
   &lt;img src=&#34;https://c.tenor.com/ZAbjZRK0U1sAAAAd/tenor.gif&#34; style=&#34;max-width: 400px; max-height: 300px&#34;&gt;&lt;/img&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Minecraft Server From Scratch (Proxmox LXC, Docker Compose &#43; itzg)</title>
      <link>/posts/14/minecraft-server-from-scratch-proxmox-lxc-docker-compose-&#43;-itzg/</link>
      <pubDate>Sun, 13 Apr 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/14/minecraft-server-from-scratch-proxmox-lxc-docker-compose-&#43;-itzg/</guid>
      <description>&lt;p&gt;Just a smol lil guide for myself to set up a minecraft server from scratch, &lt;em&gt;as I cannot count the number of times I&amp;rsquo;ve had to re-learn this when I migrate from server to server&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve opted for services that &lt;em&gt;should&lt;/em&gt; (for the most part) be supported long-term and are relatively secure &amp;amp; lightweight. However, as any good netizen should do, &lt;em&gt;&lt;strong&gt;please take my advice with a granule of sugar&lt;/strong&gt;&lt;/em&gt;&amp;hellip;&lt;/p&gt;
&lt;h2 id=&#34;--set-up-lxc-container-in-proxmox&#34;&gt;- Set up &lt;code&gt;LXC&lt;/code&gt; Container in Proxmox&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Create new container in &lt;code&gt;proxmox&lt;/code&gt; using the &lt;code&gt;Ubuntu 24.04&lt;/code&gt; &lt;code&gt;LXC&lt;/code&gt; image (or your desired flavour, noting commands may differ slightly depending on package managers) - allocating at least &lt;code&gt;4GB RAM&lt;/code&gt; &amp;amp; &lt;code&gt;2-4 CPU&lt;/code&gt; cores to the machine.&lt;/li&gt;
&lt;li&gt;Once logged in, create a &lt;a href=&#34;https://www.digitalocean.com/community/tutorials/how-to-create-a-new-sudo-enabled-user-on-ubuntu&#34;&gt;sudo-enabled user&lt;/a&gt; with:
&lt;code&gt;adduser myuser&lt;/code&gt;
Set the password, then:
&lt;code&gt;usermod -aG sudo myuser&lt;/code&gt;
&lt;code&gt;su myuser&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Harden SSH&lt;/strong&gt; - ensuring the following values are changed &amp;amp; set within &lt;code&gt;/etc/sshd_config&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Port &lt;span style=&#34;color:#ae81ff&#34;&gt;22&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PermitRootLogin no
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;MaxAuthTries &lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;MaxSessions &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PubkeyAuthentication yes
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PasswordAuthentication no
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PermitEmptyPasswords no
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;KbdInteractiveAuthentication no
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;UsePAM no
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;X11Forwarding no
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;PrintMotd no
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ClientAliveInterval &lt;span style=&#34;color:#ae81ff&#34;&gt;600&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;ClientAliveCountMax &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;Add your local machine&amp;rsquo;s &lt;code&gt;ed25519_pub&lt;/code&gt; key to the &lt;code&gt;~/.ssh/authorized_keys&lt;/code&gt; file (creating it, if it doesn&amp;rsquo;t exist). This will allow key-based login for user &lt;code&gt;myuser&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Be careful not to lock yourself out here, test with password based login first! For example, by setting &lt;code&gt;PasswordAuthentication yes&lt;/code&gt; and logging in, before changing it to &lt;code&gt;PasswordAuthentication no&lt;/code&gt;&lt;/strong&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;ol start=&#34;4&#34;&gt;
&lt;li&gt;
&lt;p&gt;Ensure &lt;code&gt;DNS&lt;/code&gt; is setup properly - check &lt;code&gt;/etc/resolv.conf&lt;/code&gt;.
Basic internet functionality can be tested &amp;amp; achieved by having the line &lt;code&gt;nameserver 8.8.8.8&lt;/code&gt;, but configure to your use case.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Login from local machine with &lt;code&gt;ssh myuser@XXX.XXX.XXX.XXX&lt;/code&gt;. Test your sudo privileges with &lt;code&gt;sudo ls /root&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Lock root account with &lt;code&gt;sudo passwd root -l&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run &lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Find the current &lt;code&gt;IP&lt;/code&gt; with &lt;code&gt;ip -a&lt;/code&gt; (typically on the &lt;code&gt;eth&lt;/code&gt; interface) and set it as static (in &lt;code&gt;proxmox&lt;/code&gt; and/or on your router).&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;--install-docker-compose--itzg-minecraft-server&#34;&gt;- Install Docker (Compose) &amp;amp; itzg Minecraft Server&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install Docker Engine&lt;/strong&gt; - follow steps (distro-specific) &lt;a href=&#34;https://docs.docker.com/engine/install/&#34;&gt;here&lt;/a&gt;, as you will need to configure your package repository properly.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Install Docker Compose&lt;/strong&gt; - following steps &lt;a href=&#34;https://docs.docker.com/compose/install/linux/#install-using-the-repository&#34;&gt;here&lt;/a&gt;. &lt;code&gt;sudo apt install docker-compose&lt;/code&gt; worked for me.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Make a new directory for the Minecraft server&lt;/strong&gt; to sit in: &lt;code&gt;~/minecraft&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Inside, &lt;strong&gt;create a &lt;code&gt;docker-compose.yml&lt;/code&gt;&lt;/strong&gt;, generated with something like &lt;a href=&#34;https://setupmc.com/java-server/&#34;&gt;setupmc.com&lt;/a&gt; to specify server version, plugins, etc.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;My example &lt;code&gt;docker-compose.yml&lt;/code&gt; file is below &lt;em&gt;(for a &lt;code&gt;1.18&lt;/code&gt; server, replacing Timezone (&lt;code&gt;TZ&lt;/code&gt;) accordingly)&lt;/em&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;services&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;	&lt;span style=&#34;color:#f92672&#34;&gt;mc&lt;/span&gt;:    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;		&lt;span style=&#34;color:#f92672&#34;&gt;image&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;itzg/minecraft-server:java17    &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;		&lt;span style=&#34;color:#f92672&#34;&gt;tty&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;		&lt;span style=&#34;color:#f92672&#34;&gt;stdin_open&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;    
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;		&lt;span style=&#34;color:#f92672&#34;&gt;ports&lt;/span&gt;:       
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;			- &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;25565:25565&amp;#34;&lt;/span&gt;     
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;		&lt;span style=&#34;color:#f92672&#34;&gt;environment&lt;/span&gt;:       
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;			&lt;span style=&#34;color:#f92672&#34;&gt;EULA&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;TRUE&amp;#34;&lt;/span&gt;       
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;			&lt;span style=&#34;color:#f92672&#34;&gt;TYPE&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;PAPER&amp;#34;&lt;/span&gt;       
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;			&lt;span style=&#34;color:#f92672&#34;&gt;VERSION&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;1.18&amp;#34;&lt;/span&gt;       
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;			&lt;span style=&#34;color:#f92672&#34;&gt;PAPER_CHANNEL&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;experimental&amp;#34;&lt;/span&gt;       
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;			&lt;span style=&#34;color:#f92672&#34;&gt;MEMORY&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;4096M&amp;#34;&lt;/span&gt;       
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;			&lt;span style=&#34;color:#f92672&#34;&gt;MOTD&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;welcome, traveller, to an older time...
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;			USE_AIKAR_FLAGS: &amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;       
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;			TZ: &amp;#34;&lt;/span&gt;[&lt;span style=&#34;color:#ae81ff&#34;&gt;YOUR-TIMEZONE]&amp;#34;     &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;		&lt;span style=&#34;color:#f92672&#34;&gt;volumes&lt;/span&gt;:       
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;			- &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;./data:/data&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;5&#34;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Start the container&lt;/strong&gt; from within the same directory as &lt;code&gt;docker-compose.yml&lt;/code&gt; with &lt;code&gt;sudo docker compose up -d&lt;/code&gt;. After the image is finished being pulled from the &lt;a href=&#34;https://github.com/itzg/docker-minecraft-server/tree/master&#34;&gt;itzg minecraft server repo&lt;/a&gt;, &lt;strong&gt;watch the logs&lt;/strong&gt; as the server starts with &lt;code&gt;sudo docker compose logs -f&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;If you get an error message about the “class file version” after starting the server, check &lt;a href=&#34;https://setupmc.com/guides/determining-correct-java-version-for-operating-minecraft-server/&#34;&gt;this table to see which Java version corresponds to the respective class file version&lt;/a&gt;. Then adjust the Docker image tag in the setupmc.com](&lt;a href=&#34;https://setupmc.com/java-server/&#34;&gt;https://setupmc.com/java-server/&lt;/a&gt;) configurator accordingly.&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;To stop the server&lt;/strong&gt;, run &lt;code&gt;sudo docker compose down&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;To migrate a world save file over&lt;/strong&gt; (if applicable), copy the following files (at minimum) over from your old server (using something like &lt;code&gt;scp&lt;/code&gt;, or via a GUI if you install something like &lt;a href=&#34;https://webmin.com/download/&#34;&gt;webmin&lt;/a&gt;):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;server.properties&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/world&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/world_the_nether&lt;/code&gt; (if exists)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/world_the_end&lt;/code&gt; (if exists)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;whitelist.json&lt;/code&gt; (if applicable)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;em&gt;Ensure to tweak server-specific configurations within &lt;code&gt;server.properties&lt;/code&gt; if needed!&lt;/em&gt;&lt;/p&gt;
&lt;ol start=&#34;9&#34;&gt;
&lt;li&gt;
&lt;p&gt;As you&amp;rsquo;re running through &lt;code&gt;docker&lt;/code&gt;, it should handle the local network ports on the &lt;code&gt;lxc&lt;/code&gt; for you nicely (if on a fresh &lt;code&gt;linux&lt;/code&gt; install). Also, before I continue, it would be remiss of me to exclude the obligatory ***do this so at your own risk, and please consider the below server hardening methods:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://madelinemiller.dev/blog/root-minecraft-server/&#34;&gt;not running the server as root! &lt;em&gt;(not a problem if you followed the guide above)&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://madelinemiller.dev/blog/ultimate-guide-running-minecraft-server/#security&#34;&gt;general server tips&lt;/a&gt; &amp;amp; &lt;a href=&#34;https://www.spigotmc.org/threads/minecraft-security-part-1-awareness.414081/&#34;&gt;links to hardening methodology&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;With that out of the way, now time to &lt;strong&gt;open up a port on your local&lt;/strong&gt; router/modem. For me, I&amp;rsquo;ve opted for a little &amp;ldquo;security through obscurity&amp;rdquo; (a contentious topic, but given my threat model) by mapping my &lt;strong&gt;router&amp;rsquo;s external port&lt;/strong&gt;, &lt;code&gt;43456&lt;/code&gt; to the default minecraft listening port (&lt;code&gt;25565&lt;/code&gt; - specified in &lt;code&gt;server.properties&lt;/code&gt;) on my &lt;code&gt;lxc&lt;/code&gt; machine:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/14/Screenshot%202025-04-13%20at%209.15.24%20pm.png&#34; alt=&#34;&#34;&gt;
Additionally, I&amp;rsquo;ve set up a &lt;code&gt;DNS A record&lt;/code&gt; for the domain I own to point at my router&amp;rsquo;s &lt;code&gt;public IP&lt;/code&gt;, so I can access my server (and share it) with &lt;code&gt;my-domain:43456&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Now, you should be all up and running! :3&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;div style=&#34;text-align: center&#34;&gt;
   &lt;img src=&#34;https://media3.giphy.com/media/v1.Y2lkPTc5MGI3NjExYTY3OTM0YTI1dzBtb2htNHRzbzdtaTA1Yzh4ZHQ2aXdmZmZqb2xscCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/a6pzK009rlCak/giphy.gif&#34; style=&#34;max-width: 400px; max-height: 300px&#34;&gt;&lt;/img&gt;
&lt;/div&gt;
&lt;h2 id=&#34;--for-any-further-troubleshooting&#34;&gt;- For any further troubleshooting&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://docker-minecraft-server.readthedocs.io/en/latest/#using-docker-compose&#34;&gt;itzg Docker Minecraft Server Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://setupmc.com/java-server/&#34;&gt;&lt;code&gt;docker-compose.yaml&lt;/code&gt; configuration generator (SetupMC)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Authentication Methods - A Deep(ish) Dive</title>
      <link>/posts/13/authentication-methods-deep-dive/</link>
      <pubDate>Thu, 27 Feb 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/13/authentication-methods-deep-dive/</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Here lies the ramblings of a madwoman; bumbling her way around in the darkness in an attempt to understand the wide world of websec&amp;hellip;&lt;/p&gt;&lt;/blockquote&gt;
&lt;h1 id=&#34;-in-the-absolute-broadest-of-strokes&#34;&gt;&amp;hellip; in the absolute broadest of strokes:&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Token-based (&lt;code&gt;JWT&lt;/code&gt;):&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Authentication state is stored &lt;strong&gt;on the client&lt;/strong&gt; (local/session storage) in the form of a &lt;strong&gt;token&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Session-based:&lt;/strong&gt;
&lt;ul&gt;
&lt;li&gt;Authentication state is &lt;strong&gt;stored on the server&amp;rsquo;s database&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now, let&amp;rsquo;s go a little deeper, shall we?&lt;/p&gt;
&lt;h2 id=&#34;--json-web-tokens-jwt&#34;&gt;- JSON Web Tokens (JWT)&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;./posts/13/Screenshot%202025-02-27%20at%209.23.47%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;--how-it-works&#34;&gt;- How it works:&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Client sends credentials to sever&lt;/li&gt;
&lt;li&gt;Sever generates a &lt;code&gt;JWT&lt;/code&gt; based on credentials, and provides it to user (following below structure).
&lt;ul&gt;
&lt;li&gt;For example, using the &lt;code&gt;RS256&lt;/code&gt; algorithm, the generated &lt;code&gt;JWT&lt;/code&gt; is signed with the &lt;strong&gt;server&amp;rsquo;s private key&lt;/strong&gt;, and verified by the client with the &lt;strong&gt;server&amp;rsquo;s public key&lt;/strong&gt;.
&lt;img src=&#34;./posts/13/Screenshot%202025-02-27%20at%209.24.40%20pm.png&#34; alt=&#34;&#34;&gt;(&lt;code&gt;JWT&lt;/code&gt; structure - &lt;a href=&#34;https://jwt.io/&#34;&gt;https://jwt.io/&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The client receives the&lt;code&gt;JWT&lt;/code&gt;, which is &lt;strong&gt;stored&lt;/strong&gt; in the &lt;strong&gt;client&amp;rsquo;s local storage/session storage/as a cookie.&lt;/strong&gt; AKA, the &lt;em&gt;&lt;strong&gt;state lives as a token on the client&lt;/strong&gt;&lt;/em&gt;, instead of &lt;strong&gt;on the&lt;/strong&gt; &lt;strong&gt;server&lt;/strong&gt; (as is with typical session-based authentication).
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Note:&lt;/em&gt; &lt;em&gt;the client also verifies the &lt;code&gt;JWT&lt;/code&gt; with the server&amp;rsquo;s public key, if using the &lt;code&gt;RS256&lt;/code&gt; algorithm.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;--jwt-based-authentication-drawbacks&#34;&gt;- JWT-based Authentication Drawbacks&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;State is stored client side&lt;/strong&gt; &amp;amp; can thus be dissected &amp;amp; manipulated&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Vulnerable to being accessed/stolen via XSS attacks&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;em&gt;Can&lt;/em&gt; be vulnerable to CSRF&lt;/strong&gt; based on how the &lt;code&gt;JWT&lt;/code&gt; is stored &amp;amp; sent.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Vulnerable to CSRF&lt;/strong&gt;: if the &lt;code&gt;JWT&lt;/code&gt; is stored as an &lt;strong&gt;&lt;code&gt;HTTP&lt;/code&gt;-only cookie&lt;/strong&gt; that is passed to the server with &lt;strong&gt;every request&lt;/strong&gt;.
&lt;ul&gt;
&lt;li&gt;to mitigate this, use &lt;code&gt;SameSite=Strict&lt;/code&gt; &amp;amp; additional &lt;code&gt;CSRF&lt;/code&gt; tokens with each request.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NOT (as) vulnerable to CSRF&lt;/strong&gt;: if the &lt;code&gt;JWT&lt;/code&gt; is stored in the &lt;code&gt;local/session storage&lt;/code&gt;, meaning it&amp;rsquo;s &lt;strong&gt;not sent with every request&lt;/strong&gt;. Instead, it must be manually passed into the request header (e.g. &lt;code&gt;Authorization: Bearer &amp;lt;token&amp;gt;&lt;/code&gt;) when authorising.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No server-side revocation&lt;/strong&gt; - token is valid until it expires.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Token expiration management&lt;/strong&gt; can be complex&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Data is &lt;code&gt;base64&lt;/code&gt; encoded, not encrypted&lt;/strong&gt; - so sensitive data should never be stored in JWTs, as anyone with the token can decode and read its contents.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&#34;--session-based-cookie-authentication&#34;&gt;- Session-based (cookie) authentication:&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;./posts/13/Screenshot%202025-02-27%20at%209.26.19%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;--how-it-works-1&#34;&gt;- How it works:&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Client provides credentials to the server&lt;/li&gt;
&lt;li&gt;Server generates a &lt;strong&gt;unique session ID&lt;/strong&gt; for the client and &lt;strong&gt;stores the session details &amp;amp; state in its local database.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Server sends the &lt;strong&gt;session ID&lt;/strong&gt; back within an &lt;code&gt;HTTP-only&lt;/code&gt; cookie, which is &lt;strong&gt;stored in the client browser&amp;rsquo;s cookie jar&lt;/strong&gt; (a storage for key-value pairs - &lt;em&gt;how cool is this name though-&lt;/em&gt;)&lt;/li&gt;
&lt;li&gt;The client sends this cookie back with subsequent requests, &amp;amp; each time, the server has to &lt;strong&gt;check the session&lt;/strong&gt; against the value in the server&amp;rsquo;s database.&lt;/li&gt;
&lt;li&gt;Upon logout, session ID is cleared from both the &lt;strong&gt;client side&lt;/strong&gt; and &lt;strong&gt;server database&lt;/strong&gt;.
&lt;img src=&#34;./posts/13/Screenshot%202025-02-27%20at%209.46.32%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;--session-based-authentication-drawbacks&#34;&gt;- Session-based Authentication Drawbacks:*&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Vulnerable to CSRF&lt;/strong&gt; (attackers using session IDs to perform actions on behalf of the user) as cookies are sent automatically with every request.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Processing power &amp;amp; complexity that increases with scale:&lt;/strong&gt; as sessions have to be generated, stored &amp;amp; managed on the server&amp;rsquo;s database.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Domain Restriction:&lt;/strong&gt; Cookies are domain-specific, making cross-domain authentication difficult without additional configurations like &lt;code&gt;CORS&lt;/code&gt; (Cross Origin Resource Sharing) or third-party cookies.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CORS&lt;/code&gt;: when a web app makes a cross-origin request (e.g. &lt;code&gt;example.com&lt;/code&gt; to &lt;code&gt;api.example.com&lt;/code&gt;), the browser sends an additional &lt;code&gt;CORS&lt;/code&gt; &lt;strong&gt;preflight request&lt;/strong&gt; to check if the server (&lt;code&gt;api.example.com&lt;/code&gt;) allows the cross-origin request. If it does, it needs to respond with the appropriate &lt;code&gt;CORS&lt;/code&gt; headers.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id=&#34;a-brief-comparison&#34;&gt;A brief comparison&amp;hellip;&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;./posts/13/Screenshot%202025-02-27%20at%2010.43.47%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;credit where credit is due, this &lt;em&gt;is&lt;/em&gt; from ChatGPT, but it was used as a sanity check after I did the bulk of the manual research to build a basis of understanding.
so, what am i saying by this? take&amp;hellip; &lt;em&gt;&lt;strong&gt;all of it with a grain of salt lol-&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Helpful Resources:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://portswigger.net/web-security/jwt#how-do-vulnerabilities-to-jwt-attacks-arise&#34;&gt;JWT attacks - Portswigger&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=UBUNrFtufWo&amp;amp;list=TLPQMjcwMjIwMjXKogKOoZBbBQ&amp;amp;index=4&amp;amp;t=65s&#34;&gt;Session vs Token Authentication in 100 Seconds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=LB_lBMWH4-s&amp;amp;list=TLPQMjcwMjIwMjXKogKOoZBbBQ&amp;amp;index=4&#34;&gt;Web Authentication Methods Explained&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.geeksforgeeks.org/session-based-authentication-vs-json-web-tokens-jwts-in-system-design/&#34;&gt;Session-Based Authentication vs. JSON Web Tokens (JWTs) in System Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://aegizz.github.io/ctfs/duckCTF2024&#34;&gt;Exploiting it in practice, within a CTF&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Branching out with a previous commit in a GitHub project</title>
      <link>/posts/12/reverting-to-an-older-version-of-a-github-project/</link>
      <pubDate>Sun, 12 Jan 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/12/reverting-to-an-older-version-of-a-github-project/</guid>
      <description>&lt;p&gt;&lt;em&gt;just a lil guide for my future self when i inevitably forget this again (and it&amp;rsquo;s probably still wrong oops-)&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;--steps&#34;&gt;- Steps:&lt;/h2&gt;
&lt;h3 id=&#34;--find-the-commit-you-want-to-revert-to--copy-its-hash&#34;&gt;- Find the commit you want to revert to &amp;amp; copy its hash:&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;./posts/12/Screenshot%202025-01-12%20at%2011.23.40%20am.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;--return-to-your-open-project&#34;&gt;- Return to your open project:&lt;/h3&gt;
&lt;p&gt;for me, i was working with a locally-cloned copy in VScode, connected to the remote repo&amp;rsquo;s &lt;code&gt;main&lt;/code&gt; branch, and was up to date with all of the changes made.&lt;/p&gt;
&lt;h3 id=&#34;--create-new-remote-branch&#34;&gt;- Create new remote branch:&lt;/h3&gt;
&lt;p&gt;open the terminal and run &lt;code&gt;git checkout -b &amp;lt;new-remote-branch&amp;gt; &amp;lt;old-commit-hash&amp;gt;&lt;/code&gt;. This will create a new remote branch &lt;strong&gt;populated with the project at the time of the commit hash you specified&lt;/strong&gt;, and switch you to it.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;E.g., &lt;code&gt;git checkout -b names-update 4853ecf5765b7174465e604e8fd8bdd5430ea84f&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&#34;--push-this-new-remote-branch&#34;&gt;- Push this new remote branch:&lt;/h3&gt;
&lt;p&gt;then, simply push this new remote branch with &lt;code&gt;git push origin &amp;lt;new-remote-branch&amp;gt;&lt;/code&gt;, and check that it appears on github!&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/12/Screenshot%202025-01-12%20at%2011.28.11%20am.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;Now you can operate off this new branch, containing the project in a previous commit&amp;rsquo;s state.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;yes&amp;hellip; i know this is a very simple thing to do that i only just kinda grasped &amp;gt;.&amp;lt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>building &amp; deploying this blog with hugo!</title>
      <link>/posts/10/building-hugo-blog/</link>
      <pubDate>Wed, 08 Jan 2025 00:00:00 +0000</pubDate>
      
      <guid>/posts/10/building-hugo-blog/</guid>
      <description>&lt;h1 id=&#34;and-now---to-the-story-of-how-this-blog-was-born&#34;&gt;&lt;em&gt;and now - to the story of how this blog was born!&lt;/em&gt;&lt;/h1&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;(it&amp;rsquo;s nothing special, but I thought I&amp;rsquo;d document it for myself when i inevitably forget how i did it in the future, as well as any other wandering lost souls out there!)&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;i&amp;rsquo;ve been meaning to re-jig my tech blog for a while now. for the last year and a bit, I experimented with the static site generator (SSG) &lt;a href=&#34;https://jekyllrb.com/&#34;&gt;jekyll&lt;/a&gt;. jekyll is essentially a tool built in &lt;a href=&#34;https://jekyllrb.com/docs/ruby-101/&#34;&gt;ruby&lt;/a&gt; that combines &lt;strong&gt;blog posts&lt;/strong&gt; (typically written in markdown, &lt;code&gt;.md&lt;/code&gt; files) with &lt;strong&gt;themes/config files&lt;/strong&gt; to generate browser-renderable code (&lt;code&gt;HTML&lt;/code&gt;, &lt;code&gt;CSS&lt;/code&gt; and &lt;code&gt;JS&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;this way, you can streamline your workflow, embed all sorts of cool features (comments, reactions, reading times, table of contents, automatic &lt;a href=&#34;https://en.wikipedia.org/wiki/RSS&#34;&gt;rss feeds&lt;/a&gt;, post dating etc.), and most importantly &lt;strong&gt;avoid the horror of writing blog posts in raw HTML&lt;/strong&gt;&amp;hellip; but still being able to dabble in it when you please (providing your markdown-to-html renderer permits that).&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Pasted%20image%2020250104220631.png&#34; alt=&#34;markdown vs html&#34;&gt;&lt;/p&gt;
&lt;p&gt;&amp;hellip;and all of this within a &lt;a href=&#34;https://www.geeksforgeeks.org/static-vs-dynamic-website/&#34;&gt;static site&lt;/a&gt; (all files pre-built on web-server, no databases) that is lightweight, responsive, maintainable and (relatively) quick to spin up.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;--why-did-i-move-away-from-jekyll&#34;&gt;- why did i move away from jekyll?&lt;/h2&gt;
&lt;p&gt;for three simple reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;i&amp;rsquo;d been meaning to try the SSG &lt;a href=&#34;https://gohugo.io/&#34;&gt;hugo&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;hugo is built in &lt;a href=&#34;https://go.dev/&#34;&gt;golang&lt;/a&gt;, and i&amp;rsquo;d been wanting to poke around with go for a while now.&lt;/li&gt;
&lt;li&gt;i found (and confirmed, after trying hugo) ruby &amp;amp; jekyll to be a bit more onerous to work with &amp;amp; overly-verbose in both site layout &amp;amp; base code. also - i noticed that jekyll had &lt;a href=&#34;https://css-tricks.com/comparing-static-site-generator-build-times/&#34;&gt;much slower build times&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2 id=&#34;--getting-up-and-running-with-hugo&#34;&gt;- getting up and running with hugo:&lt;/h2&gt;
&lt;p&gt;there are endless tutorials for this, and my pipeline is probably most similar to that of NetworkChuck in the &lt;a href=&#34;https://www.youtube.com/watch?v=dnE7c0ELEH8&amp;amp;t=907s&#34;&gt;recent video&lt;/a&gt; he released (not even a week before I went in on my own build, after sitting on the idea for ages haha - twas kinda spoopy :3).&lt;/p&gt;
&lt;h3 id=&#34;--setting-up-the-hugo-site&#34;&gt;- setting up the hugo site:&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Hugo has two simple dependencies: &lt;code&gt;git&lt;/code&gt; (for code version control), and the &lt;code&gt;go&lt;/code&gt; compiler toolchain. (here are where you can install &lt;a href=&#34;https://git-scm.com/&#34;&gt;&lt;code&gt;git&lt;/code&gt;&lt;/a&gt; and &lt;a href=&#34;https://go.dev/&#34;&gt;&lt;code&gt;go&lt;/code&gt;&lt;/a&gt;, if needed)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;after installing these, using the package manager of your choice (for me, &lt;code&gt;homebrew&lt;/code&gt;), &lt;a href=&#34;https://gohugo.io/installation/&#34;&gt;install hugo&lt;/a&gt; with &lt;code&gt;brew install hugo&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;choose a directory for your site, and open it in your code editor. ensure hugo is in your system PATH so you can access it via the command line, and run &lt;code&gt;hugo -v&lt;/code&gt; to ensure you&amp;rsquo;re on the latest.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;then simply run &lt;code&gt;hugo new site [SITENAME]&lt;/code&gt;, replacing &lt;code&gt;[SITENAME]&lt;/code&gt; with whatever you&amp;rsquo;d like to call the site (&amp;amp; folder it lives in). hugo will then spinup the basic bones of your site, and navigate into the folder it creates with &lt;code&gt;cd&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;initialise an empty git repository in this new folder with &lt;code&gt;git init&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;to install a theme, browse them &lt;a href=&#34;https://themes.gohugo.io/&#34;&gt;here&lt;/a&gt;, and follow the instructions in the theme&amp;rsquo;s description (as some methods vary).
however, the most common is installation is via a &lt;strong&gt;git submodule&lt;/strong&gt; - which essentially will just pull down an existing git repo containing a pre-built hugo theme, and populate your site&amp;rsquo;s &lt;code&gt;themes&lt;/code&gt; folder with it. this way, when building your site, hugo will use it as a base layout, and add any changes made to your site on top of it.
for me, i ran: &lt;code&gt;git submodule add https://github.com/michaelneuper/hugo-texify3.git themes/hugo-texify3&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;now, your site&amp;rsquo;s directory tree should look something like the following:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Screenshot%202025-01-08%20at%206.35.22%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;Folders &amp;amp; files are fairly self-explanatory, with the main ones being:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;hugo.toml&lt;/code&gt;&lt;/strong&gt; - your site&amp;rsquo;s configuration variables.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;/content&lt;/code&gt;&lt;/strong&gt; - where you create folders to store blog posts (&lt;code&gt;.md&lt;/code&gt;) &amp;amp; site pages&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;/assets&lt;/code&gt;&lt;/strong&gt; - ideally where media is stored &amp;amp; linked (although you can place them anywhere, theoretically, providing you link back to it correctly)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;/public&lt;/code&gt; (only created when website is built, see step 8.)&lt;/strong&gt; - where your &lt;strong&gt;raw website&lt;/strong&gt; (raw HTML, CSS, JS) will be built to and live. &lt;strong&gt;you shouldn&amp;rsquo;t need to touch this folder.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;/themes&lt;/code&gt;&lt;/strong&gt; - where all of your sites themes are installed (and specified/switched between in &lt;code&gt;hugo.toml&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;sometimes, themes require installing &lt;strong&gt;other tools&lt;/strong&gt; as part of their custom build process. this &lt;em&gt;should&lt;/em&gt; be specified in the theme&amp;rsquo;s documentation.
for me, that required needing to install the following with &lt;code&gt;npm&lt;/code&gt;:
&lt;code&gt;npm install postcss-cli autoprefixer postcss-import&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;to build your site locally, ensure you&amp;rsquo;re in your site&amp;rsquo;s base directory and run &lt;code&gt;hugo server -t [THEME-NAME]&lt;/code&gt; (if using a theme).
for me: &lt;code&gt;hugo server -t hugo-texify3&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Screenshot%202025-01-08%20at%206.33.44%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;now, navigate to the local address to see your site in action! it should live-reload as you make changes in your code editor.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;[EXTRA]&lt;/strong&gt; after analysing my specific theme&amp;rsquo;s layout &amp;amp; directory structure, I mirrored elements of it (thus overwriting what was contained in the &lt;code&gt;/themes&lt;/code&gt; folder) to create the below folder structure, allowing me to:
- add dedicated website pages in &lt;code&gt;/pages&lt;/code&gt;
- use &lt;code&gt;/posts&lt;/code&gt; to hold my site post, with each in its own &lt;strong&gt;folder&lt;/strong&gt; alongside any assets (images, media, etc.). this was done due to my particular workflow (writing in obsidian, see below).
- split site configuration into two files for readability in &lt;code&gt;/config&lt;/code&gt;: one for parameters (enabling/disabling certain features like social links, metadata etc.), and one for overall config &amp;amp; layout.
&lt;img src=&#34;./posts/10/heya.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;--pushing-to-remote-git-repository--deploying-via-cloudflare-pages&#34;&gt;- pushing to remote git repository &amp;amp; deploying via cloudflare pages&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;(aka my weird custom workflow):&lt;/em&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;after running &lt;code&gt;git init&lt;/code&gt;, ensure you are authenticated locally with &lt;code&gt;gh auth login&lt;/code&gt; (requires use of Github CLI, install with &lt;code&gt;brew install gh&lt;/code&gt; or similar)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;create a new repository on GitHub with:
&lt;code&gt;gh repo create juni-blog --public --source=. --remote=origin&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--public&lt;/code&gt;: sets repo as public, as cloudflare will need to monitor it for changes&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--source=.&lt;/code&gt;: initialises the remote repository with your current local directory&amp;rsquo;s contents&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--remote=origin&lt;/code&gt;: sets up the remote URL for the repository&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;now, just push the local branch to the remote with &lt;code&gt;git push -u origin main&lt;/code&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;-u&lt;/code&gt; (or &lt;code&gt;--set-upstream&lt;/code&gt;) option in &lt;code&gt;git push&lt;/code&gt; links your &lt;strong&gt;local branch&lt;/strong&gt; (&lt;code&gt;main&lt;/code&gt;) to the &lt;strong&gt;remote branch&lt;/strong&gt; (&lt;code&gt;origin&lt;/code&gt;) by default, allowing you to run &lt;code&gt;git push&lt;/code&gt; and &lt;code&gt;git pull&lt;/code&gt; commands in the future without adding &lt;code&gt;origin main&lt;/code&gt; at the end (AKA specifying which remote branch to interact with by default).&lt;/p&gt;&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;navigate to your remote repository on github to check whether the changes have been propagated!&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;setup, login to and open &lt;a href=&#34;https://dash.cloudflare.com/&#34;&gt;cloudflare pages&lt;/a&gt; and navigate to your &lt;strong&gt;&lt;code&gt;Workers &amp;amp; Pages&lt;/code&gt;&lt;/strong&gt; section, then &lt;strong&gt;&lt;code&gt;Create&lt;/code&gt;&lt;/strong&gt; to deploy a new &amp;ldquo;site&amp;rdquo;. The click &lt;strong&gt;&lt;code&gt;Connect to Git&lt;/code&gt;&lt;/strong&gt; and follow the prompts to authenticate, and link to the repository that you just pushed to.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Screenshot%202025-01-08%20at%206.56.36%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Screenshot%202025-01-08%20at%206.58.49%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;After that, you can specify which branch Cloudflare should look for changes on, as any frameworks that you&amp;rsquo;re using to build &amp;amp; deploy the site, and where the built assets &amp;amp; HTML files are stored. I selected &lt;code&gt;Hugo&lt;/code&gt; (for obvious reasons), and it populated the build command with a simple &lt;code&gt;hugo&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;However&lt;/strong&gt;&lt;/em&gt;, if your site requires other tools as part of the build process like mine (specified in step 8 in the previous section), be sure to &lt;strong&gt;install them on the remote server this site is running off&lt;/strong&gt; with the relevant commands. for me, these are:
&lt;code&gt;npm install postcss-cli autoprefixer postcss-import &amp;amp;&amp;amp; hugo&lt;/code&gt;
Cloudflare should provide logs from the remote server should your build fail, making troubleshooting fairly simple.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Screenshot%202025-01-08%20at%207.01.36%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;then you&amp;rsquo;re all set! cloudflare will now watch for any changes made to the specified branch of this repo (for me, &lt;code&gt;main&lt;/code&gt;), and if detected, it will automatically run &lt;code&gt;npm install postcss-cli autoprefixer postcss-import &amp;amp;&amp;amp; hugo&lt;/code&gt; on its remote server(s) to build the updated version of my site, and then serve &lt;strong&gt;only&lt;/strong&gt; the created HTML, CSS &amp;amp; JS files in the specified output directory (for me, &lt;code&gt;public&lt;/code&gt;).
you should be able to access your site from the default URL created and provided to you, like &lt;a href=&#34;https://b3ce9f44.juni-blog.pages.dev/&#34;&gt;https://b3ce9f44.juni-blog.pages.dev/&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;[extra]&lt;/strong&gt; to change this URL to a custom domain that you own, go to the &lt;strong&gt;&lt;code&gt;Custom Domain&lt;/code&gt;&lt;/strong&gt; section of the page you just created, click &lt;strong&gt;Set up a custom domain&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Screenshot%202025-01-08%20at%207.16.58%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;Then, follow the prompts. In my case, I associated the &lt;code&gt;myblog&lt;/code&gt; CNAME with this &amp;ldquo;Page&amp;rdquo; (&lt;code&gt;juni-blog.pages.dev&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Screenshot%202025-01-08%20at%207.13.22%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;Then, simply navigate to your domain&amp;rsquo;s (&lt;code&gt;juni-mp4.com&lt;/code&gt;) DNS records (for me, also managed via Cloudflare) and add a record for the CNAME you just specified.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Screenshot%202025-01-08%20at%207.16.02%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;This means that when someone visits &lt;code&gt;myblog.juni-mp4.com&lt;/code&gt;, they will functionally be visiting &lt;code&gt;juni-blog.pages.dev&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;this combination of github &amp;amp; cloudflare pages allows me to easily host &amp;amp; deploy sites from &lt;strong&gt;different github repos&lt;/strong&gt;, each built with &lt;strong&gt;all kinds of different build methods&lt;/strong&gt; (from hand-coding raw HTML/CSS/JS to using various SSGs like &lt;code&gt;jekyll&lt;/code&gt;, &lt;code&gt;hugo&lt;/code&gt; etc.), as subdomains of my primary domain &lt;code&gt;juni-mp4.com&lt;/code&gt; and all served securely &amp;amp; quickly from Cloudflare&amp;rsquo;s worldwide array of web servers. &lt;em&gt;(not sponsored haha - the only thing you monetarily pay for is your domain registration fee, and even that is optional.)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Side note:&lt;/strong&gt;&lt;/em&gt; &lt;em&gt;yes, whilst you could argue that you &amp;ldquo;pay&amp;rdquo; in the form of you &amp;amp; your content being technically in the hands of cloudflare, outside of hosting file files yourself on a VPS or a home server - which comes with a slew of additional overhead, maintenance and security configuration concerns - this is a fairly reasonable compensation to make for the uptime, security &amp;amp; responsiveness that Cloudflare&amp;rsquo;s network of servers provides, at least imho and for my use case.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;this very particular workflow &amp;amp; need for flexibility is why i chose to use cloudflare instead of just deploying straight from &lt;a href=&#34;https://pages.github.com/&#34;&gt;Github Pages&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;--my-final-note-taking-process-an-overview&#34;&gt;- my final note-taking process: an overview&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;open my Obsidian &amp;ldquo;blog&amp;rdquo; vault, and create a new note within a folder in &lt;code&gt;posts&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Screenshot%202025-01-04%20at%2010.27.21%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;the &lt;a href=&#34;https://silentvoid13.github.io/Templater/introduction.html&#34;&gt;Templater&lt;/a&gt; plugin auto-generates the hugo-formatted frontmatter you see above in every new note, using the code block below inside the &lt;code&gt;template&lt;/code&gt; file.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;title&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;date&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;&amp;lt;% tp.file.creation_date(&amp;#34;YYYY-MM-DD&amp;#34;) %&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;description&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;toc&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;math&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;draft&lt;/span&gt;: &lt;span style=&#34;color:#66d9ef&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;categories&lt;/span&gt;: 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;tags&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;write the post :3. drag &amp;amp; drop / copy-paste images as needed, after making sure the &lt;code&gt;Absolute path in vault&lt;/code&gt; option is selected in your vault&amp;rsquo;s &lt;strong&gt;Files and links&lt;/strong&gt; settings. This may need to be tweaked depending on your site&amp;rsquo;s layout later, but it worked for me, and is easily changed in bulk in VSCode or a similar editor via &lt;strong&gt;find &amp;amp; replace&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Screenshot%202025-01-04%20at%2010.28.55%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;once I&amp;rsquo;m finished writing, I switch to my full website directory tree in VSCode (my Obsidian &amp;ldquo;blog&amp;rdquo; vault is just the website&amp;rsquo;s &lt;code&gt;content&lt;/code&gt; folder, hence the &lt;code&gt;.obsidian&lt;/code&gt; folder inside it).&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Screenshot%202025-01-04%20at%2010.33.17%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;p&gt;i run the build command &lt;code&gt;hugo server -t [theme-name-here]&lt;/code&gt; in the VScode terminal to start a live server, and visit &lt;code&gt;http://localhost:1313/&lt;/code&gt; to double check that the changes have been formatted properly.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/10/Screenshot%202025-01-04%20at%2010.41.47%20pm.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;then a simple &lt;code&gt;git commit -m &amp;quot;new blog post: hugo site build&amp;quot; -a &amp;amp;&amp;amp; git push origin main&lt;/code&gt; pushes the changes to my site where it&amp;rsquo;s rebuilt &amp;amp; served as new HTML pages!&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
</description>
    </item>
    
    <item>
      <title>&#39;securely&#39; setting up web server with nginx @ home &amp; self hosting</title>
      <link>/posts/9/securely-self-hosting-site-npm/</link>
      <pubDate>Thu, 26 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>/posts/9/securely-self-hosting-site-npm/</guid>
      <description>&lt;ol&gt;
&lt;li&gt;debian 12 container install inside proxmox&lt;/li&gt;
&lt;li&gt;`sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y&lt;/li&gt;
&lt;li&gt;network settings: If your router supports subnets/VLANs, connect this to the isolated VLAN. within proxmox, assign static IP not in use and point to your router&amp;rsquo;s gateway.![[Screenshot 2024-07-08 at 8.40.32 PM.png]]&lt;/li&gt;
&lt;li&gt;install nginx on debian - &lt;code&gt;sudo apt install nginx -y&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;create a file for website settings: `nano /etc/nginx/sites-available/mywebsite&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;server&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;listen&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;80&lt;/span&gt; ; 
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;listen&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;[::]:80&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;server_name&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;juni-mp4.org&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;root&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;/var/www/juni-web&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;index.html&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;index.htm&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;index.nginx-debian.html&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;location&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#f92672&#34;&gt;try_files&lt;/span&gt; $uri $uri/ =&lt;span style=&#34;color:#ae81ff&#34;&gt;404&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;listen&lt;/code&gt; lines tell &lt;code&gt;nginx&lt;/code&gt; to listen for connections on both IPv4 and IPv6.
The &lt;code&gt;server_name&lt;/code&gt; is the website that we are looking for. By putting &lt;code&gt;landchad.net&lt;/code&gt; here, that means whenever someone connects to this server and is looking for that address, they will be directed to the content in this block. &lt;code&gt;root&lt;/code&gt; specifies the directory we&amp;rsquo;re going to put our website files in.&lt;/p&gt;
&lt;p&gt;This can theoretically be wherever, but it is conventional to have them in &lt;code&gt;/var/www/&lt;/code&gt;. Name the directory in that whatever you want. &lt;code&gt;index&lt;/code&gt; determine what the &amp;ldquo;default&amp;rdquo; file is; normally when you go to a website, say &lt;code&gt;landchad.net&lt;/code&gt;, you are actually going to a file at &lt;code&gt;landchad.net/index.html&lt;/code&gt;. That&amp;rsquo;s all that is. Note that that this in concert with the line above mean that &lt;code&gt;/var/www/landchad/index.html&lt;/code&gt;, a file on our computer that we&amp;rsquo;ll create, will be the main page of our website.&lt;/p&gt;
&lt;p&gt;Lastly, the &lt;code&gt;location&lt;/code&gt; block is really just telling the server how to look up files, otherwise throw a 404 error. Location settings are very powerful, but this is all we need them for now.
7. create directory for your website&amp;rsquo;s contents/files using: &lt;code&gt;mkdir /var/www/juni-web&lt;/code&gt; (can be located wherever but standard to store in &lt;code&gt;/var/www/[X]&lt;/code&gt; ) where you can place website files like &lt;code&gt;index.html&lt;/code&gt; etc.)
8. enable the site by making a link between the config file in you just created in &lt;code&gt;sites-available&lt;/code&gt; and the &lt;code&gt;sites-enabled&lt;/code&gt; directory:
&lt;code&gt;ln -s /etc/nginx/sites-available/juni-web /etc/nginx/sites-enabled/ 9. restart nginx &lt;/code&gt;systemctl restart nginx`&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;make sure the &amp;ldquo;default&amp;rdquo; file doesn&amp;rsquo;t remain in &lt;code&gt;/etc/nginx/sites-enabled/&lt;/code&gt; otherwise will serve the default config page for nginx!!&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;main-nginx-files--explanation&#34;&gt;Main Nginx Files &amp;amp; Explanation:&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;The idea is that you can make a site configuration file in &lt;code&gt;sites-available&lt;/code&gt; (that links to where your website is stored locally, e.g. &lt;code&gt;/var/www/sitestorage&lt;/code&gt;), then make a link to this configuration file in &lt;code&gt;sites-enabled&lt;/code&gt;, which will activate it.&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&#34;config-files&#34;&gt;Config Files:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;/etc/nginx/sites-available/&lt;/code&gt; - directory containing any site configuration files. Points to directory containing main website content, e.g. &lt;code&gt;/var/www/juni-web&lt;/code&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-nginx&#34; data-lang=&#34;nginx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;server&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;listen&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;80&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;listen&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;[::]:80&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;server_name&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;juni-mp4.org&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;root&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;/var/www/juni-web&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;index.html&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;index.htm&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;index.nginx-debian.html&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#f92672&#34;&gt;location&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                &lt;span style=&#34;color:#f92672&#34;&gt;try_files&lt;/span&gt; $uri $uri/ =&lt;span style=&#34;color:#ae81ff&#34;&gt;404&lt;/span&gt; ;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;/etc/nginx/sites-enabled/&lt;/code&gt; - directory containing &lt;strong&gt;links&lt;/strong&gt; to site configuration files
make links via: `ln -s [link-source-path] [link-destination-path]&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;main-website-location&#34;&gt;Main website location:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/var/www/[site-name]&lt;/code&gt;&#39;
e.g. &lt;code&gt;/var/www/juni-web&lt;/code&gt;
contains files like index.html, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&#34;securing-it&#34;&gt;Securing it:&lt;/h1&gt;
&lt;h3 id=&#34;ufw&#34;&gt;UFW:&lt;/h3&gt;
&lt;p&gt;sudo apt install ufw&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# Limit SSH access to port 22 
sudo ufw limit 22/tcp 

# Allow HTT![[Screenshot 2024-07-19 at 9.04.25 PM.png]]P traffic on port 80 
sudo ufw allow 80 

# Allow HTTPS traffic on port 443 
sudo ufw allow 443 

# Limit SSH access to port 22 for IPv6 
sudo ufw limit 22/tcp6 

# Allow HTTP traffic on port 80 for IPv6 
sudo ufw allow 80/tcp6 

# Allow HTTPS traffic on port 443 for IPv6 
sudo ufw allow 443/tcp6

ufw enable

ufw logging on

ufw status
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;![[Screenshot 2024-07-09 at 11.51.31 PM.png]]
&lt;a href=&#34;https://www.linode.com/docs/guides/configure-firewall-with-ufw/&#34;&gt;https://www.linode.com/docs/guides/configure-firewall-with-ufw/&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&#34;docker-install-debian&#34;&gt;docker install (&lt;a href=&#34;https://docs.docker.com/engine/install/debian/&#34;&gt;debian&lt;/a&gt;):&lt;/h1&gt;
&lt;p&gt;Run the following command to uninstall all conflicting packages:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; pkg in docker.io docker-doc docker-compose podman-docker containerd runc; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt; sudo apt-get remove $pkg; &lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;install dependencies:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Set up Docker&amp;rsquo;s &lt;code&gt;apt&lt;/code&gt; repository.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Add Docker&amp;#39;s official GPG key:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get install ca-certificates curl
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo install -m &lt;span style=&#34;color:#ae81ff&#34;&gt;0755&lt;/span&gt; -d /etc/apt/keyrings
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo chmod a+r /etc/apt/keyrings/docker.asc
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Add the repository to Apt sources:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#ae81ff&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;  &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;deb [arch=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;dpkg --print-architecture&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;  &lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;. /etc/os-release &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$VERSION_CODENAME&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; stable&amp;#34;&lt;/span&gt; | &lt;span style=&#34;color:#ae81ff&#34;&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;  sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;install latest docker version&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Verify that the installation is successful by running the &lt;code&gt;hello-world&lt;/code&gt; image:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; sudo docker run hello-world
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;docker-compose-install&#34;&gt;docker compose install&lt;/h2&gt;
&lt;p&gt;why install it? manage all containers &amp;amp; deployments from a &lt;a href=&#34;https://docs.docker.com/compose/&#34;&gt;single yaml file&lt;/a&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get update
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo apt-get install docker-compose-plugin
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker compose version
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;![[Screenshot 2024-07-10 at 12.12.09 AM.png]]&lt;/p&gt;
&lt;p&gt;create compose file near website data for ease of management&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## if website located in mkdir /var/www/juni-web&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir /var/www/docker-compose
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano docker-compose.yml
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;we can use this to install&amp;hellip;&lt;/p&gt;
&lt;h3 id=&#34;nginx-proxy-manager-npm-install&#34;&gt;nginx proxy manager (NPM) install&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;(not to be confused with node package manager npm lol)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;note: make sure to set ports for managing nginx proxy manager (NPM) to 8080 &amp;amp; 4443 (or whatever custom ones you&amp;rsquo;d like) and NOT 80 &amp;amp; 443, as the latter will likely be in use by nginx to serve &amp;amp; access your website at.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;in the docker-compose.yml&amp;hellip;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd /var/www/docker-compose
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;nano docker-compose.yml
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## then add into file:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;services:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  app:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    image: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;jc21/nginx-proxy-manager:latest&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    restart: unless-stopped
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ports:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# These ports are in format &amp;lt;host-port&amp;gt;:&amp;lt;container-port&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;8080:80&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;# Port for HTTP access to NPM&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;4443:443&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;# Port for HTTS access to NPM&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;81:81&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;# Admin Web Port&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# Add any other Stream port you want to expose&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# - &amp;#39;21:21&amp;#39; # FTP&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;# Uncomment the next line if you uncomment anything in the section&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;# environment:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# Uncomment this if you want to change the location of&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# the SQLite DB file within the container&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# DB_SQLITE_FILE: &amp;#34;/data/database.sqlite&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# Uncomment this if IPv6 is not enabled on your host&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#75715e&#34;&gt;# DISABLE_IPV6: &amp;#39;true&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    volumes:
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - ./data:/data
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      - ./letsencrypt:/etc/letsencrypt
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## then run&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;docker compose up -d
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;access nginx via &lt;code&gt;http://[server-ip]:81&lt;/code&gt; &amp;amp; login with &lt;code&gt;admin@example.com&lt;/code&gt; and &lt;code&gt;changeme&lt;/code&gt;  (changed upon entry)&lt;/p&gt;
&lt;h2 id=&#34;cloudflare-setup&#34;&gt;cloudflare setup&lt;/h2&gt;
&lt;p&gt;sign up for free cloudflare account
follow signup steps to point existing domain at cloudflare&lt;/p&gt;
&lt;p&gt;autoscan for any DNS records you changed with your registrar (* domains, subdomains etc.) so cloudflare is aware of them&lt;/p&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 9.05.00 PM.png]]
![[Screenshot 2024-07-19 at 9.09.40 PM.png]]&lt;/p&gt;
&lt;p&gt;navigate to your domain registrar and set the custom DNS servers to the ones provided to you by cloudflare.&lt;/p&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 9.08.37 PM.png]]&lt;/p&gt;
&lt;p&gt;cloudflare setup guide here - &lt;a href=&#34;https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/&#34;&gt;https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/&lt;/a&gt;
![[Screenshot 2024-07-19 at 9.17.23 PM.png]]
![[Screenshot 2024-07-19 at 9.17.34 PM.png]]
![[Screenshot 2024-07-19 at 9.18.03 PM.png]]&lt;/p&gt;
&lt;p&gt;API token:  HRWvk067sLPv_RMGDPhS1y0lj5XDcLErat5nY18m
verify with cul command:
&lt;code&gt;   curl -X GET &amp;quot;https://api.cloudflare.com/client/v4/user/tokens/verify&amp;quot; \        -H &amp;quot;Authorization: Bearer [YOUR TOKEN]&amp;quot; \ -H &amp;quot;Content-Type:application/json&amp;quot;&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;cloudflare--ssl-issues-certbot&#34;&gt;Cloudflare &amp;amp; SSL issues (certbot)&lt;/h3&gt;
&lt;p&gt;if you&amp;rsquo;ve setup certbot or something similar to manage ssl certificates on your nginx server, MAKE SURE to go to cloudflare and select Full (strict) SSL/TLS encryption mode so it doesn&amp;rsquo;t have an SSL mismatch and make your site inaccessible via the browser - ![[Screenshot 2024-07-19 at 10.00.00 PM.png]]&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Why:&lt;/strong&gt; as with &lt;strong&gt;&amp;lsquo;flexible&amp;rsquo;&lt;/strong&gt; ticked, cloudflare will (by default) try and make requests to your server via HTTP and the server will throw an error if it&amp;rsquo;s using SSL due to a cipher mismatch, then browsers interpret this as a potential MiTM attack. see below: ![[Screenshot 2024-07-19 at 10.03.20 PM.png]]
![[Screenshot 2024-07-19 at 10.03.46 PM.png]]&lt;/p&gt;
&lt;p&gt;you can also check your site&amp;rsquo;s nginx config file to see that certs are set up properly:&lt;/p&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 10.07.33 PM.png]]&lt;/p&gt;
&lt;h2 id=&#34;opening-the-ports&#34;&gt;OPENING the ports&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;External port&lt;/strong&gt;: what port is used by external users to access, like:
&lt;code&gt;pu.bl.ic.ip:[external-port]&lt;/code&gt;
e.g. &lt;code&gt;182.46.382.83:443&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Internal port&lt;/strong&gt;: what port on the specified &lt;strong&gt;Device&lt;/strong&gt; (the one identified by the &lt;code&gt;Device IP Address&lt;/code&gt; field) that the traffic will be forwarded to.&lt;/p&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 10.24.08 PM.png]]&lt;/p&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 10.23.53 PM.png]]&lt;/p&gt;
&lt;h2 id=&#34;set-up-static-ip-for-container-in-proxmox-on-router&#34;&gt;set up static IP for container in proxmox on router&lt;/h2&gt;
&lt;p&gt;OR just change the DHCP pool to not include the IP address you want statically added on the proxmox&lt;/p&gt;
&lt;p&gt;(e.g. setting DNS pool to &lt;code&gt;192.168.0.20&lt;/code&gt; -&amp;gt;  &lt;code&gt;192.168.0.200&lt;/code&gt; and then assigning static IP for your container in proxmox outside of the pool range but on the same subnet, e.g. &lt;code&gt;192.168.0.5&lt;/code&gt; )
![[Screenshot 2024-07-19 at 10.19.57 PM.png]]&lt;/p&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 10.19.45 PM.png]]&lt;/p&gt;
&lt;h2 id=&#34;adding-ssl-cert-to-nginx-proxy-manager&#34;&gt;adding SSL cert to nginx proxy manager&lt;/h2&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 10.40.02 PM.png]]&lt;/p&gt;
&lt;p&gt;certs on web server:
![[Screenshot 2024-07-19 at 10.43.38 PM.png]]&lt;/p&gt;
&lt;h2 id=&#34;setup-proxy-host-on-npm&#34;&gt;setup proxy host on NPM&lt;/h2&gt;
&lt;p&gt;![[Screenshot 2024-07-19 at 11.37.22 PM.png]]
![[Screenshot 2024-07-19 at 11.38.09 PM.png]]&lt;/p&gt;
&lt;h2 id=&#34;setup-npm--dynamic-dns&#34;&gt;setup NPM &amp;amp; dynamic DNS&lt;/h2&gt;
&lt;p&gt;to do:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; &lt;a href=&#34;https://anebula.io/how-to-set-up-nginx-proxy-manager-using-docker-compose/&#34;&gt;https://anebula.io/how-to-set-up-nginx-proxy-manager-using-docker-compose/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; &lt;a href=&#34;https://www.youtube.com/watch?v=GarMdDTAZJo&#34;&gt;https://www.youtube.com/watch?v=GarMdDTAZJo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; &lt;a href=&#34;https://notthebe.ee/blog/easy-ssl-in-homelab-dns01/&#34;&gt;https://notthebe.ee/blog/easy-ssl-in-homelab-dns01/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; set up nginx reverse proxy, cloudflare etc. &lt;a href=&#34;https://blog.prutser.net/2021/01/20/how-to-securely-self-host-a-website-or-web-app/&#34;&gt;https://blog.prutser.net/2021/01/20/how-to-securely-self-host-a-website-or-web-app/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; install certbot &amp;amp; auto renewal &amp;amp; setup https&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; setup firewall around docker - &lt;a href=&#34;https://docs.docker.com/network/packet-filtering-firewalls/#docker-and-ufw&#34;&gt;https://docs.docker.com/network/packet-filtering-firewalls/#docker-and-ufw&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; ssh harden copy config files &amp;amp; replace keys&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; install auto updates for all respective software (docker, docker compose, nginx, nginx proxy manager, ufw, anything else used)&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; port forward website to internet to make accessible&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; update domain registrar to point to local public IP&lt;/li&gt;
&lt;li&gt;&lt;input disabled=&#34;&#34; type=&#34;checkbox&#34;&gt; write scp command that writes locally-edited files to website remotely
&lt;code&gt;scp -r user@[remoteTargetComputerIP]: [RemoteFilesPath] [localDestinationPath] e.g. &lt;/code&gt;scp -r &lt;a href=&#34;mailto:root@45.77.26.67&#34;&gt;root@45.77.26.67&lt;/a&gt;:/var/www/mysite ~&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;DISCLAIMER:&lt;/strong&gt; &lt;em&gt;I would consider this a LEGACY POST of mine, written a long time ago. Please excuse any typos, errors or lapses in memory/judgement - as it was added to the site from the archives, just to put everything in one place. Thankq for your understanding 🙇‍♀️&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
</description>
    </item>
    
    <item>
      <title>Backing up linux .config &amp; apps to move to a new device/distro</title>
      <link>/posts/8/backup-linux-config-and-apps/</link>
      <pubDate>Wed, 25 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>/posts/8/backup-linux-config-and-apps/</guid>
      <description>&lt;h1 id=&#34;burn-it-all-down-or&#34;&gt;burn it all down&amp;hellip; or?&lt;/h1&gt;
&lt;p&gt;Ahh, a tale born from the first time that I dipped my toes into the weird, wide and wonderful world of distro-hopping. Because sometimes, instead of building it all from scratch again (like so many of us are fond of doing), bringing your old config, notes of a previous home, with you is desirable. Because don&amp;rsquo;t lie - we won&amp;rsquo;t get those hours spent tweaking shell configs to look &lt;em&gt;just&lt;/em&gt; how we like it back.&lt;/p&gt;
&lt;p&gt;In any case - the following (somewhat high-level) overview should get you up and running on a new system/distro fairly quickly, in an environment&lt;/p&gt;
&lt;p&gt;Basically, most user settings (from my research - some may be hidden in other corners, but this got me back to a similar place) are stored in `/home/[user-name]/.config/.&lt;/p&gt;
&lt;p&gt;So, for me, this was at &lt;code&gt;/home/juni/.config/&lt;/code&gt;. So, simply copy that folder to an external drive or over the network, and paste it in the corresponding place on your new system.&lt;/p&gt;
&lt;h2 id=&#34;--copying-over-config&#34;&gt;- Copying over .config&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;cd /home/[user]/&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;navigate to the user&amp;rsquo;s directory where the &lt;code&gt;.config&lt;/code&gt; folder is stored.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;`sudo tar cvzf configs-backup.tgz .config/&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;creates a compressed archive (&lt;code&gt;configs-backup.tgz&lt;/code&gt;) of the &lt;code&gt;.config&lt;/code&gt; folder with &lt;code&gt;tar&lt;/code&gt;, and passing &lt;code&gt;cvzf&lt;/code&gt; as parameters:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;c&lt;/code&gt; - &lt;code&gt;c&lt;/code&gt;reate a new archive&lt;/li&gt;
&lt;li&gt;&lt;code&gt;v&lt;/code&gt; - enable &lt;code&gt;v&lt;/code&gt;erbose output, to monitor the progress&lt;/li&gt;
&lt;li&gt;&lt;code&gt;z&lt;/code&gt; - compress with the g&lt;code&gt;z&lt;/code&gt;ip algorithm&lt;/li&gt;
&lt;li&gt;&lt;code&gt;f&lt;/code&gt; - specifies the name of the created archive &lt;code&gt;f&lt;/code&gt;ile (in this case, &lt;code&gt;configs-backup.tgz&lt;/code&gt;)
Alternatively, you could use a tool like &lt;code&gt;rsync&lt;/code&gt; to copy the &lt;strong&gt;entire&lt;/strong&gt; &lt;code&gt;/home/&lt;/code&gt; folder to an external ssd, although this can take a &lt;strong&gt;long time&lt;/strong&gt; depending on its size. I&amp;rsquo;d recommend &lt;code&gt;rsync&lt;/code&gt; over just copying with &lt;code&gt;cp&lt;/code&gt;, as &lt;code&gt;rsync&lt;/code&gt; copies all files &lt;strong&gt;whilst&lt;/strong&gt; retaining &lt;code&gt;owner/group/other&lt;/code&gt; file permissions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If connecting an external SSD to copy to:
`sudo fdisk -l&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;lists the connected disk drives and their corresponding filesystem location - like `/dev/sda1)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;`sudo mkdir -p /mnt/externalssd&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;creates a folder on your computer&amp;rsquo;s filesystem to act as a &lt;strong&gt;mount point:&lt;/strong&gt; i.e. a place where you can access files stored on a mounted external SSD.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;`sudo mount -t exfat /dev/sda1 /mnt/externalssd&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Mounting the SSD (the device we found at &lt;code&gt;/dev/sda1&lt;/code&gt;) &amp;lsquo;in&amp;rsquo; this new folder created in the previous step, allowing all the files on it to appear in &lt;code&gt;/mnt/externalssd&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You should now be able to navigate there with &lt;code&gt;cd /mnt/externalssd&lt;/code&gt; and run a &lt;code&gt;ls&lt;/code&gt; to show the SSD&amp;rsquo;s existing contents. Then, copy the compressed .config file with &lt;code&gt;cp /home/[user]/configs-backup.tgz /mnt/externalssd&lt;/code&gt; (may require prepending &lt;code&gt;sudo&lt;/code&gt; depending on user permissions) - and you&amp;rsquo;re done!.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you opted for &lt;code&gt;rsync&lt;/code&gt; instead above:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo rsync -avh --progress /home/[user]/ /mnt/externalssd/home-backup&lt;/code&gt;
- &lt;code&gt;a&lt;/code&gt; - preserves file &lt;code&gt;a&lt;/code&gt;ttributes &amp;amp; ensures a &lt;strong&gt;mirror copy&lt;/strong&gt; is created, including permissions, symlinks, etc.
- &lt;code&gt;v&lt;/code&gt; - enable &lt;code&gt;v&lt;/code&gt;erbose output, to monitor the progress
- &lt;code&gt;h&lt;/code&gt; - ensures output is &lt;code&gt;h&lt;/code&gt;uman-readable
- &lt;code&gt;--progress&lt;/code&gt; - displays real-time progress for troubleshooting purposes.&lt;/p&gt;
&lt;ol start=&#34;7&#34;&gt;
&lt;li&gt;
&lt;p&gt;Now just unmount the drive with &lt;code&gt;sudo umount /mnt/externalssd&lt;/code&gt; (or don&amp;rsquo;t - live on the edge ;), plug it into new machine/distro, and copy the file you created over into &lt;code&gt;/home/[new-user]/&lt;/code&gt; with &lt;code&gt;cp&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Make sure to de-compress the file (if you used &lt;code&gt;tar&lt;/code&gt;) with &lt;code&gt;tar xvzf configs-backup.tgz&lt;/code&gt;, so it can be read by the system!&lt;/p&gt;
&lt;p&gt;Then reboot, and your settings should be re-applied! :3&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;--bonus-grabbing-a-list-of-installed-packages-to-re-install&#34;&gt;- BONUS: Grabbing a list of installed packages to re-install&lt;/h2&gt;
&lt;p&gt;Optionally, if you want to grab a list of all packages/apps installed on your current distro to bring over and auto-install on your new one, run the following:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Debian-based distros (e.g. Ubuntu, Kali, etc.):&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;dpkg --get-selections &amp;gt; installed-packages.txt&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;saves a list of all packages to &lt;code&gt;installed-packages.txt&lt;/code&gt;. Save this on an external SSD or transfer to the new machine via the network.
&lt;strong&gt;On the New Machine/Distro:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo apt update&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Navigate to where &lt;code&gt;installed-packages.txt&lt;/code&gt; is stored (on the local machine), and run &lt;code&gt;sudo dpkg --set-selections &amp;lt; installed-packages.txt&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sudo apt-get dselect-upgrade&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The process is similar for distributions using different package managers like &lt;code&gt;yum&lt;/code&gt;, &lt;code&gt;pacman&lt;/code&gt;, or &lt;code&gt;rpm&lt;/code&gt;, the concept is the same but the commands will differ slightly. A little net/manual searching will fix you up :P.&lt;/p&gt;
&lt;h2 id=&#34;--related-helpful-articles&#34;&gt;- Related helpful articles:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://help.ubuntu.com/community/BackupYourSystem/TAR&#34;&gt;https://help.ubuntu.com/community/BackupYourSystem/TAR&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://askubuntu.com/questions/7809/how-to-back-up-my-entire-system&#34;&gt;https://askubuntu.com/questions/7809/how-to-back-up-my-entire-system&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;DISCLAIMER:&lt;/strong&gt; &lt;em&gt;I would consider this a LEGACY POST of mine, written a long time ago. Please excuse any typos, errors or lapses in memory/judgement - as it was added to the site from the archives, just to put everything in one place. Thankq for your understanding 🙇‍♀️&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
</description>
    </item>
    
    <item>
      <title>second post wahoo</title>
      <link>/posts/7/hello-world/</link>
      <pubDate>Tue, 24 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>/posts/7/hello-world/</guid>
      <description>&lt;h3 id=&#34;a-single-breath-echoes-into-the-abyss&#34;&gt;a single breath echoes into the abyss&lt;/h3&gt;
&lt;p&gt;hello, world. it&amp;rsquo;s been a while.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>PACK files in .git - a rabbit hole</title>
      <link>/posts/6/pack-files-git/</link>
      <pubDate>Mon, 23 Dec 2024 00:00:00 +0000</pubDate>
      
      <guid>/posts/6/pack-files-git/</guid>
      <description>&lt;h2 id=&#34;--so-how-did-we-get-here-see_no_evil&#34;&gt;- so, how did we get here? &amp;#x1f648;&lt;/h2&gt;
&lt;hr&gt;
&lt;p&gt;git stores all historical changes to a repo in a PACK file inside the hidden .git folder. This allows restoration of previous repo states in the future.&lt;/p&gt;
&lt;p&gt;However, if you upload files like binaries, photos or videos, this file gets VERY large, even if you delete them in a future commit.&lt;/p&gt;
&lt;h3 id=&#34;--enter-git-filter-repo&#34;&gt;- enter: &lt;code&gt;git-filter-repo&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Luckily a tool exists called git-filter-repo that you can download and use (python script) to analyse your PACK file, and filter out any unwanted bits (e.g. file extensions, paths, etc.). This can dramatically reduce the size of the PACK file.&lt;/p&gt;
&lt;p&gt;It works in a single command (with the option to point the command to a file defining what to keep/exclude, if preferred). Just download the python script, move it to your working directory (MUST have .git folder, as it will analyze this), and run:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;python git-filter-repo.py --analyze&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;(the use of &amp;ldquo;python&amp;rdquo; or similar, and giving the script a .py extension, is necessary sometimes on windows, depending on what shell you&amp;rsquo;re running the above command in, your PATH configuration etc. - but just think of it as running a script file and passing the &amp;ldquo;analyze&amp;rdquo; argument to it)&lt;/p&gt;
&lt;p&gt;It then produces a folder with text files showing files/repo paths (historical) and their relative sizes. From here, you can search through and figure out how to filter what you&amp;rsquo;d like to remove.&lt;/p&gt;
&lt;p&gt;When you&amp;rsquo;ve decided what you&amp;rsquo;re going to remove and how (path/extension/date etc.), I recommend doing a &amp;ndash;dry-run, which will produce two files (the original version and the modified version) and comparing what elements were removed with your filter. For me, using the following command, I went from 6473 lines of committed files to 1428.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;python git-filter-repo.py --path &#39;old-site/audio/&#39; --path &#39;old-site/photos/&#39; --invert-paths --dry-run --force&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;(I used &amp;ndash;force as I had one untracked change - being moving the git-filter-repo script file itself into the directory - that I didn&amp;rsquo;t want to push to git)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;And to make &lt;em&gt;&amp;ldquo;the changes&amp;rdquo;&lt;/em&gt; &lt;em&gt;&lt;strong&gt;[PERMANENTLY!! CAUTION!!!]&lt;/strong&gt;&lt;/em&gt; remove the &lt;code&gt;--dry-run&lt;/code&gt; component of the above command, resulting the following:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;python git-filter-repo.py --path &#39;old-site/audio/&#39; --path &#39;old-site/photos/&#39; --invert-paths&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Run that, and then there you go - it should make the changes to the .git folder in your repo, stripping out the components of the file you filtered and producing a new, (hopefully) smaller &lt;code&gt;PACK&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;Now, it just needs to be pushed to the remote repository with:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;git push --all [remote-repo-URL]&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;--and-then&#34;&gt;- and then&amp;hellip;&lt;/h3&gt;
&lt;p&gt;well, if all things went well, you should have shaved a few KBs/MBs/GBs off your &lt;code&gt;PACK&lt;/code&gt; file - well done! grab yourself a cookie, you&amp;rsquo;ve well and truly earnt it :3&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;./posts/6/saya-banner.jpeg&#34; alt=&#34;saya-congrats&#34;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&#34;--other-helpful-links&#34;&gt;- other helpful links:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.youtube.com/watch?v=eoF2p3ZDiAc&#34;&gt;https://www.youtube.com/watch?v=eoF2p3ZDiAc&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html#EXAMPLES&#34;&gt;https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html#EXAMPLES&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
  </channel>
</rss>
