Setting up A Jitsi Meet Server on Azure

With the COVID-19 pandemic going on, video chat is on the rise, with people using tools like Zoom, WebEx, and others. One option is to use an open-source solution like Jitsi Meet, which provides both a public cloud version you can use easily, and a version you can host on your own.

Why host on your own? You should consider hosting on your own if:

  • You’re concerned with security – hosting the software on your own ensures a third part is uninvolved.
  • You want more hands on capability to change the specs on the server for performance based on when you’re using video software.
  • You can control the location of the hardware, which depending on where everyone is located, may improve performance.

Server Creation and Jitsi Installation

First, create an Azure VM with the following:

  • Running Ubuntu
  • Open inbound ports 80, 443, and 22.
  • SSH key access (recommended)

Once the VM is created, SSH into the server and install the Jitsi full suite:

wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add -

sudo sh -c "echo 'deb https://download.jitsi.org stable/' > /etc/apt/sources.list.d/jitsi-stable.list"

sudo apt-get -y update

sudo apt-get -y install jitsi-meet

when installing, you’ll be asked to configure jitsi-videobridge2, use the URL you plan to use for this Jitsi instance. Afterwards, generate a self-signed certificate (we’ll create one with Let’s Encrypt later).

To verify installation worked successfully, visit the IP address in a browser, making sure you use HTTPS.

Set up SSL with Let’s Encrypt

To set up SSL, you’ll need to set up a domain name for the server in place – you can either:

  • Configure the Public IP assigned by Azure to create a domain name.
  • Using the process above, but also creating an A or CNAME record for a purchase domain pointing to the server IP

Once this is done, you can run the following to automatically create a cert:

sudo /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh

Reference

https://github.com/jitsi/jitsi-meet/blob/master/doc/quick-install.md#advanced-configuration

Adding a Custom Method to a nopCommerce Core Service in a Plugin

In nopCommerce, you can extend a core service to include a new method and new functionality using both dependency injection and inheritance. For this example, we’ll use TaxService provided in Nop.Services.

Implementation

First, create a new interface in your plugin that inherits from the core service interface:

// ICustomTaxService.cs

using Nop.Services.Tax;

namespace YourNamespace
{
    public interface ICustomTaxService : ITaxService
    {
        void YourCustomMethod(); 
    }
}

After creating the interface, create the implementation class, inheriting from both the newly created interface and the base service:

// CustomTaxService.cs

namespace YourNamespace
{
    public class CustomTaxService : TaxService, ICustomTaxService
    {
        // constructor passing in all dependencies using base()
        public CustomTaxService(...) : base(...)
        
        public void YourCustomMethod() {
            // implementation here
        }
    }
}

Finally, make sure to connect the interface to the implementation in your plugin’s DependencyRegistrar.cs file:

class DependencyRegistrar : IDependencyRegistrar
{
    public int Order { get { return 1; } }

    public void Register(ContainerBuilder builder, ITypeFinder typeFinder, NopConfig config)
    {
        builder.RegisterType<CustomTaxService>().As<ICustomTaxService>();
    }
}

Usage

Once the above is created, you can reference the new service using the interface created (usually, this is done in a controller or a service):

private readonly ICustomTaxService _customTaxService;

public WarrantyTaxService(
    ICustomTaxService customTaxService
){
    _customTaxService = customTaxService;
}

// now use the service for anything you need!

Book Notes – Digital Minimalism

Digital Minimalism by Cal Newport lays out the benefits and then steps of using a more deliberate approach of selecting technology that benefits oneself. This book shares the same writing tone of Deep Work, providing a lot of examples for the different principles explained in the book.

Digital Minimalism is defined as “a philosophy of technology use in which you focus your online time on a small number of carefully selected and optimized activities that strongly support things you value, and then happily miss out on everything else.”

Overall, a pretty good read. For someone that generally follows Cal’s line of thinking, it was nice to read some of the examples (gives some inspiration) alongside the different ideas provided to balance between using technology for your own benefit and getting sucked into overuse.

Outline

The book provides a collection of steps that can be outlined below:

Digital Minimalism Principles:

  • Clutter is costly.
  • Optimization is important.
  • Intentionality is satisfying (intention trumps convenience)

Digital Declutter process – set aside all optional technologies for 30 days, then reintroduce them slowly into life after the habit for checking regularly disappears.

