Category: TILT

TILT–HealthCheck–part 8

Read about https://docs.microsoft.com/en-us/azure/architecture/patterns/health-endpoint-monitoring

In ASP.NET Core it is easy to add health checks to your web application.

I have added for Sqlite in the release and for SqlServer in the Azure.

This is the code

bool IsBuildFromCI = new XAboutMySoftware_78102118871091131225395110108769286().IsInCI;
//more code
builder.Services
     .AddHealthChecksUI(setup =>
     {

         var health = "/healthz";
         if (IsBuildFromCI)
         {
             health = builder.Configuration["MySettings:url"] + health;
         }
         setup.AddHealthCheckEndpoint("me",health );
         setup.SetEvaluationTimeInSeconds (60*60);
         //setup.SetHeaderText
         setup.MaximumHistoryEntriesPerEndpoint(10);
     }
        
    )
     .AddInMemoryStorage()
     ;

//more code
app.MapHealthChecks("healthz", new HealthCheckOptions
{
    Predicate = _ => true,
    ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
});
app.MapHealthChecksUI(setup =>
{

});

You can see the result at

https://tiltwebapp.azurewebsites.net/healthz https://tiltwebapp.azurewebsites.net/healthchecks-api https://tiltwebapp.azurewebsites.net/healthchecks-ui

Also, you can monitor at Monitoring – health check. Also, it would help to see the logs in real time, at Monitoring – logstream

Tools used

AspNetCore.HealthChecks.Sqlite

AspNetCore.HealthChecks.SqlServer

AspNetCore.HealthChecks.UI

AspNetCore.HealthChecks.UI.Client

AspNetCore.HealthChecks.UI.InMemory.Storage

Visual Studio

TILT- ConnectionSecrets in Azure–part 7

There is relatively easy to use – just go to your web app in Azure, Configuration, ConnectionStrings and add your data.

This tutorial is based on the following article:

https://docs.microsoft.com/en-us/azure/app-service/tutorial-dotnetcore-sqldb-app

The .NET Core code is simple:

services.AddDbContext<MyDatabaseContext>(options =>
         options.UseSqlServer(Configuration.GetConnectionString(“AZURE_SQL_CONNECTIONSTRING”)));

Tools used:

https://portal.azure.com/

TILT–CI and CD–part 6

Because the Source Control is Github and has Actions when submitting the code, I use this.

Also, when creating an Azure WebSite , you can integrate with Github and he will add the yaml for you and the secrets to deploy

I have added also badge to see the result of the action in the readme file. Deploy to Azure build

For the moment , just swagger available to see that the deploy was successfull . Results at https://tiltwebapp.azurewebsites.net/swagger

Tools used:

https://portal.azure.com/#create/Microsoft.WebSite

Github Actions: https://github.com/ignatandrei/TILT/actions

TILT–CRUD API–part 5

It is true that usually you should not create CRUD API. In this case I was thinking that is faster just to have those already created and making the application later. More, the CRUD was created automatically – sgtarting from database.

Install the generator https://marketplace.visualstudio.com/items?itemName=ignatandrei.databasetocode in VS2022 , create a new solution

and then edit the connectionDetails.txt with the correct sql server name.

Tools used:

https://marketplace.visualstudio.com/items?itemName=ignatandrei.databasetocode

Visual Studio

TILT- tables–part 4

I will keep very simple the database schema.

I do not want for the moment an users table, so I just create

  1. a table with url

  2. a table with the tags
  3. a table with notes

Azure Data Studio

Trying Azure Data Studio – good point that it is integrated with Azure. Bad point – finding it misses diagrams – https://docs.microsoft.com/en-us/sql/azure-data-studio/faq?view=sql-server-2017#database-administration

Not good – I do prefer making relations between tables. I can drop later, but for now let’s go with SSMS

And this is the diagram conceived


Tools used:

Azure Data Studio Sql Server Management Studio

TILT- database–part 3

The Azure options for creating a database are enough to stay to think about:

I will create an Azure Sql Database – now more options

To choose one should evaluate deeply https://docs.microsoft.com/en-us/azure/azure-sql/database/features-comparison

And if you want to evaluate the cost, here are some prices: https://azure.microsoft.com/en-us/pricing/details/azure-sql-managed-instance/single/

I will go with Sql Managed instances

When creating , the admin password must be 16 characters long , contain numbers and non-alphanumeric characters, and must be different from the user password.

And the message is

“Deploying Managed Instance is a long running operation taking up to 6 hours to complete.”

So back to square 1 and create a Sql database.

Now must understand pricing – here is the link: https://docs.microsoft.com/ro-ro/azure/azure-sql/database/purchasing-models

This was fast – now I can access the database and create tables.

Tools used:

portal.azure.com

TILT–specifications –part 2

This is an application to store what I have learned today / each day .

It will be one note string per day , note will be no more than 140 characters.

It has tags – programming, life, and so on. Can add one link to the note.

Can be saved on local ( desktop, mobile )or on cloud ( site). If wanted will be sync by having url part and password

Will have a calendar to see every day what have I learned – missing days will have an red X

Reports:

Can be exported by date end -date start into Excel Word PDF

Will show what you have learned one year before

Default are all public – if you want to be private , should pay or copy the application.

Tools used:

notepad

TILT–idea–part 1

I want to try a new generator from DB with Roslyn – so a new application should come. The name is TILT – Thing I Learned Today.

What it does

1. Let you put a TILT  per day ( and this is a tricky point, what is a day …). A TILT can have a subject ( later maybe tags and links)

2. Shows you all the TILTs

3. Maybe lets you export the TILTs for a period.

You can try the application at https://tiltwebapp.azurewebsites.net/ . It has also  swagger – https://tiltwebapp.azurewebsites.net/swagger and BlocklyAutomation – https://tiltwebapp.azurewebsites.net/BlocklyAutomation . If you want to try the API, use https://tiltwebapp.azurewebsites.net/BlocklyAutomation/automation/loadexample/authenticate

Busy with TILT

Just thinking to a new application –  TILT – Things I Learned Today . It will allow me to verify Database 2 Code – an sample project – and many of Roslyn Source Code Generators. If you want to participate, just let me know.

It will be on Azure as most as possible – and with applications deployed to all major stores ( Microsoft,  Google, Apple)

I will post the progress here.

Andrei Ignat weekly software news(mostly .NET)

* indicates required

Please select all the ways you would like to hear from me:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.