<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Manjula Rajamani</title>
    <description>The latest articles on DEV Community by Manjula Rajamani (@manjularajamani).</description>
    <link>https://dev.to/manjularajamani</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F839115%2F93dec161-7431-4e77-b770-af1dbbbd5c10.jpg</url>
      <title>DEV Community: Manjula Rajamani</title>
      <link>https://dev.to/manjularajamani</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/manjularajamani"/>
    <language>en</language>
    <item>
      <title>Deploying Node-Red on Azure Container Instance</title>
      <dc:creator>Manjula Rajamani</dc:creator>
      <pubDate>Thu, 05 Sep 2024 12:30:38 +0000</pubDate>
      <link>https://dev.to/ittrident/deploying-node-red-on-azure-container-instance-4n44</link>
      <guid>https://dev.to/ittrident/deploying-node-red-on-azure-container-instance-4n44</guid>
      <description>&lt;p&gt;This guide provides instructions for deploying the Node-Red application on the Azure platform, utilizing Azure Container Instances, Azure Container Registry, and Azure Storage Account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Azure Container Instance?&lt;/strong&gt;&lt;br&gt;
Azure Container Instances (ACI) is a managed service that allows you to run containers directly on the Microsoft Azure public cloud, without requiring the use of virtual machines (VMs)&lt;/p&gt;

&lt;p&gt;For more information about Azure Container Instances, check out the official documentation at this link: &lt;a href="https://learn.microsoft.com/en-us/azure/container-instances/" rel="noopener noreferrer"&gt;Azure Container Instances Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Azure Container Registry?&lt;/strong&gt;&lt;br&gt;
Azure Container Registry is a private registry service for building, storing, and managing container images and related artifacts&lt;/p&gt;

&lt;p&gt;For more information about Azure Container Registry, check out the official documentation at this link: &lt;a href="https://learn.microsoft.com/en-us/azure/container-registry/" rel="noopener noreferrer"&gt;Azure Container Registry Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is an Azure Storage account?&lt;/strong&gt;&lt;br&gt;
The Azure Storage platform is Microsoft's cloud storage solution for modern data storage scenarios. Azure Storage offers highly available, massively scalable, durable, and secure storage for a variety of data objects in the cloud. Azure Storage data objects are accessible from anywhere in the world over HTTP or HTTPS via a REST API.&lt;/p&gt;

&lt;p&gt;For more information about the Azure Storage account, check out the official documentation at this link: &lt;a href="https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview" rel="noopener noreferrer"&gt;Azure Storage account Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Startup:&lt;/strong&gt;&lt;br&gt;
Before starting, ensure that you have an Azure account with an active subscription&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 1:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Login into your Azure account&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

az login


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 2:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create a container registry and store the Node-RED image in the container registry&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As of Node-RED 1.0, the repository on Docker Hub was renamed to &lt;code&gt;nodered/node-red&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Log in to a registry using Azure CLI&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

az acr login --name myregistry
docker login myregistry.azurecr.io


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If you are unfamiliar with creating an Azure Container Registry (ACR), you can refer to the following link for step-by-step instructions using the Azure portal: &lt;a href="https://learn.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal?tabs=azure-cli" rel="noopener noreferrer"&gt;Get Started with Azure Container Registry&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 3:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Create an Azure file share:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Run the following script to create a storage account to host the file share, and the share itself. The storage account name must be globally unique, so the script adds a random value to the base string.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

# Change these parameters as needed
RESOURCE_GROUP=myResourceGroup
STORAGE_ACCOUNT_NAME=storageaccount$RANDOM
LOCATION=eastus
FILE_SHARE_NAME=node-red-share
IMAGE=testingregistrydevops.azurecr.io/node-red:latest
ACI_NAME=node-red

# Create the storage account with the parameters
az storage account create \
    --resource-group $RESOURCE_GROUP \
    --name $STORAGE_ACCOUNT_NAME \
    --location $LOCATION \
    --sku Standard_LRS

