Skip to content

CompositionalIT/safe-search-3

Repository files navigation

Demo

You can see it running on Microsoft Azure at https://safesearch.azurewebsites.net/.

Install pre-requisites

You'll need to install the following pre-requisites in order to build SAFE applications

Azure Services pre-requisites

You'll need to following Azure resources provisioned (these get created automatically by runing dotnet run Azure):

  • An Azure Storage account with:
    • a container called properties.
    • a table called postcodes.
  • An Azure Search instance with:
    • an index created via Management.createIndex.
    • a data source created via Management.createBlobDataSource.
    • an indexer created via Management.createCsvIndexer.
  • Postcodes should be inserted into table storage before properties are imported
    • The fastest way to import these is to use AzCopy 7.3 - (Windows only) then run the following command:

      AzCopy.exe /Source:https://compositionalit.blob.core.windows.net/postcodedata /Dest:https://{YOUR_STORAGE_ACCOUNT}.table.core.windows.net/postcodes2 /DestKey:{YOUR_ACCESS_KEY} /Manifest:postcodes /EntityOperation:InsertOrReplace
    • Alternatively you can use Azure Storage Explorer - (Windows, Mac, Linux) and do the following steps.

Getting started

Before you run the project for the first time only you must install dotnet "local tools" with this command:

dotnet tool restore

Running in Azure (preferred)

Set the names for web app, Azure Search, and storage instances, as well as the path to AzCopy in Build.fs:31-34. Navigate to the folder containing the code (e.g. C:\safe-search-3\) and run the following command to deploy the app to Azure:

dotnet run Azure

The first time you do the deployment it will automatically populate the postcodes and properties (this may take a while).

Running locally

Requirements:

  • This requires an Azure Search instace deployed to Azure
  • Azurite set up locally

You should also set the following config settings either as environment variables or in user secrets

{
    // Azure Search resource name
    "searchName": "my-azure-search",
    // Azure Search access key (Search service > Keys > Primary admin key)
    "searchKey": "MYSECRETKEY",
    // Azure Storage account connection string
    "storageConnectionString": "DefaultEndpointsProtocol=https;AccountName=mystorageaccount;AccountKey=MYSECRETKEY"
}

To concurrently run the server and the client components in watch mode use the following command:

dotnet run

Then open http://localhost:8080 in your browser.

The build project in root directory contains a couple of different build targets. You can specify them after -- (target name is case-insensitive).

Finally, there are Bundle and Azure targets that you can use to package your app and deploy to Azure, respectively:

dotnet run -- Bundle
dotnet run -- Azure

SAFE Stack Documentation

If you want to know more about the full Azure Stack and all of it's components (including Azure) visit the official SAFE documentation.

You will find more documentation about the used F# components at the following places:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages