AsifMushtaq / Workshop.Microservices

Microservices with NServiceBus workshop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Microservices workshop (with examples in NServiceBus)

Please ensure you have prepared your machine well in advance of the workshop. Your time during the workshop is valuable, and we want to use it for learning, rather than setting up machines.

If you have any difficulty preparing your machine, or following this document, please raise an issue in this repository ASAP so that we can resolve the problem before the workshop begins.

Demos

The demos folder contains demos used during the workshop by your trainer.

Services UI Composition demo

The asp-net-mvc solution demonstrates the use of ASP.NET MVC 5 to compose a UI with data from several microservices.

Preparing your machine for the workshop

Install the pre-requisites

To complete the exercises, you require a Windows machine and Visual Studio. Please ensure you have followed these steps:

  • Install Visual Studio 2017 or Visual Studio 2015 Update 3 (the "Community" edition is enough).

  • If you have a full SQL Server instance installed, you can choose to use that for the exercises. Otherwise, you will be using LocalDB. In the case of a clean machine with LocalDB only, please install:

    NOTE: Do not install versions 13.1 of these components as they contain a bug that prevents the LocalDB instance from being accessible at configuration time.

  • Set the PowerShell execution policy to allow script execution. From an elevated PowerShell prompt, run the following:

    Set-ExecutionPolicy Unrestricted

Get a copy of this repository

Clone or download this repo to your local machine.

If you're downloading a zip copy of the repo, please ensure the zip file is unblocked before decompressing it:

  • Right-click on the downloaded copy
  • Click "Properties"
  • On the "General" properties page, check the "Unblock" checkbox
  • Click "OK"

Run the Particular Platform Installer

To ensure MSMQ and the DTC are correctly installed, please run the Particular Platform Installer. In the installation screen, select a minimum of:

  • "Configure MSDTC for NServiceBus"
  • "Configure Microsoft Message Queuing"

All other components are optional.

Set up the databases

When using LocalDB

The simplest way to manage the databases is to use the PowerShell scripts located in exercises/scripts.

These scripts must be run from an elevated PowerShell prompt.

  • Run Setup-Databases.ps1 to create a LocalDB instance named (localdb)\microservices-workshop, containing all the required databases.

When you have finished the workshop, you may optionally run Teardown-Databases.ps1 to drop all the databases and delete the LocalDB instance.

NOTE: If you receive errors regarding "Microsoft ODBC Driver", you can work around these by connecting to the (localdb)\microservices-workshop database using, for example, Visual Studio or SQL Managerment Studio, and running the SQL contained in the .sql file (Setup-Databases.sql or Teardown-Databases.sql) corresponding to the .ps1 file which raised the error.

NOTE: If the setup script fails with a "sqllocaldb command not found" error, your machine may be missing some files related to LocalDB. To fix this, try installing the LocalDB standalone package and then re-run the script.

When using a full SQL Server instance

Connect to the instance and run exercises\scripts\Setup-Databases.sql.

When you have finished the workshop, you may optionally run Teardown-Databases.sql to drop all the databases.

NOTE: If you are using a full SQL Server instance, you will need to change the connection strings in all the exercises. Change all instances of Data Source=(localdb)\microservices-workshop to point to the full SQL Server intsance.

Restore the NuGet packages

The exercises are contained in eight Visual Studio solutions under exercises. All the solutions require NuGet package restoration before building. This may be possible at the workshop venue (you can verify with the workshop organizers if internet access is available at the venue) but to ensure you can build the solutions during the workshop, we recommend you run NuGet package restore before the workshop. The simplest way to do this is to open each of the solutions and build them, which will automatically restore the NuGet packages.

Running the exercise solutions

  • Before you run a given exercise solution, configure the startup projects listed in the instructions for that exercise:
    • In Visual Studio, right click the solution in the Solution Explorer
    • Click "Properties"
    • Ensure that, in the left hand pane, "Common Properties", "Start Project" is selected.
    • Select the "Multiple startup projects" radio button
    • Set the "Action" for each project listed in the instructions for the exercise to "Start".
  • Press F5 in Visual Studio. The exercise solution will now be running and be fully functional.

Note

The solutions contain single page applications (SPAs) and use IIS Express. To prevent caching issues, before switching to another exercise:

  • Ensure that IIS Express is shut down
  • Clear the browser cache (or disable it entirely). Alternatively, the cache can cleared by refreshing the page using Shift+F5 or Ctrl+Shift+R in some browsers.
  • When running a solution, the wrong page is sometimes displayed in the browser. Either:
    • Ensure all HTML template files are closed when the application is run, or:
    • Manually change the browser address to the root URL.

FAQ

If the answer to your question is not listed here, consult your on-site trainer.

How can I clear the orders list?

The simplest method is to reset all the databases (see below). Bear in mind that this will reset all the databases for all the exercises.

Alternatively, if you want to clear the orders list for a specific exercise, connect to the SQL Server instance, and either pick out and run the drop and create statements for that exercise from the scripts, or manually delete, or truncate, the tables that need to be cleared.

To reset all the databases:

When using LocalDB

Using an elevated PowerShell prompt, run Teardown-Databases.ps1 followed by Setup-Databases.ps1, both located in the exercises/scripts folder.

When using a full SQL Server instance (or LocalDB)

Connect to the instance and run Teardown-Databases.sql followed by Setup-Databases.sql, both located in the exercises/scripts folder.

About

Microservices with NServiceBus workshop

License:Apache License 2.0


Languages

Language:C# 77.2%Language:JavaScript 16.3%Language:HTML 5.6%Language:ASP 0.4%Language:CSS 0.4%Language:PowerShell 0.1%