<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Nick Barrett - Medium]]></title>
        <description><![CDATA[Exploring the software development landscape - Medium]]></description>
        <link>https://medium.com/my-dev-journey?source=rss----4642e3f29f1e---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Nick Barrett - Medium</title>
            <link>https://medium.com/my-dev-journey?source=rss----4642e3f29f1e---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 21:44:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/my-dev-journey" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Writing Firebird UDRs in Pascal]]></title>
            <link>https://medium.com/my-dev-journey/writing-firebird-udrs-in-pascal-de2983f62a14?source=rss----4642e3f29f1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/de2983f62a14</guid>
            <category><![CDATA[free-pascal]]></category>
            <category><![CDATA[firebird]]></category>
            <category><![CDATA[udr]]></category>
            <dc:creator><![CDATA[Nicholas Barrett]]></dc:creator>
            <pubDate>Mon, 27 Jan 2025 21:11:14 GMT</pubDate>
            <atom:updated>2025-01-27T21:11:14.022Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*GqH3q_16-WoiFpL_zjVwsg.png" /></figure><p>This is a small addition to the <a href="https://www.firebirdsql.org/file/documentation/html/en/firebirddocs/udr-pascal/udr-pascal.html">Firebird docs</a> for future reference (at least for me 😅). We wrote our UDR using <a href="https://www.freepascal.org/">Free Pascal</a>. It was a port of an old UD<strong>F</strong> (written in <a href="https://www.embarcadero.com/products/delphi">Delphi</a>) for <a href="https://www.embarcadero.com/products/interbase">InterBase</a>.</p><h3>Project file for Linux</h3><p>In <a href="https://www.firebirdsql.org/file/documentation/html/en/firebirddocs/udr-pascal/udr-pascal.html#udr-framework">section 4</a> of the Firebird docs it says to have the following code in the project file</p><pre>...<br>uses<br>{$IFDEF unix}<br>    cthreads,<br>    // the c memory manager is on some systems much faster for multi-threading<br>    cmem,<br>{$ENDIF}<br>...</pre><p>If you read my last post, this is what the problem came down to. In searching for a solution I came across a GitHub repo where the author didn’t have references to these two units. I tried it, and all my problems went away.</p><p>I have no idea why!!! My best theory is that my UDR code does not deal with threads at all. All my functions are pure functions, in the sense that the output is calculated based on the input and that’s it. Nothing fancy 👍 As we’re not managing threads at all, it appears the inclusion of cthreads was not necessary and actually made Firebird blow up while trying to free the UDR.</p><h3>Build parameters</h3><p>I didn’t find any references on how to do this on the Internet. Probably because it’s fairly straight forward 😅</p><p>Still I’ll write a bit here for future reference. You can find a full list of all the parameters for fpc <a href="https://www.freepascal.org/docs-html/current/user/userap1.html">here</a>.</p><p>For debug builds I used fpc PROJECT.lpr -O- -g</p><p>-O- Disable optimizations</p><p>-g Generate debug information</p><p>For release builds I used fpc PROJECT.lpr -O3</p><p>-O3 Level 3 optimizations</p><h3>Building for Linux in a container</h3><p>This was by far the easiest way for us. Here’s a look at the Dockerfile</p><pre>FROM freepascal/fpc:3.2.2-noble-full AS build<br>RUN mkdir -p /src/bin<br>RUN mkdir -p /src/lib<br>WORKDIR /src<br>COPY . .<br>RUN fpc PROJECT.lpr -obin/ -FUlib -O3<br><br>FROM scratch<br>COPY --from=build /src/bin/ /</pre><p>-obin/ put the resulting .so file in /src/bin</p><p>-FUlib puts all the built units into /src/lib</p><p>This results in a container image that just contains the UDR.</p><p>The Dockerfile to create a Firebird container that has the UDR in the right place is as follows:</p><pre>FROM UDR-IMAGE:latest AS udr<br>FROM FIREBIRD-IMAGE:latest<br>COPY --from=udr / /opt/firebird/plugins/udr/</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de2983f62a14" width="1" height="1" alt=""><hr><p><a href="https://medium.com/my-dev-journey/writing-firebird-udrs-in-pascal-de2983f62a14">Writing Firebird UDRs in Pascal</a> was originally published in <a href="https://medium.com/my-dev-journey">Nick Barrett</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to get core dumps in an Ubuntu based container]]></title>
            <link>https://medium.com/my-dev-journey/how-to-get-core-dumps-in-an-ubuntu-based-container-62270a1dd6b5?source=rss----4642e3f29f1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/62270a1dd6b5</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[core-dump]]></category>
            <category><![CDATA[firebird]]></category>
            <dc:creator><![CDATA[Nicholas Barrett]]></dc:creator>
            <pubDate>Mon, 27 Jan 2025 17:23:52 GMT</pubDate>
            <atom:updated>2025-01-27T23:22:10.502Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Firebird logo" src="https://cdn-images-1.medium.com/max/649/1*b3IWN5nK4Iql9FM41Lup5Q.png" /></figure><p>The backstory to this one is relatively simple. The Firebird v5 container I had created in a <a href="https://nick.barrett.org.nz/making-a-firebird-v5-container-image-bff61472d42b">previous post</a> was crashing and all I got in /opt/firebird/firebird.log was:</p><pre>/opt/firebird/bin/fbguard: /opt/firebird/bin/firebird terminated abnormally (-1)</pre><p>While not untrue, it’s not really that helpful either. I needed to get a core dump so I could get more information on what was going on.</p><p>There are a few parts to this. To be honest, I’m not 100% sure everything here is required, but I do know that it works.</p><h3>Enabling core dumps in Firebird</h3><p>This is a config change in /opt/firebird/firebird.conf. Just ensure you have the following line (around about line 712).</p><pre># ----------------------------<br># This option controls whether to call abort() when an internal error or BUGCHECK<br># is encountered, thus invoking the post-mortem debugger which can dump core<br># suitable for off-line analysis. When disabled, the engine tries to minimize damage<br># and continue execution.<br>#<br># Setting this option to 1 makes the engine produce traceable coredumps when<br># something nasty like SIGSEGV happens inside UDF. On Windows, enabling this option<br># makes the engine invoke the JIT debugger facilities when errors happen.<br>#<br># For debugging builds (DEV_BUILD), default value is 1 (Enabled)<br>#<br># Type: boolean<br>#<br>BugcheckAbort = 1</pre><h3>Create a debug version of the container</h3><p>This is what my Dockerfile looks like.</p><pre>FROM ubuntu:24.04 AS base<br><br># Get Firebird v5 Debug Symbols<br>FROM base AS debug_symbols<br><br>ADD https://github.com/FirebirdSQL/firebird/releases/download/v5.0.1/Firebird-5.0.1.1469-0-linux-x64-debugSymbols.tar.gz debugSymbols.tar.gz<br>RUN tar -xvf debugSymbols.tar.gz -C /<br><br># Install Firebird v5<br>FROM base AS firebird<br><br>ADD https://raw.githubusercontent.com/IBSurgeon/firebirdlinuxinstall/main/ubuntu24/fb_vanilla_ub24-50.sh ./fb_vanilla_ub24-50.sh<br><br>RUN chmod +x ./fb_vanilla_ub24-50.sh &amp;&amp; \<br>    ./fb_vanilla_ub24-50.sh &amp;&amp; \<br>    rm -f ./fb_vanilla_ub24-50.sh<br><br>RUN rm /etc/init.d/firebird<br><br>RUN apt-get update -y<br>RUN apt autoremove -y<br><br># Make the final image.<br>FROM firebird<br><br>COPY --from=debug_symbols /opt/firebird /opt/firebird<br><br>COPY firebird.conf /opt/firebird/firebird.conf<br><br>VOLUME [&quot;/databases&quot;]<br><br>EXPOSE 3050/tcp<br>EXPOSE 3052/tcp<br><br>ENTRYPOINT [&quot;/opt/firebird/bin/fbguard&quot;]</pre><p>Notice we’re not “chiselling” this version.</p><p>The main parts roughly are</p><ol><li>Install Firebird</li><li>Update using apt-get (not 100% sure on this one)</li><li>Add the debug symbols</li><li>Add the updated firebird.conf</li></ol><h3>Run the container</h3><p>There’s a couple of change required to you docker run command to run the container so that you can get core dumps</p><ol><li>--ulimit core=-1 This is the equivalent of running ulimit -c unlimited in the container (which you can’t really do).</li><li>Thanks to this <a href="https://stackoverflow.com/a/69832851/116266">SO</a> answer I added these two --security-opt seccomp=unconfined and --privileged.</li><li>Lastly, I found it usefull to have access to the container’s /tmp for access to the core dump files from my host machine. To do this I added --mount type=bind,source=C:\docker_tmp\,target=/tmp/. You don’t need this one, so only add if it helps you.</li></ol><p>So all up, my docker run command looks like this</p><pre>docker run -d -it --security-opt seccomp=unconfined --privileged --ulimit core=-1 --mount type=bind,source=C:\docker_tmp\,target=/tmp/ -v C:\docker_databases:/databases -p 3050:3050 -p 3052:3052 --env TZ=Pacific/Auckland --name firebird:debug</pre><p>I found a good little test to ensure core dumps are working from this <a href="https://stackoverflow.com/a/59611557/116266">SO</a> post</p><pre>yes &gt; /dev/null &amp;<br>top #Get the PID of yes. It should be easy to find =)<br>kill -6 PID_OF_YES<br>ls /tmp</pre><p>There should be a file called something like core-yes.24.5a9a124e4150.1738020018</p><h3>Running GDB on a core dump</h3><p>If everything has worked properly, when Firebird crashes, you should get a core dump in /tmp. Then, in Exec in Docker Desktop, you can use GDB to get some more info on what is causing you crash.</p><pre>cd /tmp<br>sudo gdb /opt/firebird/bin/firebird core-firebird.....</pre><p>Inside GDB you can use the bt command to see the stack trace of the code that caused the crash. You can use thr apply all bt full to get a veeeeery long trace of all running threads. This is what helped find my issue.</p><h3>So what was causing the crashes???</h3><p>For us, it turns out it was a UDR that we had written in Free Pascal that was the problem. The functions would run fine, but as soon as Firebird tried to close down a thread (due to a shutdown or a connection closing) it would crash.</p><h3>Credit where credit is due</h3><p>A <strong>huge thank you</strong> to the good folks in the <a href="https://github.com/FirebirdSQL/firebird">Firebird GitHub repo</a> for their help and guidance. Here’s a <a href="https://github.com/FirebirdSQL/firebird/discussions/8398">link</a> to the GitHub discussion. Please note there’s stuff I tried in there that didn’t end up helping. I’ve tried to condense what’s required in this post, but there may be things in there that could help you. Good luck 👍</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62270a1dd6b5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/my-dev-journey/how-to-get-core-dumps-in-an-ubuntu-based-container-62270a1dd6b5">How to get core dumps in an Ubuntu based container</a> was originally published in <a href="https://medium.com/my-dev-journey">Nick Barrett</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Home Assistant & Connected Switches from Schneider Electric]]></title>
            <link>https://medium.com/my-dev-journey/home-assistant-connected-switches-from-schneider-electric-eebdab3696ad?source=rss----4642e3f29f1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/eebdab3696ad</guid>
            <category><![CDATA[zigbee]]></category>
            <category><![CDATA[home-assistant]]></category>
            <category><![CDATA[schneider-electric]]></category>
            <category><![CDATA[pdl]]></category>
            <category><![CDATA[wiser]]></category>
            <dc:creator><![CDATA[Nicholas Barrett]]></dc:creator>
            <pubDate>Wed, 15 Jan 2025 21:10:20 GMT</pubDate>
            <atom:updated>2026-06-25T20:13:53.410Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1UlZy6r4d9m2o9-CE86New.png" /></figure><h3>Why Connected Switches from Schneider Electric</h3><p>It was important to me (and my electrician) that we went with switches from a supplier that was well established here in New Zealand. Plus, if there’s something wrong with our network/Internet connection, everything should still work. All these switches work fine as normal house switches even when Home Assistant is offline (just none of the automations ofcourse).</p><h3>Brand names</h3><p>These switches seem to go by a few company/brand names, so I’ll list a few here that I’ve seen here in NZ and on the Internet:</p><ul><li>Schneider Electric</li><li>Clipsal</li><li>PDL Iconic</li><li>PDL Wiser</li></ul><h3>The Iconic Wiser Connected Smart Switches</h3><p>There are two main switches (2 amp and 10 amp) with two variations of each (BlueTooth and Zigbee)</p><ul><li>BLE Default 2AX 240V (<a href="https://www.pdl.co.nz/products/smart-home/pdl-wiser/wiser-connected-smart-switch-ble-default-2ax-240v-300-series-pdl356pb2mbtw?itemno=PDL356PB2MBTW-VW">PDL356PB2MBTW</a>)</li><li>Zigbee Default 2AX 240V (<a href="https://www.pdl.co.nz/products/smart-home/pdl-wiser/wiser-connected-smart-switch-zigbee-default-2ax-240v-300-series-pdl356pb2mbtz?itemno=PDL356PB2MBTZ-VW">PDL356PB2MBTZ</a>)</li><li>BLE Default 10AX/15A 240V (<a href="https://www.pdl.co.nz/products/smart-home/pdl-wiser/wiser-connected-smart-switch-ble-default-10ax-15a-240v-300-series-pdl356pb10mbtw?itemno=PDL356PB10MBTW-VW">PDL356PB10MBTW</a>)</li><li>Zigbee Default 10AX/15A 240V (<a href="https://www.pdl.co.nz/products/smart-home/pdl-wiser/wiser-connected-smart-switch-zigbee-default-10ax-15a-240v-300-series-pdl356pb10mbtz?itemno=PDL356PB10MBTZ-VW">PDL356PB10MBTZ</a>)</li></ul><p>The 2AX switch is what I mainly have installed for most light switches and a couple of bathroom fans.</p><p>The 10AX can handle higher current so I have one for a bathroom heater.</p><p>The 10AX also has a control (CTL) connector that allows you to add extra Iconic Module PB Switches (<a href="https://www.pdl.co.nz/products/switches-sockets/pdl-iconic/module-pb-switch-secondary-led-3-wire-300-series-pdl356pbssl?itemno=PDL356PBSSL-VW">PDL356PBSSL</a>) so you can do what would normally be two way (or more) switching.</p><h3>The Iconic Wiser Connected Smart Dimmer</h3><p>There’s only one dimmer but still two variations of it (BlueTooth and Zigbee)</p><ul><li>BLE Default 300W 240V (<a href="https://www.pdl.co.nz/products/switches-sockets/pdl-iconic/wiser-connected-smart-dimmer-ble-default-300w-240v-300-series-pdl354pbdmbtw?itemno=PDL354PBDMBTW-VW">PDL354PBDMBTW</a>)</li><li>Zigbee Default 300W 240V (<a href="https://www.pdl.co.nz/products/switches-sockets/pdl-iconic/wiser-connected-smart-dimmer-zigbee-default-300w-240v-300-series-pdl354pbdmbtz?itemno=PDL354PBDMBTZ-VW">PDL354PBDMBTZ</a>)</li></ul><p>Like the 10AX, the dimmer also has a control (CTL) connector that allows for two way switching.</p><h3>BlueTooth or Zigbee</h3><p>When you’re buying these switches/dimmers, it doesn’t really matter which you get as you can easily change which network type they use. We connected to Home Assistant with Zigbee at our place, but my local supplier ran out of Zigbee switches once, so I had to buy the BlueTooth ones and change them to Zigbee. I’ve also seen some suppliers that have different prices for the BlueTooth vs Zigbee variants, so just go with whatever is cheapest and available.</p><p>BTW, we’re using a SONOFF Zigbee 3.0 USB Dongle Plus V2 on our Home Assistant Green and connect Zigbee devices using ZHA.</p><h3>Setting the switch’s LED backlight</h3><p>Once paired, we were able to control our lights as I expected. The only thing I was not able to easily configure was the LED backlight on the switches.</p><p>By default, the switches will have a dim white backlight when the switch is off (easier to find in the dark) and then no backlight when the switch is on.</p><p>The switches are capable of four different settings though:</p><ul><li>Only on when load is on</li><li>Always on</li><li>Only on when load is off (default)</li><li>Always off</li></ul><p>My wife and I preferred the “Always on” mode as it would give you a dim white backlight when the switch is off (easier to find in the dark) and then a bright white backlight when the switch is on (easy to see which switches are on when you have multiple in the same grid).</p><p>If you use the actual PDL Wiser Smart Hub (<a href="https://www.pdl.co.nz/products/smart-home/pdl-wiser/smart-hub-zigbee-to-ip-network-100-240-v-ac-ip20-white-pdl501902?itemno=PDL501902">PDL501902</a>) then you can control this with the APP. With Home Assistant you have to install and use ZHA 🧰 Toolkit.</p><ol><li>Once you have it set up, navigate to “Developer tools” -&gt; “Actions”.</li><li>Select the “ZHA 🧰 Toolkit: Write Attribute” action</li><li>Set “Device Reference” to your switch</li><li>Set “Manufacturer Id” to 4190 (This must be done or you’ll get type errors)</li><li>Set “Target Cluster” to 65303 (This is is 0xFF17 in hex)</li><li>Set “Attribute Id or Name” to 0</li><li>UPDATE: Set Attribute Type to 48 (This also must be done or you’ll get type errors)</li><li>Set “Attribute Value” to what you want it to be</li><li>Click “Perform action”</li></ol><p>For “Attribute Value”, the valid values are 0 = backlight is on when load is on, 1 = backlight is always on, 2 = backlight is on when load is off, 3 = backlight is always off.</p><p>UPDATE: Here is a YAML example to set an example “light.bedroom_lights” to “Always on”.</p><pre>action: zha_toolkit.attr_write<br>data:<br>  ieee: light.bedroom_lights<br>  cluster: 65303<br>  attribute: 0<br>  attr_val: 1<br>  attr_type: 48<br>  manf: 4190</pre><h3>A couple of caveats</h3><ol><li>I live in New Zealand. What’s discussed here probably applies to Australia too but I don’t know for sure.</li><li>I’m not an electrician.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eebdab3696ad" width="1" height="1" alt=""><hr><p><a href="https://medium.com/my-dev-journey/home-assistant-connected-switches-from-schneider-electric-eebdab3696ad">Home Assistant &amp; Connected Switches from Schneider Electric</a> was originally published in <a href="https://medium.com/my-dev-journey">Nick Barrett</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making a Firebird v5 container image]]></title>
            <link>https://medium.com/my-dev-journey/making-a-firebird-v5-container-image-bff61472d42b?source=rss----4642e3f29f1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/bff61472d42b</guid>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[firebird]]></category>
            <dc:creator><![CDATA[Nicholas Barrett]]></dc:creator>
            <pubDate>Sun, 28 Jul 2024 02:03:31 GMT</pubDate>
            <atom:updated>2025-01-27T17:24:41.281Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*b3IWN5nK4Iql9FM41Lup5Q.png" /></figure><p>This is a description of how we created a container image for Firebird v5 on a “chiselled” Ubuntu:Noble.</p><p>You can find the results of this post on <a href="https://github.com/OpsCentre/firebird-ubuntu-chiselled">GitHub</a> and <a href="https://hub.docker.com/r/opscentre/firebird-ubuntu-chiselled">Docker Hub</a>.</p><h3>Backstory</h3><p>(you can skip this part 😂)</p><p>We are finally making our “move to the cloud” 😅</p><p>We looked at various options for a relational database and decided to go with Firebird mainly due to its licensing and familiar set of features; the two main highlights being generators and events both of which we used extensively in our previous database engine InterBase.</p><p>Once we decided on the database engine, next consideration was how/where to host it. As the rest of our application is going to be hosted in a Kubernetes cluster, containerisation was a natural fit.</p><p>We had a look around at what was already available and started off with <a href="https://hub.docker.com/r/jacobalberty/firebird">jacobalberty/firebird</a>. (Big thanks to Jacob 👍🏽) This served us well as a starting point but it wasn’t long before we felt we would should make our own. But how?</p><p>We tried using Jacob’s <a href="https://github.com/jacobalberty/firebird-docker">Dockerfile</a> as a starting point, but quickly discovered we don’t know nearly enough about Linux and scripting to adapt it well for our needs.</p><h3>Step 1) Base image</h3><p>The first step was to decide what base image we wanted to use as the foundation for our Firebird image. Most of our development is in .NET and we use Microsoft’s aspnet:8.0-noble-chiseled as the base for all our container images. Might as well stick with Ubuntu Noble. Maybe even chiselled 🤔</p><pre>FROM ubuntu:24.04 AS base</pre><h3>Step 2) Install Firebird</h3><p>The folks at <a href="https://ib-aid.com/">IBSurgeon Ltd</a> have a great <a href="https://github.com/IBSurgeon/firebirdlinuxinstall">GitHub repo</a> with bash scripts to install Firebird on Linux. As we are using Ubuntu Noble and we want to install Firebird v5 we used <a href="https://github.com/IBSurgeon/firebirdlinuxinstall/blob/main/ubuntu24/fb_vanilla_ub24-50.sh">ubuntu24/fb_vanilla_ub24–50.sh</a>.</p><p>This left the commands in the Dockerfile to look like this.</p><pre>FROM base AS firebird<br><br>ADD https://raw.githubusercontent.com/IBSurgeon/firebirdlinuxinstall/main/ubuntu24/fb_vanilla_ub24-50.sh ./fb_vanilla_ub24-50.sh<br><br>RUN chmod +x ./fb_vanilla_ub24-50.sh &amp;&amp; \<br>    ./fb_vanilla_ub24-50.sh &amp;&amp; \<br>    rm -f ./fb_vanilla_ub24-50.sh</pre><h3>Step 3) Chisel Ubuntu down to what we need</h3><p>Canonical’s <a href="https://github.com/canonical/chisel">chisel</a> seems to be quite a new thing at the moment (v0.10.0 at time of writing). That said, we like how it reduces the size of the final image as well as the attack surface. Using their <a href="https://documentation.ubuntu.com/oci-registries/en/latest/oci-how-to/create-chiselled-ubuntu-image/">guide</a> as a starting point we came up with the following. You can see we added <strong>tzdata_zoneinfo</strong> as we need that for our applications. We also added <strong>libicu74_libs</strong>. To be honest, I can’t remember why we added this one, but I know it doesn’t work without it 😅</p><pre>FROM base AS chisel<br><br># Get chisel binary<br>ADD https://github.com/canonical/chisel/releases/download/v0.10.0/chisel_v0.10.0_linux_amd64.tar.gz chisel.tar.gz<br><br>RUN tar -xvf chisel.tar.gz -C /usr/bin/<br><br>RUN apt-get update \<br>   &amp;&amp; DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates<br><br>WORKDIR /rootfs<br><br>RUN chisel cut --release ubuntu-24.04 --root /rootfs \<br>   base-files_base \<br>   base-files_release-info \<br>   ca-certificates_data \<br>   libgcc-s1_libs \<br>   libc6_libs \<br>   libicu74_libs \<br>   tzdata_zoneinfo</pre><h3>Step 4) Put it all together into the final image</h3><p>Here we grab all the “bits” from steps 2 and 3 and put them in the final image. You can see we had to add <strong>/usr/lib/x86_64-linux-gnu/libtommath.so.1</strong> manually as there isn’t currently a chisel slice for it.</p><pre>FROM scratch<br><br>COPY --from=chisel /rootfs /<br><br>COPY --from=firebird /opt/firebird /opt/firebird<br>COPY --from=firebird /usr/lib/x86_64-linux-gnu/libtommath.so.1 /usr/lib/x86_64-linux-gnu/libtommath.so.1</pre><h3>Step 5) Add VOLUME, EXPOSE and ENTRYPOINT</h3><p>Last step🎉🥳 For us we added a VOLUME for where the database files should be place.</p><pre>VOLUME [&quot;/databases&quot;]</pre><p>We then EXPOSE port 3050</p><pre>EXPOSE 3050/tcp</pre><p>And finally set the ENTRYPOINT</p><pre>ENTRYPOINT [&quot;/opt/firebird/bin/fbguard&quot;]</pre><h3>That’s it!</h3><p>So that’s it. Hope this helps someone short cut their journey to containerised Firebird. From here is was all yaml files to get it running in K8S.</p><p>The full Dockerfile looks like this</p><pre># Build the chiselled filesystem based on the desired slices.<br>FROM ubuntu:24.04 AS base<br><br># Install Firebird v5<br>FROM base AS firebird<br><br>ADD https://raw.githubusercontent.com/IBSurgeon/firebirdlinuxinstall/main/ubuntu24/fb_vanilla_ub24-50.sh ./fb_vanilla_ub24-50.sh<br><br>RUN chmod +x ./fb_vanilla_ub24-50.sh &amp;&amp; \<br>    ./fb_vanilla_ub24-50.sh &amp;&amp; \<br>    rm -f ./fb_vanilla_ub24-50.sh<br><br>FROM base AS chisel<br><br># Get chisel binary<br>ADD https://github.com/canonical/chisel/releases/download/v0.10.0/chisel_v0.10.0_linux_amd64.tar.gz chisel.tar.gz<br><br>RUN tar -xvf chisel.tar.gz -C /usr/bin/<br><br>RUN apt-get update \<br>   &amp;&amp; DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates<br>   <br>WORKDIR /rootfs<br><br>RUN chisel cut --release ubuntu-24.04 --root /rootfs \<br>   base-files_base \<br>   base-files_release-info \<br>   ca-certificates_data \<br>   libgcc-s1_libs \<br>   libc6_libs \<br>   libicu74_libs \<br>   tzdata_zoneinfo<br><br># Make the chiselled filesystem the only thing present in the final image.<br>FROM scratch<br><br>COPY --from=chisel /rootfs /<br><br>COPY --from=firebird /opt/firebird /opt/firebird<br>COPY --from=firebird /usr/lib/x86_64-linux-gnu/libtommath.so.1 /usr/lib/x86_64-linux-gnu/libtommath.so.1<br><br>VOLUME [&quot;/databases&quot;]<br><br>EXPOSE 3050/tcp<br><br>ENTRYPOINT [&quot;/opt/firebird/bin/fbguard&quot;]</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bff61472d42b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/my-dev-journey/making-a-firebird-v5-container-image-bff61472d42b">Making a Firebird v5 container image</a> was originally published in <a href="https://medium.com/my-dev-journey">Nick Barrett</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up RabbitMQ-HA in Kubernetes with external HTTPS and AMQPS access]]></title>
            <link>https://medium.com/my-dev-journey/setting-up-rabbitmq-ha-in-kubernetes-with-external-https-and-amqps-access-1ce1f3632dd2?source=rss----4642e3f29f1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/1ce1f3632dd2</guid>
            <category><![CDATA[tls]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[rabbitmq]]></category>
            <dc:creator><![CDATA[Nicholas Barrett]]></dc:creator>
            <pubDate>Thu, 30 Jan 2020 23:05:05 GMT</pubDate>
            <atom:updated>2021-02-11T20:23:47.409Z</atom:updated>
            <content:encoded><![CDATA[<p>HEADS UP: As of Jan 2021 we no longer use the process described below! stable/rabbitmq-ha has been deprecated. We no longer use helm to install RabbitMQ as we’ve switched to using the RabbitMQ K8S operator. Our installs a based off of the documentation you can find at <a href="https://www.rabbitmq.com/kubernetes/operator/install-operator.html">https://www.rabbitmq.com/kubernetes/operator/install-operator.html</a>. We still create our own ingress (so as to use existing certs) and add TCP access to port 5671 as below, but the actual RabbitMQ cluster is now created using the operator.</p><p>We’ve been struggling with getting this working so here’s a quick rundown of how we did it.</p><p>What we were trying to achieve is to get a RabbitMS cluster up and running with external access over TLS. (That’s both HTTPS for the web interface and AMQPS for actual messaging).</p><p>We already had nginx-ingress and cert-manager going before this, with a wildcard cert for our domain name. This meant we had a secret called ingress-cert that already contained the certificates required to achieve the TLS.</p><p>To actually deploy RabbitMQ cluster we used the command:</p><pre>helm install rabbitmq stable/rabbitmq-ha -n development -f rabbit-values.yaml</pre><p>You can see from this that we are using a namespace called development. The contents of the rabbit-values.yaml was a follows:</p><pre>replicas: 3</pre><pre>rabbitmqUsername: guest<br>rabbitmqPassword: guest</pre><pre>rabbitmqCert:<br>  enabled: true<br>  existingSecret: ingress-cert</pre><pre>rabbitmqAmqpsSupport:<br>  enabled: true</pre><pre># NodePort<br>  amqpsNodePort: 5671</pre><pre># SSL configuration<br>  config: |<br>    listeners.ssl.default             = 5671<br>    ssl_options.cacertfile            = /etc/cert/ca.crt<br>    ssl_options.certfile              = /etc/cert/tls.crt<br>    ssl_options.keyfile               = /etc/cert/tls.key<br>    ssl_options.verify                = verify_peer<br>    ssl_options.fail_if_no_peer_cert  = false</pre><p>Once the cluster was up and running, we used the following command to access the web interface:</p><pre>kubectl port-forward rabbitmq-rabbitmq-ha-0 7000:15672 -n development</pre><p>We could then navigate to <a href="http://127.0.0.1:7000/">http://127.0.0.1:7000/</a> and sign in as guest.</p><p>From here we added the user accounts we needed, signed out, signed back in as an admin and then deleted the guest account.</p><p>In order to expose the web interface we used a yaml file like the following:</p><pre>apiVersion: extensions/v1beta1<br>kind: Ingress<br>metadata:<br>  name: rabbitmq<br>  namespace: development<br>  annotations:<br>    kubernetes.io/ingress.class: nginx<br>spec:<br>  tls:<br>  - hosts:<br>    - amqp.example.com<br>    secretName: ingress-cert<br>  rules:<br>  - host: amqp.example.com<br>    http:<br>      paths:<br>      - backend:<br>          serviceName: rabbitmq-rabbitmq-ha<br>          servicePort: 15672</pre><p>There may have been a way to do this using the options in the Helm chart, but we knew how to do this part from our own applications we had deployed so just went with it what we knew.</p><p>The final step was to expose the AMQPS port (5761) externally. To do this we created a values.yaml file like this:</p><pre>tcp: {&quot;5671&quot;:&quot;development/rabbitmq-rabbitmq-ha:5671&quot;}</pre><p>and then ran the following command:</p><pre>helm upgrade -f values.yaml nginx-ingress-xxxxxxxxx stable/nginx-ingress -n development</pre><p>Doing this exposes port 5761 externally and routes any tcp/ip traffic to port 5761 on the service rabbitmq-rabbitmq-ha.</p><p>We have no idea if this will work when cert-manager refreshes the certificate. We’ll have to wait and see =}</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ce1f3632dd2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/my-dev-journey/setting-up-rabbitmq-ha-in-kubernetes-with-external-https-and-amqps-access-1ce1f3632dd2">Setting up RabbitMQ-HA in Kubernetes with external HTTPS and AMQPS access</a> was originally published in <a href="https://medium.com/my-dev-journey">Nick Barrett</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running EventStore on Service Fabric (v2)]]></title>
            <link>https://medium.com/my-dev-journey/running-eventstore-on-service-fabric-v2-3cb086ad96e2?source=rss----4642e3f29f1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/3cb086ad96e2</guid>
            <category><![CDATA[eventstore]]></category>
            <category><![CDATA[azure-service-fabric]]></category>
            <category><![CDATA[service-fabric]]></category>
            <dc:creator><![CDATA[Nicholas Barrett]]></dc:creator>
            <pubDate>Tue, 24 Oct 2017 07:39:55 GMT</pubDate>
            <atom:updated>2017-10-24T07:27:01.588Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*iYOggFrzWWkuxuRxpDqpuA.jpeg" /></figure><p>I’ve had another go at hosting EventStore as a guest executable in Service Fabric. This time it was easier, but still not quite as easy as it could be.</p><p>This time around I learned that EventStore can be configured using environment variables and Service Fabric can set these prior to starting a guest executable. This seemed like it was going to work perfectly, and it almost did.</p><p>I used the new VS 2017 tooling to setup a new Service Fabric solution with a guest executable service. All pretty standard stuff now and MS have done a good job making this easy. (I was using EventStore 4.0.3 and Service Fabric 6.0.219.9494 on my own set of VMs on prem)</p><p>To configure EventStore, I added the following to ServiceManifest.xml.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;ServiceManifest Name=&quot;EventStorePkg&quot; Version=&quot;4.0.3&quot; ...&gt;<br>  ...<br>  &lt;CodePackage Name=&quot;Code&quot; Version=&quot;4.0.3&quot;&gt;<br>    ...<br><strong>    &lt;EnvironmentVariables&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_LOG&quot; Value=&quot;c:\event_store\log&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_DB&quot; Value=&quot;c:\event_store\data&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_INT_TCP_PORT&quot; Value=&quot;1111&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_EXT_TCP_PORT&quot; Value=&quot;1112&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_INT_HTTP_PORT&quot; Value=&quot;2113&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_EXT_HTTP_PORT&quot; Value=&quot;2114&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_INT_HTTP_PREFIXES&quot; Value=&quot;http://+:2113/&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_EXT_HTTP_PREFIXES&quot; Value=&quot;http://+:2114/&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_ADD_INTERFACE_PREFIXES&quot; Value=&quot;false&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_RUN_PROJECTIONS&quot; Value=&quot;all&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_CLUSTER_GOSSIP_PORT&quot; Value=&quot;2113&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_CLUSTER_SIZE&quot; Value=&quot;1&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_CLUSTER_DNS&quot; Value=&quot;fake.dns&quot;/&gt;<br>    &lt;/EnvironmentVariables&gt;<br></strong>  &lt;/CodePackage&gt;<br>  ...<br>  &lt;Resources&gt;<br>    &lt;Endpoints&gt;<br><strong>      &lt;Endpoint Name=&quot;IntTcpPort&quot; Protocol=&quot;tcp&quot; Port=&quot;1111&quot; Type=&quot;Input&quot; /&gt;<br>      &lt;Endpoint Name=&quot;ExtTcpPort&quot; Protocol=&quot;tcp&quot; Port=&quot;1112&quot; Type=&quot;Input&quot; /&gt;<br>      &lt;Endpoint Name=&quot;IntHttpPort&quot; Protocol=&quot;http&quot; Port=&quot;2113&quot; Type=&quot;Input&quot; /&gt;<br>      &lt;Endpoint Name=&quot;ExtHttpPort&quot; Protocol=&quot;http&quot; Port=&quot;2114&quot; Type=&quot;Input&quot; /&gt;<br></strong>    &lt;/Endpoints&gt;<br>  &lt;/Resources&gt;<br>&lt;/ServiceManifest&gt;</pre><p>Setting EVENTSTORE_CLUSTER_SIZE to 1 EVENTSTORE_CLUSTER_DNS to fake.dns might seem strange, but these are the default values if you don’t specify any. This setup the basics of the cluster config and allowed me to use EnvironmentOverrides in the ApplicationManifest.xml to set specific values for different distributions like so.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;ApplicationManifest ApplicationTypeName=&quot;sf_event_store&quot; ApplicationTypeVersion=&quot;4.0.3&quot; ...&gt;<br>  &lt;Parameters&gt;<br>    &lt;Parameter Name=&quot;EventStore_InstanceCount&quot; DefaultValue=&quot;-1&quot; /&gt;<br><strong>    &lt;Parameter Name=&quot;EventStore_ClusterSize&quot; DefaultValue=&quot;1&quot; /&gt;<br>    &lt;Parameter Name=&quot;EventStore_ClusterDns&quot; DefaultValue=&quot;fake.dns&quot; /&gt;</strong><br>  &lt;/Parameters&gt;<br>  &lt;ServiceManifestImport&gt;<br>    ...<br><strong>    &lt;EnvironmentOverrides CodePackageRef=&quot;Code&quot;&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_CLUSTER_SIZE&quot; Value=&quot;[EventStore_ClusterSize]&quot;/&gt;<br>      &lt;EnvironmentVariable Name=&quot;EVENTSTORE_CLUSTER_DNS&quot; Value=&quot;[EventStore_ClusterDns]&quot;/&gt;<br>    &lt;/EnvironmentOverrides&gt;<br></strong>  &lt;/ServiceManifestImport&gt;<br>  ...<br>&lt;/ApplicationManifest&gt;</pre><p>As I was running on my own in house cluster, so I setup my own Test.xml files in PublishProfiles and ApplicationParameters in order to set EventStore_ClusterSize and EventStore_ClusterDns for my cluster. For me this meant setting EventStore_ClusterSize to 3 and EventStore_ClusterDns to the DNS A record that I created to point to all the servers in my cluster.</p><p>This left just the internal and external IP addresses to be set for EventStore. I tried using 0.0.0.0 but I couldn’t get the cluster nodes to see each other. From my testing, it appeared that each server needed its own IP address set for both of these parameters. This is where it got tricky. Service Fabric has an environment variable called Fabric_NodeIPOrFQDN. It would have been so awesome had I been able to set EVENTSTORE_INT_IP and EVENTSTORE_EXT_IP to this, but currently you can only set environment variables to a set value or a parameter (by placing the parameter name in [] brackets).</p><p>To get around this problem, I had to resort back to PowerShell to set the environment variables. =(</p><p>To achieve this I created a setup.bat file in the Code directory containing the following.</p><pre>powershell.exe -ExecutionPolicy Bypass -Command &quot;.\SetIPAddress.ps1&quot;</pre><p>I then created a PowerShell script called SetIPAddress.ps1 in the same directory.</p><pre>$ipV4 = Test-Connection -ComputerName (hostname) -Count 1  | Select -ExpandProperty IPV4Address<br>[Environment]::SetEnvironmentVariable(&quot;EVENTSTORE_INT_IP&quot;, $ipV4.IPAddressToString, &quot;User&quot;)<br>[Environment]::SetEnvironmentVariable(&quot;EVENTSTORE_EXT_IP&quot;, $ipV4.IPAddressToString, &quot;User&quot;)</pre><p>I then had to add the following SetupEntryPoint to the ServiceManifest.xml file.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;ServiceManifest Name=&quot;EventStorePkg&quot; Version=&quot;4.0.3&quot;...&gt;<br>  ...<br>  &lt;CodePackage Name=&quot;Code&quot; Version=&quot;4.0.3&quot;&gt;<br><strong>    &lt;SetupEntryPoint&gt;<br>      &lt;ExeHost&gt;<br>        &lt;Program&gt;setup.bat&lt;/Program&gt;<br>        &lt;WorkingFolder&gt;CodeBase&lt;/WorkingFolder&gt;<br>      &lt;/ExeHost&gt;<br>    &lt;/SetupEntryPoint&gt;<br></strong>    ...<br>  &lt;/CodePackage&gt;<br>  ...<br>&lt;/ServiceManifest&gt;</pre><p>After that, I was able to deploy the EventStore and connect to it via its web interface!</p><p>I really hope the Service Fabric make it possible to set environment variables to the value already in another environment variable. It would cut out all the manual scripting and make this process super clean and easy.</p><p>Any way, hope this helps someone.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cb086ad96e2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/my-dev-journey/running-eventstore-on-service-fabric-v2-3cb086ad96e2">Running EventStore on Service Fabric (v2)</a> was originally published in <a href="https://medium.com/my-dev-journey">Nick Barrett</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setup RabbitMQ with web interface]]></title>
            <link>https://medium.com/my-dev-journey/setup-rabbitmq-with-web-interface-3a2d651eaf9d?source=rss----4642e3f29f1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/3a2d651eaf9d</guid>
            <category><![CDATA[erlang]]></category>
            <category><![CDATA[rabbitmq]]></category>
            <dc:creator><![CDATA[Nicholas Barrett]]></dc:creator>
            <pubDate>Fri, 24 Mar 2017 03:49:05 GMT</pubDate>
            <atom:updated>2018-04-30T00:34:06.126Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m writing this one because every time I go to do this I end up doing a whole lot of Googling.</p><p>Got to <a href="http://www.erlang.org/downloads">http://www.erlang.org/downloads</a> and download the latest Erlang.</p><p>Go to <a href="http://www.rabbitmq.com/download.html">http://www.rabbitmq.com/download.html</a> and download the latest RabbitMQ.</p><p>Install Erlang then RabbitMQ.</p><p>Open a command prompt (admin) and run the following commands.</p><blockquote>cd “C:\Program Files\RabbitMQ Server\rabbitmq_server-&lt;VERSION&gt;\sbin”</blockquote><blockquote>rabbitmq-plugins enable rabbitmq_management</blockquote><p>Open a browser to <a href="http://localhost:15672/">http://localhost:15672/</a> and log in with guest/guest.</p><p>Add users as required and set their permissions.</p><p>Close browser and reopen it at <a href="http://host_name:15672/">http://&lt;HOST_NAME&gt;:15672/</a> and login as one of the new users (one with administrator tag).</p><p>Delete the guest user.</p><p>UPDATE: I also need to enable shovels in the web ui as well</p><blockquote>rabbitmq-plugins enable rabbitmq_shovel rabbitmq_shovel_management</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a2d651eaf9d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/my-dev-journey/setup-rabbitmq-with-web-interface-3a2d651eaf9d">Setup RabbitMQ with web interface</a> was originally published in <a href="https://medium.com/my-dev-journey">Nick Barrett</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Gui to a Windows Server 2012 R2 Core installation]]></title>
            <link>https://medium.com/my-dev-journey/adding-gui-to-a-windows-server-2012-r2-core-installation-f9529cd48994?source=rss----4642e3f29f1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/f9529cd48994</guid>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[sysadmin]]></category>
            <dc:creator><![CDATA[Nicholas Barrett]]></dc:creator>
            <pubDate>Tue, 21 Mar 2017 22:05:51 GMT</pubDate>
            <atom:updated>2017-03-21T22:05:51.297Z</atom:updated>
            <content:encoded><![CDATA[<p>I was trying to install and setup ADFS 3.0 on a Core install using powershell, but I got to a point where I simply could not find the commands to do what I wanted to do. As such, I needed to add Windows Gui to my Core install.</p><p>First I had to mount the install iso to the VM. Then I used the following powershell command to find the appropriate image index. (This time around mine was 2)</p><blockquote>Get-WindowsImage -ImagePath d:\sources\install.wim</blockquote><p>Back in a normal command prompt I created a directory in C:\</p><blockquote>mkdir C:\mountdir</blockquote><p>And then mounted the install files using the following</p><blockquote>dism /mount-wim /wimfile:d:\sources\install.wim /index:2 /mountdir:C:\mountdir /readonly</blockquote><p>To add the gui I used the following powershell command</p><blockquote>Install-WindowsFeature server-gui-mgmt-infra,server-gui-shell -Restart -Source C:\mountdir\Windows\WinSxS</blockquote><p>Finally, back in a command prompt, un-mount the install files</p><blockquote>dism /unmount-wim /mountdir:C:\mountdir</blockquote><p>That’s it =)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9529cd48994" width="1" height="1" alt=""><hr><p><a href="https://medium.com/my-dev-journey/adding-gui-to-a-windows-server-2012-r2-core-installation-f9529cd48994">Adding Gui to a Windows Server 2012 R2 Core installation</a> was originally published in <a href="https://medium.com/my-dev-journey">Nick Barrett</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An update on hosting an Asp.Net Core (full framework) app in a Windows Service using TopShelf]]></title>
            <link>https://medium.com/my-dev-journey/an-update-on-hosting-an-asp-net-core-full-framework-app-in-a-windows-service-using-topshelf-c6d39e8ef827?source=rss----4642e3f29f1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/c6d39e8ef827</guid>
            <category><![CDATA[topshelf]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <dc:creator><![CDATA[Nicholas Barrett]]></dc:creator>
            <pubDate>Thu, 16 Mar 2017 00:07:36 GMT</pubDate>
            <atom:updated>2017-05-28T00:40:01.295Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*XilZISt2S-tzYKOSDD9mIQ.png" /></figure><p>Update: After having trouble with Directory.GetCurrentDirectory() in production, turns out using Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) is a pretty good way of doing this. It’s what I’m currently using in dev and prod. I’ve left this post for my own reference.</p><p><strong>Blog post starts here \/</strong></p><p>So I’ve been developing a bunch of Web Apps using the method I used in my <a href="https://nick.barrett.org.nz/hosting-an-asp-net-core-full-framework-app-in-a-windows-service-using-topshelf-2c583fff8000">previous post</a>. Up until now, all my Web Apps have been Web Apis, and everything seemed to be working just fine. In my latest Web App though, I am trying to get IdentityServer4 up and running and I found that the views would not serve when debugging. If I published the app, it all worked fine, but during debugging I would get the following error.</p><blockquote>An unhandled exception occurred while processing the request</blockquote><blockquote>InvalidOperationException: The view ‘Index’ was not found. The following locations were searched:<br>/Views/Home/Index.cshtml<br>/Views/Shared/Index.cshtml</blockquote><p>Turns out that when debugging, if you call Directory.GetCurrentDirectory() from inside Program.Main(), you get a different value than if you call it from a method in another class. When calling from another class, it would always add “\bin\Debug\net462\win7-x86” to the end of what was returned in Program.Main().</p><p>For now, my workaround is to pass the value I get from from inside Program.Main() to the other class in its constructor, like in the following example code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a5475d5298ebc2389123b3d674c0245/href">https://medium.com/media/3a5475d5298ebc2389123b3d674c0245/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e2b62a90d776ba8ecfc40c7f7aa1b8ef/href">https://medium.com/media/e2b62a90d776ba8ecfc40c7f7aa1b8ef/href</a></iframe><p>Once again, hope that helps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6d39e8ef827" width="1" height="1" alt=""><hr><p><a href="https://medium.com/my-dev-journey/an-update-on-hosting-an-asp-net-core-full-framework-app-in-a-windows-service-using-topshelf-c6d39e8ef827">An update on hosting an Asp.Net Core (full framework) app in a Windows Service using TopShelf</a> was originally published in <a href="https://medium.com/my-dev-journey">Nick Barrett</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hosting an Asp.Net Core (full framework) app in a Windows Service using TopShelf]]></title>
            <link>https://medium.com/my-dev-journey/hosting-an-asp-net-core-full-framework-app-in-a-windows-service-using-topshelf-2c583fff8000?source=rss----4642e3f29f1e---4</link>
            <guid isPermaLink="false">https://medium.com/p/2c583fff8000</guid>
            <category><![CDATA[topshelf]]></category>
            <category><![CDATA[aspnetcore]]></category>
            <dc:creator><![CDATA[Nicholas Barrett]]></dc:creator>
            <pubDate>Thu, 02 Mar 2017 00:58:55 GMT</pubDate>
            <atom:updated>2017-05-25T04:26:04.986Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*XilZISt2S-tzYKOSDD9mIQ.png" /></figure><p>Update 1: If you follow this method and have trouble debugging Mvc apps (as opposed to Web Api apps), please have a quick read of my <a href="https://nick.barrett.org.nz/an-update-on-hosting-an-asp-net-core-full-framework-app-in-a-windows-service-using-topshelf-c6d39e8ef827">next post</a>. It explains a work around to get the views going during debug sessions.</p><p>Update 2: I had a warning up for a little while as I had trouble deploying my service into production and I thought it was TopShelf that was the problem. Turns out it was just me (again). I was using</p><blockquote>Directory.GetCurrentDirectory();</blockquote><p>instead of</p><blockquote>Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);</blockquote><p>and so my service couldn’t find anything and kept crashing (before the logging started because it couldn’t find the config file to tell it how to setup the logging). One last thing, I haven’t edited the code below, so please keep that in mind.</p><p><strong>Blog post starts here \/</strong></p><p>So I’ve been self-hosting asp.net web api’s for a while now in “Windows Services” using TopShelf. It’s been a great combination =) Recently though, I wanted to use some the asp.net core newness. At first it seemed all you could do is either host it in IIS or run it as a console app. I tracked down some documentation about using “Microsoft.AspNetCore.Hosting.WindowsServices”, but it didn’t feel the same as my trusty TopShelf services.</p><p>Turns out, it’s not that hard to use TopShelf with Asp.Net Core, as long as you are happy with using the full framework (which I am).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f52c712da757bd1907dbf0a74cb11f31/href">https://medium.com/media/f52c712da757bd1907dbf0a74cb11f31/href</a></iframe><p>I use the Kestrel server (without IIS of course). This isn’t currently recommended, but as this isn’t public facing I’m not that concerned. If that changes I would probably use a reverse proxy like Nginx or IIS.</p><p>Any way, hope that helps. As I said at the start, if I find any problems with using this in production, I’ll write some sort of update.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c583fff8000" width="1" height="1" alt=""><hr><p><a href="https://medium.com/my-dev-journey/hosting-an-asp-net-core-full-framework-app-in-a-windows-service-using-topshelf-2c583fff8000">Hosting an Asp.Net Core (full framework) app in a Windows Service using TopShelf</a> was originally published in <a href="https://medium.com/my-dev-journey">Nick Barrett</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>