Digital Minimalism Practices:

  • Leave your phone at home
  • Take long walks (without headphones, use this time to think intentionally)
  • Write letters to yourself (process of writing more important than outcome)
  • Spent time alone (provides solitude)
  • Don’t click “Like” (prioritize high-value conversation vs. low-value communication, more below)
  • Consolidate texting
  • Fix or build something every week
  • Schedule your low-quality leisure
  • Join something
  • Follow leisure plans
  • Delete social media from your phone (just use on desktop/laptop)
  • Turn your devices into single-purpose computers (limit options available for general-purpose device at certain times)
  • Use social media like a professional (remember that social media companies spend millions to keep you invested as long as possible, get just the basic needs you need from it)
  • Embrace slow media
  • Dumb down your smartphone

Conversation vs. Communication

In her book Reclaiming Conversation, Turkle makes a distinction between:

  • High-value conversation, committed face to face conversation with others
  • Low-value communcation, asynchronous communication with others usually via digital means

This ties into the idea of staying away from something like “Likes” on social media – focus on dedicated conversations with others, which makes for a more fulfilling social life as a whole over trying to spread communication thin.

Personal thought: Interesting the idea that something like using social media makes you think you could miss out on what people are doing- but you can always reach out individually to the people you care about to check in!

Book Notes – The Shallows (What the Internet is Doing to Our Brains)

The premise of the book is that as we move into integrating the Internet into our lives more and more, we are shifting from thinking deeply and creatively on topics, to learning quickly on a surface level.

Brain Plasticity

The brain is capable of being rewired and redeveloped through-out the entirety of a human life – even if that ability slows down in age. This applies in many cases such as the loss of capabilities (blindness, loss of limb, etc.) – the gray matter will be rerouted in the brain to other functions.

Plasticity, however, means that as changes occur in a person’s thinking and interaction, they can have lasting effects on how the brain processes in the future. In a sense, we become how we think and practice.

Connection to Medium

In writing and creation, there is a sort of tie-in that correlates to the medium being used to express. For instance, the way a book is written will change if the book is written online (where hyper-linking is available) or written in a paper-back book.

Prime example in this when using a Kindle (which I usually use to read), you have the ability to go to different websites and look up words right on the device – therefore diverting from the general process of reading the book from start to finish (took a look while writing this – no way to turn that off on the Kindle unfortunately).

In the comparison to digital vs. print, there’s also the connection between mutable (digital) vs. immutable (print). This makes for a push of more speed vs. quality, as publishing has become more of an ongoing process. This could remove the pressure of perfection seen in writing an immutable novel.

Personal note: I don’t see the above as an issue, although I’m sure I’m biased being in software. In this case, I see it as more of a “perfect is the enemy of good”.

Internet as a Medium of Distraction

The Internet serves as a medium that promotes distraction, which comes from sources such as:

  • Social media (engineered to provide stimulus rewards for checking regularly, much like a rat pulling a lever)
  • Page layout (advertisements)
  • Pop-ups

This does potentially come with some benefit – because browsing the internet promotes a shallow and quick level of thinking, it can keep minds sharp. However, this can mean we become good to identifying information and losing the ability to think creatively (especially thinking our own thoughts) on particular topics. Neuropyschologist Jordan Grafman says “The more you multitask, the less deliberative you become; the less able to think and reason out a problem.”

The major issue comes into the difficulty of learning and processing when our cognitive load is increased by use of the Internet (cognitive load – information flowing into our working memory at any given moment). Essentially, we can only handle so much information (2-4 things max) at a time before our ability to absorb information is diminished, and the information just rolls off.

Memory Collection, Digital vs. Biological Memory

When making memories, we have two types:

  • Short-term – like RAM, in working thoughts
  • Long-term – like HDD, stored away in brain

Short-term memories become long term memories after a period of time and reinforcement, where they gain new context on each subsequent retrieval and storage.

This changes with technology – memories are stored with no context, and as they are, which can limit their usefulness.

Personal note: This is another I don’t necessarily see a negative. It’s been proven that human memory is flawed, and our long-term memory is tarnished over time, moving away from reality over time and becoming what we want to believe. Using technology to store memories is a way to ensure those memories can be viewed intact. Something like writing a journal can show the thoughts of a particular experience at the time, and seeing how they compare to the long-term memory stored.

Tool Usage and Dependence

When using tools to amplify output (using a calculator to perform simple math, or using physical tools to perform labor), this has a numbing effect on our ability to perform the task ourselves.

This can especially apply in the software we use when interacting with a computer. A study of different users for software using both helpful and unhelpful software showed “The subjects using the bare-bones software consistently demonstrated “more focus, more direct and economical solutions, better strategies, and better imprinting of knowledge.” The more that people depended on explicit guidance from software programs, the less engaged they were in the task and the less they ended up learning.”

This reflects in the way we search for information – we use tools that provide easy results without contemplation on our end, limiting the amount of creativity we can apply to our work.

Book Notes – Deep Work by Cal Newport

Pretty good read overall – a lot of this is speaking to the choir with me in terms of the idea of working deeply on things, and applying focus. For someone not familiar with the benefits of something like deep work, it makes for a good explanation, and for someone already familiar, it provides some exercises and things to figure out the important things to work on.

By the time I read this, I was already doing a few of these things, like scheduling all of my time on a calendar, and weighing everything on a pro/con list. Some of the exercises (memorizing a deck of cards) seems extreme, and I think you can get a lot of this benefit with the calendar scheduling tactic alone.

I think the main theme I get from this book is the concept of deliberation, or being specific on how you use your time, alongside how you design your lifestyle.

The main thing I’m going to try is to cut down on social media even more than I already do. I already don’t use a lot of social media, but I’m going to try removing it completely for a month or two and see how I feel after.

Importance of Deep Work

We’re in a society that is grabbing shallow attention, and being able to work deeply will become a defining trait that will help make one valuable in the economy.

More focus on high-skilled workers being valuable (especially with automation on the horizon), and talents pools increasing with remote work capabilities.

Learning complex systems quickly is a deep work trait, which will become valuable over time.

Deliberation in Activity Selection

The book describes two approaches when selecting a new tool/process:

  • Any-Benefit – use the tool if any benefit can be found in use. Generally applies in cases where negatives of a behavior outweigh a smaller positive.
  • Craftsman – carefully deciding whether to incorporate a tool based on pros and cons.

To work with this, an exercise is provided to determine those activities:

  1. Identify the main high-level goals in life (family, career, friendships, etc.)
  2. Identify 2-3 most important activities for achieving said goals.

The important activities tend to provide in the 80/20 sense, in that they are much more productive uses of time, and should be focused on. Since your time and energy is a zero-sum game, it makes more sense to put as much time and effort as possible into those activities.

Planning Ahead

The book promotes a methodology of planning ahead, or scheduling every minute of your day (including leisure time) on your calendar which looks something like:

Schedule in blocks

This reinforces the zero-sum idea above, that you can really only do one thing at a time, and doing things bring an opportunity cost for other activities. It’s also recommended to do this with leisure time, meaning you choose ahead of time how you’ll spend your off-time.

Other Points of Interest

  • Attention residue – when switching between tasks, your mind will linger on the original task for some time. Optimize this by having a “shut-down” process and giving as long as possible uninterrupted blocks of time.
  • Deep work generally involves getting into the “flow” state, or losing track of time and feeling effortless in efforts put towards a task. The human mind thrives in this state.
  • Good intentions to work deeply are not enough – it’s important to set yourself up for success. “It’s not the will to win that matters-everyone has that. It’s the will to prepare to win that matters.”
  • Important to expose yourself to hubs to gain new information, but then have spokes to be able to perform deep work as required.
  • To be able to perform deep work well, you’ll need to also have moments of disconnection – when you’re working, work. when you’re done, be done completely.
    • This issue with heightened with our ability to access stimuli at any moment, to make sure we never get bored. Put away your phone and just sit during moments of idleness.
  • Productive meditation – A period where you’re occupied physically but not mentally (walking), giving the opportunity to focus on a single problem.

Set up nopCommerce 4.2 on a Linux Azure VM

Infrastructure Setup

First, create a Ubuntu-based VM, opening ports 80, 443, and 22.

Afterwards, create an Azure SQL Database.

VM Configuration

Once all of the infrastructure is created, set up a DNS record for the public IP created for the VM to make access easier.

Next, SSH into the VM using the domain name created above. Run the following commands to install the .NET Core runtime and SDK:

wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install aspnetcore-runtime-2.2 dotnet-sdk-2.2

Next, install and enable nginx:

sudo apt-get install nginx
sudo systemctl enable nginx
sudo systemctl start nginx

Edit /etc/nginx/sites-available/default:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    server_name   YOUR_DOMAIN.com;

    location / {
        proxy_pass         http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }
}

Finally, restart NGINX:

sudo systemctl restart nginx

Set up NopCommerce

This step will lay out the process of downloading the NoSource version of nopCommerce and getting it running.

If you have a custom copy of nopCommerce from source, you would publish it and use the output here instead.

If starting from scratch, run the following:

sudo wget https://github.com/nopSolutions/nopCommerce/releases/download/release-4.20/nopCommerce_4.20_Source.rar

sudo apt-get install unrar -y
mkdir nopSource
unrar x nopCommerce_4.20_Source.rar nopSource

cd nopSource/src
dotnet clean -c Release
dotnet build -c Release

