<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.3.4">Jekyll</generator><link href="https://www.cremarenco.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://www.cremarenco.com/" rel="alternate" type="text/html" /><updated>2025-12-26T14:13:32+01:00</updated><id>https://www.cremarenco.com/feed.xml</id><title type="html">My Homepage</title><subtitle>Welcome to Cosmin Cremarenco&apos;s homepage</subtitle><entry><title type="html">UTM networking on MacOS</title><link href="https://www.cremarenco.com/2025/12/26/macos-packet-forwarding.html" rel="alternate" type="text/html" title="UTM networking on MacOS" /><published>2025-12-26T00:00:00+01:00</published><updated>2025-12-26T00:00:00+01:00</updated><id>https://www.cremarenco.com/2025/12/26/macos-packet-forwarding</id><content type="html" xml:base="https://www.cremarenco.com/2025/12/26/macos-packet-forwarding.html"><![CDATA[<p>If you’re running Sequoia with UTM VMs networking might not work all of a sudden.</p>

<p>The problem is that, for some reason, the new release of MacOs has reset settings of the packet
filtering.</p>

<p>Check if it has the correct value (should be 1):</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Check if packet forwarding is enabled
sysctl net.inet.ip.forwarding
</code></pre></div></div>

<p>Otherwise set it correctl:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo sysctl -w net.inet.ip.forwarding=1
</code></pre></div></div>]]></content><author><name></name></author><summary type="html"><![CDATA[If you’re running Sequoia with UTM VMs networking might not work all of a sudden.]]></summary></entry><entry><title type="html">Properly forward signals to Docker container process and ENV vars</title><link href="https://www.cremarenco.com/2024/01/18/init2.html" rel="alternate" type="text/html" title="Properly forward signals to Docker container process and ENV vars" /><published>2024-01-18T00:00:00+01:00</published><updated>2024-01-18T00:00:00+01:00</updated><id>https://www.cremarenco.com/2024/01/18/init2</id><content type="html" xml:base="https://www.cremarenco.com/2024/01/18/init2.html"><![CDATA[<h1 id="problem">Problem</h1>

<p>Correctly handling certain use cases requires that containers running under Docker properly receive and handle sent signals. It comes to mind graceful process termination when systemd will send a SIGTERM to the process giving it a chance to cleanly stop before it’s being sent a SIGKILL that results in immediate process stop. Handling signals in this case is quite simple and well-documented, either using the newer <code class="language-plaintext highlighter-rouge">sigaction</code> function or the older <code class="language-plaintext highlighter-rouge">signal</code>. However, if the process ran by systemd is in fact a Docker container then things are not so simple.</p>

<p>The Docker daemon will forward signals to the process running inside the container with PID=1. When running outside a container, that’s usually process <em>init</em>, the root of all the process hierarchy. <em>Inside</em> a container, however, the process, may or may not be the root process (thus having PID = 1).</p>

<p>Example: Dockerfile using the shell form for CMD or ENTRYPOINT:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>CMD “echo ‘hello world’”
ENTRYPOINT “echo ‘hello world’”
</code></pre></div></div>

<p>These will result in an execution under the shell:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/usr/bin/bash -c “echo ‘hello world’”
</code></pre></div></div>

<p>What this means is that the shell process (<em>bash</em> here) will have PID=1, therefore it is the shell that will get signals sent by Docker. The “echo” process running above will not receive those signals.</p>

<h1 id="exec-form">exec form</h1>

<p>What is recommended in this case is running the <em>exec</em> form for CMD or ENTRYPOINT where the arguments are inside a JSON array, as below:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>CMD [“echo”, “hello world’]
ENTRYPOINT [“echo”, “hello world”]
</code></pre></div></div>
<p>Now the <em>echo</em>  process will have PID=1 and will properly receive all the signals. 
This works very well. 
Unless, the shell is needed.</p>

<h1 id="environment-variable-substitution">Environment variable substitution</h1>

<p>Environment ariable substitution for environment variables declared as <em>ENV</em> in the Dockerfile does not work with exec form. 
A shell would be needed in order to perform that substitution.</p>

<p>What’s needed is a custom process that properly forwards signals to children processes, but that also properly does variable substitutions and passes expanded environment variables to launched children processes.</p>

<p>Check the <a href="https://github.com/ccosmin/init2">init2</a> for a possible solution.</p>

<p><img src="https://www.visitorstatus.com/b/ev?depl=1&amp;post=2024-01-18-init2.md" alt="" /></p>]]></content><author><name></name></author><summary type="html"><![CDATA[Problem Correctly handling certain use cases requires that containers running under Docker properly receive and handle sent signals. It comes to mind graceful process termination when systemd will send a SIGTERM to the process giving it a chance to cleanly stop before it’s being sent a SIGKILL that results in immediate process stop. Handling signals in this case is quite simple and well-documented, either using the newer sigaction function or the older signal. However, if the process ran by systemd is in fact a Docker container then things are not so simple. The Docker daemon will forward signals to the process running inside the container with PID=1. When running outside a container, that’s usually process init, the root of all the process hierarchy. Inside a container, however, the process, may or may not be the root process (thus having PID = 1). Example: Dockerfile using the shell form for CMD or ENTRYPOINT: CMD “echo ‘hello world’” ENTRYPOINT “echo ‘hello world’” These will result in an execution under the shell: /usr/bin/bash -c “echo ‘hello world’” What this means is that the shell process (bash here) will have PID=1, therefore it is the shell that will get signals sent by Docker. The “echo” process running above will not receive those signals. exec form What is recommended in this case is running the exec form for CMD or ENTRYPOINT where the arguments are inside a JSON array, as below: CMD [“echo”, “hello world’] ENTRYPOINT [“echo”, “hello world”] Now the echo process will have PID=1 and will properly receive all the signals. This works very well. Unless, the shell is needed. Environment variable substitution Environment ariable substitution for environment variables declared as ENV in the Dockerfile does not work with exec form. A shell would be needed in order to perform that substitution. What’s needed is a custom process that properly forwards signals to children processes, but that also properly does variable substitutions and passes expanded environment variables to launched children processes. Check the init2 for a possible solution.]]></summary></entry><entry><title type="html">How to disable the merge button in a GitLab merge request</title><link href="https://www.cremarenco.com/2023/10/06/forbid-merging-in-gitlab.html" rel="alternate" type="text/html" title="How to disable the merge button in a GitLab merge request" /><published>2023-10-06T00:00:00+02:00</published><updated>2023-10-06T00:00:00+02:00</updated><id>https://www.cremarenco.com/2023/10/06/forbid-merging-in-gitlab</id><content type="html" xml:base="https://www.cremarenco.com/2023/10/06/forbid-merging-in-gitlab.html"><![CDATA[<h1 id="problem">Problem</h1>