# Create the file share
az storage share-rm create \
    --resource-group $RESOURCE_GROUP \
    --storage-account $STORAGE_ACCOUNT_NAME \
    --name $FILE_SHARE_NAME \
    --quota 1024 \
    --enabled-protocols SMB \
    --output table


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 4:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Get storage credentials:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
To mount an Azure file share as a volume in Azure Container Instances, you need three values: the storage account name, the share name, and the storage access key.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Storage account name&lt;/strong&gt; - If you used the preceding script, the storage account name was stored in the &lt;code&gt;$STORAGE_ACCOUNT_NAME&lt;/code&gt; variable. To see the account name, type:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

echo $STORAGE_ACCOUNT_NAME


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Share name&lt;/strong&gt;- This value is already known (defined as &lt;code&gt;node-red-share&lt;/code&gt; in the preceding script). To see the file share name &lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

echo $FILE_SHARE_NAME


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Storage account key&lt;/strong&gt; - This value can be found using the following command:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

STORAGE_KEY=$(az storage account keys list --resource-group $RESOURCE_GROUP --account-name $STORAGE_ACCOUNT_NAME --query "[0].value" --output tsv)
echo $STORAGE_KEY



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 5:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Deploy container and mount volume - CLI:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
To mount an Azure file share as a volume in a container by using the Azure CLI, specify the share and volume mount point when you create the container with az container create. If you followed the previous steps, you can mount the share you created earlier by using the following command to create a container:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

az container create \
        --resource-group $RESOURCE_GROUP \
        --name $ACI_NAME \
        --image $IMAGE \
        --dns-name-label unique-acidemo-label \
        --ports 1880 \
        --azure-file-volume-account-name $STORAGE_ACCOUNT_NAME \
        --azure-file-volume-account-key $STORAGE_ACCOUNT_KEY \
        --azure-file-volume-share-name $FILE_SHARE_NAME \
        --azure-file-volume-mount-path /aci/logs/



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;--dns-name-label&lt;/code&gt; value must be unique within the Azure region where you create the container instance&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using Bash&lt;/strong&gt;&lt;br&gt;
You can combine the above commands and execute the bash script to create an Azure Container Instance for Node-RED.&lt;br&gt;
Here is the bash script for Node-RED&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

#!/usr/bin/env bash

RESOURCE_GROUP=MyResourceGroup
STORAGE_ACCOUNT_NAME=storageaccount$RANDOM
LOCATION=eastus
FILE_SHARE_NAME=node-red-share
IMAGE=testingregistrydevops.azurecr.io/node-red:latest
ACI_NAME=node-red

# Function to handle errors
handle_error() {
    echo "Error: $1" &amp;gt;&amp;amp;2
    exit 1
}

# Azure Login
az login || handle_error "Failed to login to Azure"

# ACR Login
az acr login --name testingregistrydevops.azurecr.io || handle_error "Failed to login to ACR"

# Check if Resource Group exists
if az group show --name $RESOURCE_GROUP &amp;amp;&amp;gt;/dev/null; then
    echo "Resource group '$RESOURCE_GROUP' already exists."
else
    # Creating Resource Group
    az group create --name $RESOURCE_GROUP --location $LOCATION || handle_error "Failed to create resource group"
    echo "Resource group '$RESOURCE_GROUP' created."
fi

# Check if the Storage Account exists
if az storage account show --name $STORAGE_ACCOUNT_NAME --resource-group $RESOURCE_GROUP &amp;amp;&amp;gt;/dev/null; then
    echo "Storage account '$STORAGE_ACCOUNT_NAME' already exists."
else
    # Creating Storage Account
    az storage account create \
        --resource-group $RESOURCE_GROUP \
        --name $STORAGE_ACCOUNT_NAME \
        --location $LOCATION \
        --sku Standard_LRS || handle_error "Failed to create storage account"
    echo "Storage account '$STORAGE_ACCOUNT_NAME' created."
fi

