Scott Hanselman

What is the cloud? Explained

September 11, 2020 Comment on this post [3] Posted in Musings
Sponsored By

I'm continuing my "Computer Stuff They Didn't Teach You" series on YouTube. Please subscribe! I've set a personal goal to get to 100k subs by Christmas.

This episode is very special as it features a Surface Duo *AND* a 1U Rack-Mounted Azure Stack Edge! It's a gentle and clear explanation of cloud computing.

This 20 min video talks about the components of a computer, starting with a Raspberry Pi, Laptops, Phones, Desktops, then moving up to a massively powerful Azure Stack Edge rack mounted device, until finally talking about the Cloud itself. It consists of millions and millions of computers all working together to make the world turn.

You may know all these things BUT you may also enjoy some of the analogies to explain to non-technical partner how the cloud works as well as "what exactly it is you do!?"

I hope you enjoy watching it as much as I enjoyed making it! Go subscribe now!


Sponsor: Never miss a beat with Seq. Live application logs and health checks. Download the Windows installer or pull the Docker image now.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

How to use a Raspberry Pi 4 as a Minecraft Java Server

September 08, 2020 Comment on this post [65] Posted in Gaming
Sponsored By

imageMy 14 year old got tired of paying $7.99 for Minecraft Realm so he could host his friends in their world. He was just hosting on his laptop and then forwarding a port but that means his friends can't connect unless he's actively running. I was running a Minecraft Server in a Docker container on my Synology NAS but I thought teaching him how to run Minecraft Server on a Raspberry Pi 4 we had lying around would be a good learning moment.

First, set up your Raspberry Pi. I like NOOBS as it's super easy to setup. If you want to make things faster for setup and possibly set up your Pi without having to connect a monitor, mouse, or keyboard, mount your SSD card and create a new empty file named ssh, without any extension, inside the boot directory to enable ssh on boot. Remember the default user name is pi and the password is raspberry.

SSH over to your Raspberry Pi. You can use Putty, but I like using Windows 10's built-in SSH. Do your standard update stuff, and also install a JDK:

sudo apt update
sudo apt upgrade
sudo apt install default-jdk

There are other Minecraft 3rd party Java Servers you can use, the most popular being Spigot, but the easiest server you can run is the one from Minecraft themselves.

Go to https://www.minecraft.net/en-us/download/server in a browser. It'll say something like "Download minecraft_server.1.16.2.jar and run it with the following command." That version number and URL will change in the future. Right-click and copy link into your clipboard We are going to PASTE it (right click with your mouse) after the "wget" below. So we'll make a folder, download the server.jar, then run it.

cd ~
mkdir MinecraftServer
cd MinecraftServer
wget https://launcher.mojang.com/v1/objects/c5f6fb23c3876461d46ec380421e42b289789530/server.jar
java -Xmx2500M -Xms2500M -jar server.jar nogui

You'll get a warning that you didn't accept the EULA, so now open "pico eula.txt" and set eula=true, then hit Ctrl-X and Yes to save the new file. Press the up key and run your command again.

java -Xmx2500M -Xms2500M -jar server.jar nogui

You could also make a start.sh text file with pico then chmod +x to make it an easier single command way to start your server. Since I have a Raspberry Pi 4 with 4g gigs of RAM and it'll be doing just this one server, I felt 2500 megs of RAM was a sweet spot. Java ran out of memory at 3 gigs.

You can then run ifconfig at and command line and get your Pi's IP address, or type hostname to get its name. Then you can connect to your world with that name or ip.

Running Minecraft Servers

Performance Issues with Complex Worlds

With very large Minecraft worlds or worlds like my son's with 500+ Iron Golems and Chickens, you may get an error like

[Server Watchdog/FATAL]: A single server tick took 60.00 seconds (should be max 0.05)

You can workaround this in a few ways. You can gently overclock your Pi4 if it has a fan by adding this to the end of your /boot/config.txt (read articles on overclocking a Pi to be safe)

