Infrastructure Setup for a LymeStack Based Web App

This guide is intended to walk you through setting up a new instance of a LymeStack based web application.

Assumptions

  1. Web Application will be called "My Company". This yields two working folders: MyCompanyApi for the .NET WebApi and my-company-angular-app for the Angular application.

  2. The registered domain is mycompany.com (fictitious for this example).

Resources Needed

You'll need 2 Windows Servers (or you can even get away with using Windows Professional Workstation software). The author of this guide has Windows 11 installed on a physical computer and then uses HyperV to host the DevOps / Test Server and an Azure hosted Virtual Machine to host the production environment. Your options are not limited to this, but utilizing Virutualization provides the added benefit of snapshots, which can be extremely useful in the case of a botched TeamCity or Octopus update or many other number of potential mishaps.

You will also need a SSL certificate installed on your server to enable the HTTPS protocol to secure your website traffic. For more information on how to obtain and install a SSL certificate on your server, see the SSL Certificate appendix document.

Server 1: DevOps / UAT Test Server

For instructions and documentation on how to set up a new DevOps / UAT Server, see the DevOps Server Setup Guide.

Server 2: Production Server

For instructions and documentation on how to set up a new Production Server, see the Production Server Setup Guide.


UAT Application Instance Setup

The following are the steps used to stand up a new insance of your LymeStack based application on the UAT Environment. To perform these steps, RDP to your DevOps UAT Windows server using a Remote Desktop client for Mac or mstsc.exe on in you are on a Windows computer.

Instructions for setting up the App in IIS Website

Follow the instruction on Configuring IIS to Host a LymeStack Based App on your UAT and Production Servers.

Setup Octopus Deployment Project

Navigate to your Octopus Deploy Dashboard at http://localhost:8081 (that's if you followed our guides to set up your Octopus instance).

Add a New Project in Octopus

  1. Go to the "Projects" menu and select "Add Project".
  2. A dialog will appear prompting you for the project name. In our example, I'm going to enter MyCompany to remain consistent with my naming conventions. Select "Use version control for this project" (recommended) if you are familiar with git and want to store your configuration settings in source control. If you select this option you will be prompted for your git repo and authentication info and prompt you to test the connection before allowing you to save the new project.
  3. Return to the Dashboard by clicking the "Dashboard" menu and click the newly created "MyCompany" project.

Define the WebApi Application Deployment Process

  1. Press the "Create Process" button.
  2. Answer the prompt "What type of step do you want to add?" with the "Package" option. An "Installed Step Templates" will appear. Select the "Deploy to IIS" option.
    1. Rename the step from "Deploy to IIS" to Deploy WebAPI.
    2. Enter the Target Tags for which to apply this deployment step. I usually enter the value webserver by default.
    3. In the Package section, you will be prompted for the Package ID. In our scenario, we would enter MyCompanyApi
    4. In the "IIS Deployment Type" section, select "IIS Web Application".
    5. A "Web Application Options" panel will appear as a result of the previous selection. Enter the following values:
      1. Parent Web Site Name: MyCompany
      2. Virtual Path: /api
      3. Physical Application Path: Select the "Package Installation Directory" option.
    6. In the "Application Pool" section:
      1. Application Pool Name: MyCompanyApi
      2. .NET CLR Version: Select the "No Managed Code" option.
      3. Identity: Select the "Custom User" option
      4. Username: Enter the name of your IIS Service account. In our example that value is: iis
      5. Password: Press the little link icon next to the password field to "Bind to a variable". The password field will change into a text-area field. Enter the value: #{IisAppPoolPassword}. NOTE: If you are not using Version Control for your Octopus configuration, you can just enter the iis user password directly into this field without binding to a variable as long as the password is the same for all environments.
    7. Scroll down and click the "Configure features button" and select "Structured Configuration Variables" checkbox and then the "OK" button to return the Process Editor.
    8. Scroll up slightly and you will see a new section titled "Structured Configured Variables" with a single text-area input field titled "Target files". Enter the value: appsettings.json
    9. Start IIS Application Pool should already be checked. Leave that on.
    10. Press the "Save" or "Commit" button. If committing changes to git, enter a description of the change prior to committing the change.

Define the Angular Application Deployment Proces

  1. From the Proces Editor (you should already be there at this point), click the "Add Step" button.
  2. Answer the prompt "What type of step do you want to add?" with the "Package" option. An "Installed Step Templates" will appear. Select the "Deploy to IIS" option.
    1. Rename the step from "Deploy to IIS" to Deploy Angular App.
    2. Enter the Target Tags for which to apply this deployment step. I usually enter the value webserver by default.
    3. In the Package section, you will be prompted for the Package ID. In our scenario, we would enter MyCompanyAngularApp
    4. In the "IIS Deployment Type" section, select "IIS Web Application".
    5. A "Web Application Options" panel will appear as a result of the previous selection. Enter the following values:
      1. Parent Web Site Name: MyCompany
      2. Virtual Path: /app
      3. Physical Application Path: Select the "Package Installation Directory" option.
    6. In the "Application Pool" section:
      1. Application Pool Name: MyCompanyApp
      2. .NET CLR Version: Select the "No Managed Code" option.
      3. Identity: Select the "Application Pool Identity" option (the Angular App doesn't need to authenticate directly with any network resources).
    7. Press the "Save" or "Commit" button. If committing changes to git, enter a description of the change prior to committing the change.

Optional - Configure Git Change Log

Documentation for this is coming soon...

Configure Project Variables

  1. Navigate to the "Project Variables" menu on the left aligned menu.
  2. Press the "Create Variables" button to begin creating variables for the project.
  3. Edit the following variables:
    1. ApiConfig:Environment - UAT for UAT envornment, Staging for the Staging environment (if applicable). and Production for the production environment.
    2. IisAppPoolPassword - Enter the value of your iis account's user passord and select 'Sensitive' as the variable type to hide the password when editing the project for security.
    3. Mail Settings - for the Production environment.
      1. emailSettings:useSmtpPickup - false
      2. emailSettings:enableSsl - true or false depending on your app's SMTP server settings.
      3. emailSettings:smtpServer - specify the hostname or IP address for the app's SMTP Server.
      4. emailSettings:port - specify the port number.
      5. emailSettings:username - If authentication is required for your app's SMTP Server, enter the username here.
      6. emailSettings:password - If authentication is required for your app's SMTP Server, enter the password here.

Setup Database

This section of the documentation could probably be improved...

Create AppData and SmtpPickup Data Directories

By default the following directories must be present on the web servers:

Next you are ready to configure the project's build process in TeamCity.