# Creating File Share
echo "Creating file share '$FILE_SHARE_NAME'..."
if az storage share-rm create \
    --resource-group $RESOURCE_GROUP \
    --storage-account $STORAGE_ACCOUNT_NAME \
    --name $FILE_SHARE_NAME \
    --quota 1024 \
    --enabled-protocols SMB \
    --output table &amp;amp;&amp;gt;/dev/null; then
    echo "File share '$FILE_SHARE_NAME' created successfully."
else
    handle_error "Failed to create file share '$FILE_SHARE_NAME'"
fi

# Fetch Storage Account Key
STORAGE_ACCOUNT_KEY=$(az storage account keys list --resource-group $RESOURCE_GROUP --account-name $STORAGE_ACCOUNT_NAME --query "[0].value" --output tsv)
echo $STORAGE_ACCOUNT_KEY

# Creating Azure Container Instance for Node-Red
if az container show --resource-group $RESOURCE_GROUP --name $ACI_NAME &amp;amp;&amp;gt;/dev/null; then
    echo "Azure Container Instance '$ACI_NAME' already exists."
else
    # Creating Azure Container Instance for Node-Red
    az container create \
        --resource-group $RESOURCE_GROUP \
        --name $ACI_NAME \
        --image $IMAGE \
        --dns-name-label unique-acidemo-label \
        --ports 1880 \
        --azure-file-volume-account-name $STORAGE_ACCOUNT_NAME \
        --azure-file-volume-account-key $STORAGE_ACCOUNT_KEY \
        --azure-file-volume-share-name $FILE_SHARE_NAME \
        --azure-file-volume-mount-path /aci/logs/ || handle_error "Failed to create container instance"

    echo "Azure Container Instance '$ACI_NAME' created."
fi



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After executing the file, you can make the application accessible using the &lt;code&gt;public IP&lt;/code&gt; or &lt;code&gt;Fully Qualified Domain Name (FQDN)&lt;/code&gt; of the Azure Container Instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcgzh7wse2lwjwexp32cc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcgzh7wse2lwjwexp32cc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Additionally, you can verify whether the file share is properly mounted using Azure Container Instances (ACI)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwdczbsw66g4f07sz5wcx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwdczbsw66g4f07sz5wcx.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>MicroBin on Fly.io</title>
      <dc:creator>Manjula Rajamani</dc:creator>
      <pubDate>Wed, 17 May 2023 15:00:03 +0000</pubDate>
      <link>https://dev.to/ittrident/microbin-on-flyio-2nik</link>
      <guid>https://dev.to/ittrident/microbin-on-flyio-2nik</guid>
      <description>&lt;p&gt;MicroBin is a tiny, feature rich, configurable, self-contained, and self-hosted paste bin web application. It is elementary to set up and use, and will only require a few megabytes of memory and disk storage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fly.io&lt;/strong&gt;&lt;br&gt;
Fly.io is a platform for running full-stack applications and databases close to the users without any DevOps. You can deploy your apps to Fly.io (it's about the simplest place to deploy a Docker Image) and use our CLI to launch instances in regions that are most important for their application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structure of MicroBin&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 1:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Clone your repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/manjularajamani/microbin.git
cd microbin/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 2:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Using Dockerfile(or pre-built Docker images)we can able to deploy the application on the fly.io app server&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM rust:latest as build

WORKDIR /app

COPY . .

RUN \
  DEBIAN_FRONTEND=noninteractive \
  apt-get update &amp;amp;&amp;amp;\
  apt-get -y install ca-certificates tzdata &amp;amp;&amp;amp;\
  CARGO_NET_GIT_FETCH_WITH_CLI=true \
  cargo build --release

# https://hub.docker.com/r/bitnami/minideb
FROM bitnami/minideb:latest

# microbin will be in /app
WORKDIR /app

# copy time zone info
COPY --from=build \
  /usr/share/zoneinfo \
  /usr/share/zoneinfo

COPY --from=build \
  /etc/ssl/certs/ca-certificates.crt \
  /etc/ssl/certs/ca-certificates.crt

# copy built executable
COPY --from=build \
  /app/target/release/microbin \
  /usr/bin/microbin

# Expose webport used for the webserver to the docker runtime
EXPOSE 8080

ENTRYPOINT ["microbin"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or fetch Docker image from &lt;a href="https://hub.docker.com/r/danielszabo99/microbin" rel="noopener noreferrer"&gt;DockerHub: danielszabo99/microbin:latest&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 3:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Install flyctl&lt;/em&gt;:&lt;/strong&gt;&lt;br&gt;
flyctl is a command line interface to the Fly.io platform.It allows users to manage authentication, application launch, deployment, network configuration, logging and more with just the one command.Install &lt;a href="https://fly.io/docs/hands-on/install-flyctl/" rel="noopener noreferrer"&gt;Flyctl CLI&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Sign In&lt;/em&gt;:&lt;/strong&gt;&lt;br&gt;
If you already have a Fly.io account, all you need to do is sign in with flyctl&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fly auth login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your browser will open up with the Fly.io sign-in screen, enter your user name and password to sign in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 4:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
To deploy app into fly.io we need a &lt;code&gt;fly.toml&lt;/code&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app = "microbin"
primary_region = "ams"
kill_signal = "SIGINT"
kill_timeout = "5s"

[experimental]
  entrypoint = ["microbin", "--highlightsyntax", "--private", "--qr", "--editable", "--enable-burn-after"]

[build]
  image = "danielszabo99/microbin:latest"

[[mounts]]
  source = "microbin_data"
  destination = "/app/pasta_data"

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I've added only a few things that are enough for micro microbin&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;kill_signal:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
The kill_signal option allows you to change what signal is sent so that you can trigger a softer, less disruptive shutdown. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;kill_timeout:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
When shutting down a Fly app instance, by default, after sending a signal, Fly gives an app instance five seconds to close down before being killed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;experimental:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
This section is for flags and feature settings which have yet to be promoted into the main configuration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;build:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
The image builder is used when you want to immediately deploy an existing public image&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;mounts:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
This section supports the Volumes feature for persistent storage&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;auto_stop_machines&lt;/strong&gt;&lt;/em&gt;:&lt;br&gt;
Whether to automatically stop an application's machines when there's excess capacity, per region.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;auto_start_machines&lt;/strong&gt;&lt;/em&gt;:&lt;br&gt;
Whether to automatically start an application's machines when a new request is made to the application and there's no excess capacity, per region.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 5:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;Launch an App on Fly:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Fly.io enables you to deploy almost any kind of app using a Docker image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flyctl launch 
      (or)
flyctl launch --image danielszabo99/microbin:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you need to edit &lt;code&gt;fly.toml&lt;/code&gt; and redeploy use the below command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flyctl deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;Check Your App's Status:&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
The application has been deployed with a DNS hostname of &lt;code&gt;microbin.fly.dev&lt;/code&gt;. Your deployment's name will, of course, be different. &lt;code&gt;fly status&lt;/code&gt; give us basic details&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flyctl status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 6:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
The DESTROY command will remove an application from the Fly platform.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flyctl destroy &amp;lt;APPNAME&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Adding Custom Domains&lt;/strong&gt;&lt;br&gt;
Fly offers a simple command-line process for the manual configuration of custom domains and for people integrating Fly custom domains into their automated workflows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 1:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
 Run &lt;code&gt;flyctl ips list&lt;/code&gt; to see your app's addresses&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flyctl ips list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create an A record pointing to your v4 address, and an AAAA record pointing to your v6 address on your respective DNS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 2:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
You can add the custom domain to the application's certificates.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flyctl certs create &amp;lt;domain.name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 3:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
You can check on the progress by running the below command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flyctl certs show &amp;lt;domain.name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the certificate is issued you can access your application to your Domain&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 4:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
To remove the hostname from the application, drop the certificates in the process.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flyctl certs delete &amp;lt;domain.name&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Seccomp security profiles</title>
      <dc:creator>Manjula Rajamani</dc:creator>
      <pubDate>Mon, 20 Mar 2023 07:23:14 +0000</pubDate>
      <link>https://dev.to/manjularajamani/seccomp-security-profiles-40m7</link>
      <guid>https://dev.to/manjularajamani/seccomp-security-profiles-40m7</guid>
      <description>&lt;p&gt;This blog post tries to exemplate how to run our code in a "Restricted-service operating mode" using libseccomp library&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Linux Kernel and Syscalls?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The kernel performs many jobs but we are going be focussing &lt;br&gt;
on system calls&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Linux Syscalls:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strace:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Strace is used to record all the system calls made by the &lt;br&gt;
particular request&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then we can use this information to debug or diagnose the problem&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Examples:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
The output on the screen after running the &lt;strong&gt;strace&lt;/strong&gt; command was simply system calls made to run the &lt;strong&gt;ls&lt;/strong&gt; command&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftf8epymi9qspkd9ecwv6.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftf8epymi9qspkd9ecwv6.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Save the Trace execution to a file using option -O&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr7rf7rw24r08gmd33pvb.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr7rf7rw24r08gmd33pvb.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The output would be dumped into &lt;strong&gt;trace.log&lt;/strong&gt; file&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Take look at the first line in the trace.log file&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;execve("/usr/bin/ls", ["ls", "test/"], [/* 40 vars */]) = 0&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;execve, is the name of a system call being executed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The text within the parentheses is the arguments provided to the system call.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;0 is a value returned by the execve system call.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Sorting the Result by Columns using option -c:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiiz78wzhbly40ymdzt7k.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiiz78wzhbly40ymdzt7k.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Obtaining Timing Information using option -t:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Florik31yncy54j7cdxny.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Florik31yncy54j7cdxny.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Attaching strace to Running Process using option -p:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2lfi6h6nnd47qdh9db1c.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2lfi6h6nnd47qdh9db1c.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffj950y45xeyfepsuco24.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffj950y45xeyfepsuco24.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Seccomp&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;seccomp (short for secure computing mode) is a computer security facility in the Linux kernel. seccomp allows a process to make a one-way transition into a "secure" state where it cannot make any system calls except exit() , sigreturn() , read() and write() to already-open file descriptors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;libseccomp&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The libseccomp library provides an easy to use, platform independent, interface to the Linux Kernel's syscall filtering mechanism.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installing the libseccomp Library:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 1&lt;/em&gt;&lt;/strong&gt;: Grab the latest release from the release page at libseccomp repository&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Step 2:&lt;/em&gt;&lt;/strong&gt; If you are building the libseccomp library from an official release tarball, you should follow the familiar three step process used by most autotools based applications:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgmnvom7t8yn8ayde5mo.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgmnvom7t8yn8ayde5mo.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;Step 3&lt;/em&gt;&lt;/strong&gt;: Install python3-devel using your package manager of choice to fulfil the dependencies needed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example Code for Python bindings for the libseccomp library:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def setup_seccomp(log_only):
    f = SyscallFilter(ALLOW)
    # always log, even when returning an error
    f.set_attr(Attr.CTL_LOG, 1)
    action = LOG if log_only else ERRNO(errno.EACCES)
    # stop executions
    f.add_rule(action, "execve")
    f.add_rule(action, "execveat")
    f.add_rule(action, "vfork")
    f.add_rule(action, "fork")
    f.load()
    print(f'Seccomp enabled...')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Filter action values:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;KILL_PROCESS - kill the process
KILL         - kill the thread
LOG          - allow the syscall to be executed after the action has been logged
ALLOW        - allow the syscall to execute
TRAP         - a SIGSYS signal will be thrown
NOTIFY       - a notification event will be sent via the notification API
ERRNO(x)     - syscall will return (x)
TRACE(x)     - if the process is being traced, (x) will be returned to the tracing process via PTRACE_EVENT_SECCOMP and the PTRACE_GETEVENTMSG option
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here is my repo which attempts to seccomp a simple python program.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/manjularajamani/pyseccomp-playground/tree/main/seccompd-progs" rel="noopener noreferrer"&gt;https://github.com/manjularajamani/pyseccomp-playground/tree/main/seccompd-progs&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
