Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Cloud installation on Azure

Steven Thewissen edited this page May 19, 2018 · 1 revision

The primary way to run the Mynt bot is by hosting it on Windows Azure. This is how it was originally designed to work but there are other ways to run it as well. This article describes setting up the bot to run on Windows Azure. If you don't have an Azure account yet, create one for free now!

Prerequisites

Azure Functions Tools is included in the Azure development workload of Visual Studio 2017 version 15.5, or a later version. Make sure you include the Azure development workload in your Visual Studio 2017 installation:

Make sure that your Visual Studio is up-to-date and that you are using the most recent version of the Azure Functions tools.

Other requirements

To create and deploy functions, you also need:

  • An active Azure subscription. If you don't have an Azure subscription, free accounts are available.
  • An Azure Storage account. To create a storage account, see Installation.

Check your tools version

  1. From the Tools menu, choose Extensions and Updates. Expand Installed > Tools and choose Azure Functions and Web Jobs Tools.

  1. Note the installed Version. You can compare this version with the latest version.
  2. If your version is older, update your tools in Visual Studio as shown in the following section.

Update your tools

  1. In the Extensions and Updates dialog, expand Updates > Visual Studio Marketplace, choose Azure Functions and Web Jobs Tools and select Update.

  1. After the tools update is downloaded, close Visual Studio to trigger the tools update using the VSIX installer.
  2. In the installer, choose OK to start and then Modify to update the tools.
  3. After the update is complete, choose Close and restart Visual Studio.

Installation

Creating the Azure resources for Mynt

When your account is activated you can visit the Azure Portal and start using your subscription! To run the Mynt bot it is advised to run it in a Resource Group. This is a grouping that enables you to separate different things you're running in Azure into logical groups.

To create a Resource Group you need to provide a unique name. You can also decide where in this big world we live in your bot is running. Pick a location that matches your actual location and create the resource group.

Next up we need to create a few additional things:

  • A Functions App that will hold our Azure Functions code
  • A Storage Account that will hold our logging and serve as a data storage for our trade data

Hit the add button in your Resource Group and add a Functions App. When creating the Functions App you are also able to create the Storage Account right there on the spot. The Service Plan you see in the screenshot above is also created as soon as you create a Functions App. This should be everything you need to set up on the Azure side of things.

Publishing Mynt to Azure

I'm no fan of letting people right click > Publish in Visual Studio, however it is one of the simpler methods of deploying an Azure Functions project.

  1. In Solution Explorer, right-click the project and select Publish. Choose Create New and then Publish.

  1. If you haven't already connected Visual Studio to your Azure account, select Add an account....

  2. In the Create App Service dialog, use the Hosting settings as specified in the following table:

  1. Click Create to create a function app and related resources in Azure with these settings and deploy your function project code.

  2. After the deployment is complete, make a note of the Site URL value, which is the address of your function app in Azure.

Configuration

When running on Azure you do not have a configuration file at your disposal. In the project there is a local.settings.json file available that holds your settings but when deployed to Azure this file is no longer used. Instead the Application Settings part of the Azure Functions hub is used to store your settings. You can reach this by going to your Azure Functions > Platform Features > Application Settings.

Adding settings

When you get to the application settings you see a list of current available settings. This is where you manually have to add the settings that you have set in your local.settings.json.

Not all the settings you have in your local.settings.json need to be added here. You only need to specify the settings that you want to change from the default values provided in the Options classes throughout the project.

Required settings

One setting that you have to add for the bot to work is the BindingRedirects setting. Set it to the following value:

[ { "ShortName": "Newtonsoft.Json", "RedirectToVersion": "11.0.0.0", "PublicKeyToken": "30ad4fe6b2a6aeed" } ]

Another required setting is the Exchange you want to use. These have to be paired with the appropriate ApiKey, ApiSecret and PassPhrase. Set these to the values you received from the exchange you're using. Not all exchanges need a PassPhrase, so set it to a dummy value if you don't receive this from your exchange. The available exchanges are listed in the Exchange enumeration in the project.