<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>dbalan&#39;s journal</title>
    <link>https://pencil.lalalala.in/dbalan/</link>
    <description>Mostly notes in administration</description>
    <pubDate>Sat, 18 Apr 2026 03:51:31 +0530</pubDate>
    <item>
      <title>Easy NixOS remote deployments</title>
      <link>https://pencil.lalalala.in/dbalan/easy-nixos-remote-deployments</link>
      <description>&lt;![CDATA[NixOS and Nix are revolutionizing linux distro space: providing a single programing environment that controls everything from building your kernel, ensuring your containers run to getting SSL cert from letsencrypt (it comes batteries included, you don&#39;t have to build the kernel if you don&#39;t want to).&#xA;&#xA;There exists a mutitude of tooling to remotely manage nixos machines, each with its own features and compromises. However you can also just use a simple flake with nixos-rebuild --target-host. &#xA;&#xA;This is the workflow I&#39;ve been using to manage my systems.&#xA;&#xA;I bootstrap the machines manually by following the nixos install guide, and copy over the generated configuration to config/hostname/configuration.nix.&#xA;&#xA;On the root directory create flake.nix:&#xA;&#xA;{&#xA;  description = &#34;systems needed&#34;;&#xA;  inputs = {&#xA;     # extra inputs go here&#xA;  };&#xA;&#xA;  outputs = { self, nixpkgs }@attrs: {&#xA;    # this is where we add new machines&#xA;    nixosConfigurations = {&#xA;     # host nixmachine&#xA;      nixmachine = nixpkgs.lib.nixosSystem {&#xA;        system = &#34;x86_64-linux&#34;;&#xA;        specialArgs = attrs;&#xA;        modules = [&#xA;          # This points to the actual machine configuration&#xA;          (import ./config/nixmachine/configuration.nix)&#xA;        ];&#xA;      };&#xA;    };&#xA;  };&#xA;}&#xA;&#xA;This can be deployed by&#xA;&#xA;nixos-rebuild switch  --target-host root@hostname --flake &#39;.#nixmachine&#39;&#xA;&#xA;A new host can be added by adding a new entry inside nixosConfigurations.&#xA;&#xA;Should I do this?&#xA;&#xA;I think this is an easier workflow for me to manage and debug, However a lot of things in this space has non-linear learning curves and has sparse documentation at best. &#xA;&#xA;So maybe a tool with better documentation might work well for you?&#xA;&#xA;This also relies heavily on flakes, which is &#34;experimental&#34;. In my experience, this translate to everyone uses flakes, but good documenation is hard to come by (I&#39;ve herd good things about https://nixos-and-flakes.thiscute.world/, but haven&#39;t read it)&#xA;&#xA;Comments?&#xA;&#xA;Hit me up @nomycommit]]&gt;</description>
      <content:encoded><![CDATA[<p><a href="https://nixos.org/" rel="nofollow">NixOS</a> and Nix are revolutionizing linux distro space: providing a single programing environment that controls everything from building your kernel, ensuring your containers run to getting SSL cert from letsencrypt (it comes batteries included, you don&#39;t have to build the kernel if you don&#39;t want to).</p>

<p>There exists a <a href="https://github.com/NixOS/nixops" rel="nofollow">mutitude</a> <a href="https://github.com/DBCDK/morph" rel="nofollow">of</a> <a href="https://github.com/krebs/krops" rel="nofollow">tooling</a> to remotely manage nixos machines, each with its own features and compromises. However you can also just use a simple flake with <code>nixos-rebuild --target-host</code>.</p>

<p>This is the workflow I&#39;ve been using to manage my systems.</p>

<p>I bootstrap the machines manually by following the <a href="https://nixos.org/manual/nixos/stable/#sec-installation" rel="nofollow">nixos install guide</a>, and copy over the generated configuration to <code>config/&lt;hostname&gt;/configuration.nix</code>.</p>

<p>On the root directory create <code>flake.nix</code>:</p>

<pre><code class="language-nix">{
  description = &#34;systems needed&#34;;
  inputs = {
     # extra inputs go here
  };

  outputs = { self, nixpkgs }@attrs: {
    # this is where we add new machines
    nixosConfigurations = {
     # host nixmachine
      nixmachine = nixpkgs.lib.nixosSystem {
        system = &#34;x86_64-linux&#34;;
        specialArgs = attrs;
        modules = [
          # This points to the actual machine configuration
          (import ./config/nixmachine/configuration.nix)
        ];
      };
    };
  };
}
</code></pre>

<p>This can be deployed by</p>

<pre><code>nixos-rebuild switch  --target-host root@&lt;hostname&gt; --flake &#39;.#nixmachine&#39;
</code></pre>

<p>A new host can be added by adding a new entry inside <code>nixosConfigurations</code>.</p>

<h2 id="should-i-do-this">Should I do this?</h2>

<p>I think this is an easier workflow for me to manage and debug, However a lot of things in this space has non-linear learning curves and has sparse documentation at best.</p>

<p>So maybe a tool with better documentation might work well for you?</p>

<p>This also relies heavily on <code>flakes</code>, which is “experimental”. In my experience, this translate to everyone uses flakes, but good documenation is hard to come by (I&#39;ve herd good things about <a href="https://nixos-and-flakes.thiscute.world/" rel="nofollow">https://nixos-and-flakes.thiscute.world/</a>, but haven&#39;t read it)</p>

<h2 id="comments">Comments?</h2>

<p>Hit me up <a href="https://notwork.in/@notmycommit" rel="nofollow">@nomycommit</a></p>
]]></content:encoded>
      <guid>https://pencil.lalalala.in/dbalan/easy-nixos-remote-deployments</guid>
      <pubDate>Tue, 14 Nov 2023 14:25:10 +0000</pubDate>
    </item>
    <item>
      <title>FreeBSD on mastodon part 2</title>
      <link>https://pencil.lalalala.in/dbalan/freebsd-on-mastodon-part-2</link>
      <description>&lt;![CDATA[While FreeBSD mastodon package was great, it also broke our server! &#xA;&#xA;When we ran pkg upgrade, the ruby version got bumped. But mastodon needs a specific ruby version to run, and there goes the server.&#xA;&#xA;Thankfully it was easy to restore.&#xA;&#xA;Nuke the pkg and grab the code from git&#xA;&#xA;Install the correct ruby version with rbenv&#xA;rbenv install 3.0.6&#xA;setup mastodon again (better check the project readme) with bunch of bundle exec incantations.&#xA;&#xA;The side effect of loosing packages was that we also don&#39;t have service files anymore. While there were plenty of examples and help, we eventually ran it with supervisor with config, which is far simpler than service files IMO.&#xA;&#xA;   mastodon-web&#xA;&#xA;[program:mastodonweb]&#xA;command=/usr/local/www/mastodon/.rbenv/shims/bundle exec puma -C config/puma.rb ; the program (relative uses PATH, can take args)&#xA;directory=/usr/local/www/mastodon/live                ; directory to cwd to before exec (def no cwd)&#xA;autostart=true                ; start at supervisord start (default: true)&#xA;autorestart=true              ; retstart at unexpected quit (default: true)&#xA;startsecs=10                  ; number of secs prog must stay running (def. 1)&#xA;startretries=3                ; max # of serial start failures (default 3)&#xA;user=mastodon                   ; setuid to this UNIX account to run the program&#xA;redirectstderr=true          ; redirect proc stderr to stdout (default false)&#xA;stdoutlogfile=/var/log/mastodon/web.log        ; stdout log path, NONE for none; default AUTO&#xA;environment=RAILSENV=production,PATH=/usr/local/www/mastodon/.rbenv/shims:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin&#xA;&#xA;  sidekiq&#xA;&#xA;[program:mastodonsidekiq]&#xA;command=/usr/local/www/mastodon/.rbenv/shims/bundle exec sidekiq -c 25 ; the program (relative uses PATH, can take args)&#xA;directory=/usr/local/www/mastodon/live                ; directory to cwd to before exec (def no cwd)&#xA;autostart=true                ; start at supervisord start (default: true)&#xA;autorestart=true              ; retstart at unexpected quit (default: true)&#xA;startsecs=10                  ; number of secs prog must stay running (def. 1)&#xA;startretries=3                ; max # of serial start failures (default 3)&#xA;user=mastodon                   ; setuid to this UNIX account to run the program&#xA;redirectstderr=true          ; redirect proc stderr to stdout (default false)&#xA;stdoutlogfile=/var/log/mastodon/sidekiq.log        ; stdout log path, NONE for none; default AUTO&#xA;environment=RAILSENV=production,PATH=/usr/local/www/mastodon/.rbenv/shims:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin&#xA;&#xA;  mastodon streaming&#xA;&#xA;[program:mastodonstreaming]&#xA;command=/usr/local/bin/node ./streaming ; the program (relative uses PATH, can take args)&#xA;directory=/usr/local/www/mastodon/live                ; directory to cwd to before exec (def no cwd)&#xA;autostart=true                ; start at supervisord start (default: true)&#xA;autorestart=true              ; retstart at unexpected quit (default: true)&#xA;startsecs=10                  ; number of secs prog must stay running (def. 1)&#xA;startretries=3                ; max # of serial start failures (default 3)&#xA;user=mastodon                   ; setuid to this UNIX account to run the program&#xA;redirectstderr=true          ; redirect proc stderr to stdout (default false)&#xA;stdoutlogfile=/var/log/mastodon/streaming.log        ; stdout log path, NONE for none; default AUTO&#xA;environment=NODEENV=production,PATH=/usr/local/www/mastodon/.rbenv/shims:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin&#xA;&#xA;Its all very janky and defintily a hotfix but it works for now. Maybe one of these days we will migrate to nomad.&#xA;&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>While FreeBSD mastodon package was great, it also broke our server!</p>

<p>When we ran pkg upgrade, the ruby version got bumped. But mastodon needs a specific ruby version to run, and there goes the server.</p>

<p>Thankfully it was easy to restore.</p>
<ol><li><p>Nuke the pkg and grab the code from git</p></li>

<li><p>Install the correct ruby version with <a href="https://github.com/rbenv/rbenv" rel="nofollow">rbenv</a></p>

<pre><code>rbenv install 3.0.6
</code></pre></li>

<li><p>setup mastodon again (better check the project readme) with bunch of <code>bundle exec</code> incantations.</p></li>

<li><p>The side effect of loosing packages was that we also don&#39;t have service files anymore. While there were <a class="u-url mention">@<span>c@bow.st</span></a>/110429847337542590&#34;&gt;plenty of examples and help</a>, we eventually ran it with <a href="http://supervisord.org/" rel="nofollow">supervisor</a> with config, which is far simpler than service files IMO.</p>
<ul><li><strong>mastodon-web</strong></li></ul></li></ol>

<pre><code>[program:mastodon_web]
command=/usr/local/www/mastodon/.rbenv/shims/bundle exec puma -C config/puma.rb ; the program (relative uses PATH, can take args)
directory=/usr/local/www/mastodon/live                ; directory to cwd to before exec (def no cwd)
autostart=true                ; start at supervisord start (default: true)
autorestart=true              ; retstart at unexpected quit (default: true)
startsecs=10                  ; number of secs prog must stay running (def. 1)
startretries=3                ; max # of serial start failures (default 3)
user=mastodon                   ; setuid to this UNIX account to run the program
redirect_stderr=true          ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/mastodon/web.log        ; stdout log path, NONE for none; default AUTO
environment=RAILS_ENV=production,PATH=/usr/local/www/mastodon/.rbenv/shims:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
</code></pre>
<ul><li><strong>sidekiq</strong></li></ul>

<pre><code>[program:mastodon_sidekiq]
command=/usr/local/www/mastodon/.rbenv/shims/bundle exec sidekiq -c 25 ; the program (relative uses PATH, can take args)
directory=/usr/local/www/mastodon/live                ; directory to cwd to before exec (def no cwd)
autostart=true                ; start at supervisord start (default: true)
autorestart=true              ; retstart at unexpected quit (default: true)
startsecs=10                  ; number of secs prog must stay running (def. 1)
startretries=3                ; max # of serial start failures (default 3)
user=mastodon                   ; setuid to this UNIX account to run the program
redirect_stderr=true          ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/mastodon/sidekiq.log        ; stdout log path, NONE for none; default AUTO
environment=RAILS_ENV=production,PATH=/usr/local/www/mastodon/.rbenv/shims:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
</code></pre>
<ul><li><strong>mastodon streaming</strong></li></ul>

<pre><code>[program:mastodon_streaming]
command=/usr/local/bin/node ./streaming ; the program (relative uses PATH, can take args)
directory=/usr/local/www/mastodon/live                ; directory to cwd to before exec (def no cwd)
autostart=true                ; start at supervisord start (default: true)
autorestart=true              ; retstart at unexpected quit (default: true)
startsecs=10                  ; number of secs prog must stay running (def. 1)
startretries=3                ; max # of serial start failures (default 3)
user=mastodon                   ; setuid to this UNIX account to run the program
redirect_stderr=true          ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/mastodon/streaming.log        ; stdout log path, NONE for none; default AUTO
environment=NODE_ENV=production,PATH=/usr/local/www/mastodon/.rbenv/shims:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
</code></pre>

<p>Its all very janky and defintily a hotfix but it works for now. Maybe one of these days we will migrate to <a href="https://www.nomadproject.io/" rel="nofollow">nomad</a>.</p>
]]></content:encoded>
      <guid>https://pencil.lalalala.in/dbalan/freebsd-on-mastodon-part-2</guid>
      <pubDate>Sat, 01 Jul 2023 20:45:18 +0000</pubDate>
    </item>
    <item>
      <title>Installing mastodon on FreeBSD</title>
      <link>https://pencil.lalalala.in/dbalan/installing-mastodon-on-freebsd</link>
      <description>&lt;![CDATA[There seem to be a FreeBSD port which is well documented.&#xA;&#xA;Happy to report it works, and we have notwork.in&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>There seem to be a <a href="https://wiki.freebsd.org/Ports/net-im/mastodon" rel="nofollow">FreeBSD port</a> which is well documented.</p>

<p>Happy to report it works, and we have <a href="https://notwork.in" rel="nofollow">notwork.in</a></p>
]]></content:encoded>
      <guid>https://pencil.lalalala.in/dbalan/installing-mastodon-on-freebsd</guid>
      <pubDate>Sun, 22 Jan 2023 15:30:02 +0000</pubDate>
    </item>
  </channel>
</rss>