cd Presentation/Nop.Web
sudo mkdir /var/www/nop
sudo dotnet publish -c Release -o /var/www/nop

cd /var/www/nop
sudo mkdir bin
sudo mkdir logs

cd ..

sudo chown -R www-data:www-data nop/

Now create the nopCommerce service by creating file /etc/systemd/system/nop.service:

[Unit]
Description=nopCommerce

[Service]
WorkingDirectory=/var/www/nop
ExecStart=/usr/bin/dotnet /var/www/nop/Nop.Web.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=nop
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target

Enable the above service:

sudo systemctl enable nop.service
sudo systemctl start nop.service

Once this is all set, you should be able to install the store, using the Azure SQL Database created above. When installing, you may want to use the connection string provided by Azure:

While installing, you’ll likely see a 504 timeout from NGINX – this is okay, just give some time for the installation to finish, and you should be able to eventually see the store front.

Set up SSL using Let’s Encrypt

To set up Let’s Encrypt, follow the Certbot directions, making sure to enable auto-redirect.

Afterwards, make the following change to the appsettings.json file:

"Hosting": {
    //Set to "true" the settings below if your hosting uses a load balancer$
    "UseHttpClusterHttps": false,
    "UseHttpXForwardedProto": true,

Restart the NopCommerce service and ensure you can view the front page without an SSL warning.

Set up Auto-Renewing Let’s Encrypt Certificates on App Service Linux

Set up the ability to assign auto-renewing Let’s Encrypt certs to an Azure App Service Linux instance with shibayan’s appservice-acmebot. This will create a Function App that automatically updates the App Service as needed.

Before getting started, you’ll need to have a few things:

  • An Azure App Service (Linux-based).
  • DNS records being served using Azure DNS.

Procedure

First, deploy the solution to your Azure subscription. Use the following for configation:

  • Resource group – certbot-rg
  • App Name Prefix – certbot-fa
  • Mail Address – your email address.

Next, set up the ability for the Certbot function app to access your Linux App Service

  • Select ‘App Service Authentication’ to on.
  • Set ‘Log in with Azure Active Directory’
  • Set up the ‘Azure Active Directory’ Auth Provider
    • Set Management mode to ‘Express’
    • Create a new AD app
  • Save changes.

Now, assign the Website Contributor and Web Plan Contributor roles to the Certbot function app:

Finally, restart the function app and access the Function App URL (https://your-function-app.azurewebsites.net/add-certificate). You should be able to see the UI showing the available RGs and App Names available (access can take 30-60 minutes to reflect in Azure, so if you’re seeing a 401, wait a while for things to resolve):

Once the certificate is added, you’re all set! Renewals will automatically occur, as the app will scan regularly to check when to renew the certs.

Quickly Work With Graylog Streams Using the API

When using Graylog, you may run into a case where you’re making a large number of streams to organize data. A quick way to do this is to use the API to programmatically add the streams to the system quickly.

Authorization

For authorization, you can use Basic Auth with your username and password.

You can also create an access token to allow access for individual systems.

Interact with API

Use the GET endpoint to get the streams payload:

https://YOUR_GRAYLOG_ENDPOINT/api/streams

Grab one of the streams and format the payload to use for the POST endpoint, and then insert the streams using the API.

You can check the API browser for more endpoints at https://GRAYLOG_ENDPOINT/api/api-browser.

Setting up my Android Device

Initial Setup

First, go through the default setup, connecting to Wi-Fi and Google.

Turn off backup to Google Drive.

Set up all of the methods of accessing phone (face recognition, etc.)

Configuration

  • Turn on night mode.
  • Set resolution to max.
  • Set navigation bar to full screen gestures
  • Show battery percentage
  • Set sound mode to vibrate

Turn off Bixby home.

Install the following apps from the Play Store:

  • Outlook (login, turn off notifs, swipe right delete, turn off focused inbox, week start Monday, set calendar widget)
  • Firefox (sign in)
  • Messenger (sign in, turn on dark mode, turn off chat bubbles)
  • Dropbox (sign in)
  • Instagram (sign in)
  • Netflix (sign in)
  • YNAB (sign in)
  • Slack (sign in)
  • Fly Delta (sign in)
  • Ecobee (sign in)
  • Fi (sign in)
  • Fitbit (sign in)
  • WhatsApp (sign in, turn off notifs)

Configure the following:

  • Youtube (turn on dark mode)

Uninstall the following:

  • Duo
  • Drive
  • Galaxy Wearable
  • Google Play Movies & TV
  • Kids Home
  • Photos
  • Samsung Global Goals
  • Samsung Health
  • Samsung Pay
  • Smart Switch
  • SmartThings
  • Spotify