over_voltage=3
arm_freq=1850

And/or you can disable the Minecraft internal watchdog for ticks by setting max-tick-time to -1 in your server's server.properties file.

We solved our issue by killing about 480+ Iron Golems with

/kill @e[type=minecraft:iron_golem]

but that's up to you. Just be aware that the Pi is fast but not thousands of moving entities in Minecraft fast. For us this works great though and is teaching my kids about the command line, editing text files, and ssh'ing into things.


Sponsor: Never miss a beat with Seq. Live application logs and health checks. Download the Windows installer or pull the Docker image now.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Synology DS1520+ is the sweet spot for a home NAS and a private cloud

September 04, 2020 Comment on this post [20] Posted in Reviews
Sponsored By

61fje6GaYKLMy long love of Synology products is well-documented. I checked my Amazon history, and I bought my Synology DS1511+ NAS in May of 2011! I have blogged about the joy of having a home server over these last nearly 10 years in a number of posts.

It's great to have a home server - it's a little slice of the cloud, in your home. I like home servers because while I trust the cloud, I trust a computer I can touch about 1% more than someone else's computer.

NOTE: When I review gadgets and products, I often use Amazon Affiliate Links. I donate the small amount I make from you using these links, Dear Reader, to my kids' charter school. Thanks for using and clicking these links to support!

Anyway, my Synology DS1511+ is about ten years old and it's working great but I am using it more and more and throwing more and more at it. It did have some challenges running a Minecraft Server recently, on top of all its other responsibilities.

I use Seagate 2TB disks and I run 4 of them in the 5 bay device, with a fifth drive as a hot spare. If a drive goes bad - which happens about every 2 to 3 years - the Synology will rebuild with the spare, then I pull the dead drive. I have two additional 2TB unopened Seagate Drives ready to go, so when this happens it's as close to a non-event as possible.

Synology is amazing

I have every digital photo and digital video and family document we've created since 1998. I've also got local backups of my Gmail from hanselman.com which goes back to before Gmail started when I was running my own POP3 mail server. It's all easily less than 5TB. Remember also that Google Takeout can get you Zips of all your data! Back. It. All. Up!

Twenty years of photographs

Fast forward to today and Synology came out with the Synology 5 Bay NAS DiskStation DS1520+. It's basically a ten year's newer clone of my 1511+ workhorse, updated and refreshed! It's WAY faster. It was immediately noticeable on startup. File access is faster, indexing is faster, my Docker images start faster.

Now, a little more money would get you a 6 bay NAS and just $150 will get you a 2 bay, but I love the size and power of a 5 bay for our home and my office. Four disks are for my array and 1 is that hot swap drive. I think that for small businesses or home offices five bays is the perfect size and price - about $600-700 USD.

The Synology 1520+ has 4 GbE network ports (which is nice with Link Aggregation in a busy house), supports two eSATA externals (I use one to backup the backup to a single disk, as I believe in the Backup Rule of Three and you should, too!) and works with any SATA drives, 2.5" or 3.5". One of the big reasons that attracted me to this update is that there's slots for 2 x M.2 2280 NVMe SSDs for caching. I put a 512G M.2 drive in there to accelerate file system access.

5 Drives in a Synology

If you want, you can have up to 15 drives using two DX517 drive expanders up to 240TB, but with just 4 slots and large drives like Seagate Ironwolf drives in the 10TB to 18TB range, storage is really a non-issue. I use Seagate 2TB drives because they're plentiful and like $50. We treat it like a massive infinite local disk in the house that everyone can talk to. We named it SERVER, so it's just \\SERVsynoER for everyone.

The Synology OS software is deep and broad and runs entirely in your browser. You'll figure it out very quickly as it's all windows and wizards. I am a fan of the Cloud Sync feature that I use to backup my Google Drive, Dropbox, and One Drive. Again, this is a level of paranoia, but damned if I'm gonna get locked out of my own data.

Synology Cloud Sync

The Synology HyperBackup goes in any direction using whatever cloud and whatever tools you are familiar with. You want Rsync? Cool. Want to backup to Azure or AWS? Cool.

Backup to Azure from a Synology

I was concerned that migrating would be hard or involved basically starting over from scratch, but since I was moving between two models in the same family (I was moving from a 1511+ to a 1520+, even 10 years later) It was literally just move the drives in order and boot up. Took 10 minutes. For movement between device families or to new drives there's at least three good options.

It was actually scarily simple, given there's ten years of history here. I moved the drives (maintaining order) and booted up the new 1520+ and was greeted with this screen:

Migrate your Synology

I clicked Migrate twice and was all set.

image

If you are migrating and upgrading, I'd be sure to read the section on HDD Migration and look closely at the table, considering your Source and Destination NAS models.

So far this new Synology is WAY snappier, runs Docker faster, can run Virtual Machines now (although in 8 gigs, only small utility ones), and the SSD cache has made browsing family photos whip fast. All in all, it feels like a 10 year refresh BUT it's the same size.

SSD Cache in a Synology

My home NAS is sitting quietly on a shelf in my office. The kids and spouse are having their PCs backed up in the background, family photos and DVD backups are all available easily (and there are Synology iPhone apps as well to view the files).

Synology devices specifically - and home NAS devices generally - are a great addition to techie homes. There's a bunch of 1st and 3rd party packages you can run on it to make it as much or little a part of your Home IT setup as you like. It can run DHCP and DNS, iTunes Servers, Mail, Chat Servers, or even their own web-based Office clients. Take a look at the Synology 1520+ if you're in the market for a home or business NAS. I'm looking forward to another 10 years with this NAS.


Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

It's 2020 and it is time for text mode with Gui.cs

September 02, 2020 Comment on this post [23] Posted in Open Source
Sponsored By

Nearly 16 years ago I complained that Windows is completely missing the TextMode boat. It's 2020 and it's TIME FOR TEXT MODE BABY.

I keep bumping into cool utilities made with Gui.cs. Miguel de Icaza made Midnight Commander (not Norton Commander, but evocative of it) and it's a joy.

Head out to an admin command prompt on your Windows 10 machine now and install it (assuming a recent Windows 10 build, you'll have winget):

winget install GNU.MidnightCommander

You run it with "mc" and even better if you've got Windows Terminal blinged out you'll be able bask in the ASCII COATED GLORY:

Midnight Commander is lovely

It works in WSL as well, since there's a Linux version with "apt install mc" so check that out, too!

Do YOU want to make apps like this? While Midnight Commander wasn't made with Gui.cs, it could have been. I spent YEARS making awesome text mode apps with TurboVision. Now we can make text mode apps with C#! There is even a complete Xterm/Vt100 emulator as well in the form of TerminalView.cs.

Is it hard? Nah! Go "dotnet new console" then "dotnet add package Terminal.Gui" and then copy these lines over the ones that are given you in Program.cs, then "dotnet run". Boom.

using Terminal.Gui;

class Demo {
static int Main ()
{
Application.Init ();

var n = MessageBox.Query (50, 7,
"Question", "Do you like console apps?", "Yes", "No");

return n;
}
}

There you go! You should go read about it now!

Do you like Console Apps?

If you want to see all the cool text controls you can use, check out the Terminal.Gui UI Catalog app and its source code.

Sure, it's not that new-fangled HTML, but let me tell you, you see these apps every day. The airport, the DMV, the mechanic, the doctor's office. Apps like these are FAST. It's useful to know that these kinds of apps exist...you'll never know when you might need to get back in to TEXT MODE!


Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Exploring the .NET Core library Coravel for Task Scheduling, Caching, Mailing and more

August 28, 2020 Comment on this post [17] Posted in DotNetCore | Open Source
Sponsored By

Coravel claims it is a "Near-zero config .NET Core library that makes Task Scheduling, Caching, Queuing, Mailing, Event Broadcasting (and more) a breeze!" A lovely claim, that is, in fact, true! It's open source and on Github at https://github.com/jamesmh/coravel so give Coravel a star!

Coravel is available on NuGet as a package - as are all things  - or you can also install it's helper CLI with a simple dotnet tool install --global coravel-cli. After this, using coravel easy, early, and often is as simple as:

coravel install

A nice teach that makes it easy, the coravel CLI adds the package reference, restores your project, and reminds you to set it up in ConfigureServices() in Startup.cs. A nice example of a thoughtful library that is trying to make onboarding simpler.

The Coravel CLI is also a nice scaffolder to get you started with item templates:

> coravel
Usage: coravel [options] [command]

Options:
-?|-h|--help Show help information

Commands:
event
install
invocable
mail

But what is it?

CoravelWith a somewhat vague name and a list of cool features that may not seem related, you may find yourself wondering WHAT is this and WHY do I need it?

When you start thinking about layering and responsibilities of real production software, you'll note that there are arguably some gaps in the BCL (Base Class Libraries) that .NET makes available, particularly as you move up into the Application Development space.

Scheduled jobs and tasks, simple emailing with Razor Templates, a lightweight event dispatcher, easily queueable background tasks are just some of the higher level primitives you'll find yourself wanting when creating business apps. Coravel collects those buildable elements and allows you to string them together very quickly.

For example, I'll create an "Invocable." Basically just a method that is more 'job-like.' It has business scope and I need to have it invoked later by some schedule or process within my app.

Here I'll register one in my Startup.cs.

services.AddScoped<SendNightlyReportsEmailJob>();

So I need to send a nightly report. That's an invocable thing, and it's also an IMailer because it mails things. Note the injected IMailer in the constructor. All very natural in ASP.NET Core, using Dependency Injection.

public class SendNightlyReportsEmailJob : IInvocable
{
private IMailer _mailer;
public SendNightlyReportsEmailJob(IMailer mailer)
{
this._mailer = mailer;
}

public async Task Invoke()
{
Console.WriteLine("NightlyReportMailable Started....");
await Task.Delay(10000);

// You could grab multiple users from a DB query ;)
var mailable = new NightlyReportMailable(new UserModel
{
Name = "Coravel is lovely!",
Email = "test@test.com"
});
await this._mailer.SendAsync(mailable);
Console.WriteLine($"NightlyReportMailable was sent at {DateTime.UtcNow}.");
}
}

Then I can have this mailed every evening with the Coravel Scheduler:

scheduler.Schedule<SendNightlyReportsEmailJob>().Daily();

But when, right? Easy:

scheduler
.Schedule<SendNightlyReportsEmailJob>()
.DailyAt(1, 30)
.Zoned(TimeZoneInfo.Local);

What if you have a task that needs to happen, but maybe it's either long-running or happening often. You don't want two tasks going at the same time, so PreventOverlapping! Clever.

scheduler
.Schedule<DoAThingOften>()
.EveryMinute()
.PreventOverlapping("DoAThingOften");

And that's just the scheduler. That mail you have to send? You can use Razor Pages to create reach HTML emails! That makes New User Sign Up, or Completed Order very easy to create. All self-contained in your app. I dig it.

Finally note that there's Pro paid version of Coravel that gives you a very professional UI for Jobs and Invocables, and allows you to visually configure your back-end job schedules. A nice way to support open source - especially when you start using it and really depending on it - is to explore very reasonable Pro licenses like those that Pro Coravel has. Impressive stuff, truly.

*I have no relationship with Coravel the project or the Pro licenses, I'm just a fan.


Sponsor: Suffering from a lack of clarity around software bugs? Give your customers the experience they deserve and expect with error monitoring from Raygun.com. Installs in minutes, try it today!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.