<p>There are times when it’s interesting to disable the possibility to merge
a merge request. The merge request might be in a mirrored repository, or you might
just prefer manually merging branches.</p>

<h1 id="solution">Solution</h1>

<p>The “Merge” button behaviour (enabled/disabled) is driven by the method <code class="language-plaintext highlighter-rouge">isMergeButtonDisabled</code>
which returns a boolean indicating whether the merge button should be disabled or not.</p>

<p>The cleanest way to modify this behaviour is to tinker with the Vue files that Gitlab comes with.
However, since these components are not served directly (they are compiled and bundled using
webpack) this means that compilation is needed, which might be a hassle.</p>

<p>The other way is to modify the webpack bundle directly.
The instructions below are for a self-hosted Gitlab instance, Debian install, version 15.8.
But they probably apply with minimal modifications to Omnibus as well.</p>

<p>Warning: At this point I’m assuming you know what you’re doing, or otherwise you risk crippling your
Gitlab installation.</p>

<p>Your mileage may vary but my bundle is stored in <code class="language-plaintext highlighter-rouge">/var/lib/gitlab/public/assets/webpack</code>
(this is a Debian distrib Gitlab).
Go into this directory and do:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>grep isMergeButtonDisabled * | cut -f1 -d:
</code></pre></div></div>
<p>A match should be in a file called <code class="language-plaintext highlighter-rouge">pages.projects.merge_requests.show.*.chunk.js</code>.
Edit this file (make sure to do a backup first), 
search for <code class="language-plaintext highlighter-rouge">isMergeButtonDisabled</code>. Change the function to read instead of:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>isMergeButtonDisabled(){const{commitMessage....
</code></pre></div></div>
<p>to:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>isMergeButtonDisabled(){return true;const{commitMessage....
</code></pre></div></div>

<p>Don’t forget to remove the <code class="language-plaintext highlighter-rouge">pages.projects.merge_requests.show.*.chunk.js.gz</code> as
otherwise that one will be served instead of the modified version.
Alternatively you can also use <code class="language-plaintext highlighter-rouge">gzip</code> in order to replace the existing archive.</p>

<p>Need help with setting up Gitlab?
Contact us at <a href="https://www.snowlinesoftware.com/contact.php">www.snowlinesoftware.com</a> for help.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[Problem There are times when it’s interesting to disable the possibility to merge a merge request. The merge request might be in a mirrored repository, or you might just prefer manually merging branches. Solution The “Merge” button behaviour (enabled/disabled) is driven by the method isMergeButtonDisabled which returns a boolean indicating whether the merge button should be disabled or not. The cleanest way to modify this behaviour is to tinker with the Vue files that Gitlab comes with. However, since these components are not served directly (they are compiled and bundled using webpack) this means that compilation is needed, which might be a hassle. The other way is to modify the webpack bundle directly. The instructions below are for a self-hosted Gitlab instance, Debian install, version 15.8. But they probably apply with minimal modifications to Omnibus as well. Warning: At this point I’m assuming you know what you’re doing, or otherwise you risk crippling your Gitlab installation. Your mileage may vary but my bundle is stored in /var/lib/gitlab/public/assets/webpack (this is a Debian distrib Gitlab). Go into this directory and do: grep isMergeButtonDisabled * | cut -f1 -d: A match should be in a file called pages.projects.merge_requests.show.*.chunk.js. Edit this file (make sure to do a backup first), search for isMergeButtonDisabled. Change the function to read instead of: isMergeButtonDisabled(){const{commitMessage.... to: isMergeButtonDisabled(){return true;const{commitMessage.... Don’t forget to remove the pages.projects.merge_requests.show.*.chunk.js.gz as otherwise that one will be served instead of the modified version. Alternatively you can also use gzip in order to replace the existing archive. Need help with setting up Gitlab? Contact us at www.snowlinesoftware.com for help.]]></summary></entry><entry><title type="html">Welcome to my blog!</title><link href="https://www.cremarenco.com/life/2023/09/15/first-post.html" rel="alternate" type="text/html" title="Welcome to my blog!" /><published>2023-09-15T15:45:23+02:00</published><updated>2023-09-15T15:45:23+02:00</updated><id>https://www.cremarenco.com/life/2023/09/15/first-post</id><content type="html" xml:base="https://www.cremarenco.com/life/2023/09/15/first-post.html"><![CDATA[<p>I’m moving from WordPress to Jekyll, expect to see more posts here soon.</p>]]></content><author><name></name></author><category term="life" /><summary type="html"><![CDATA[I’m moving from WordPress to Jekyll, expect to see more posts here soon.]]></summary></entry></feed>