This document will guide you through the steps to install FreeBrowse locally and then deploy it to Azure.
- Node.js v20.x
- .NET Core SDK v7.0.x; do not use dotnet v8!
- Microsoft SQL Server 2022; v16.0.x
- Microsoft SQL Server Command line tools (optional)
Setup for node v20.x
sudo apt-get update
sudo apt-get install -y curl
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
Setup for Microsoft SQL Server:
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2022.list)"
sudo apt-get install -y mssql-server
Setup for .NET Core SDK 7.0.x (do not use v8!)
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
Install:
- node v20.x
- .NET Core SDK 7.0.x
- Microsoft SQL Serverv 2022 (16.0.x)
sudo apt-get install -y nodejs dotnet-sdk-7.0 mssql-server
Setup and install Microsoft SQL Server Command line tools (optional):
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo apt-get install mssql-tools18 unixodbc-dev
References:
- Install .NET SDK or .NET Runtime on Ubuntu
- Quickstart: Install SQL Server and create a database on Ubuntu
- Install the SQL Server command-line tools
git clone git@github.com:freesurfer/freebrowse.git
cd freebrowse
Navigate to the client-side directory, which is called ClientApp
:
cd src/WebUI/ClientApp/
npm install
- Open SQL Server Management Studio (SSMS).
- Connect to your SQL Server instance.
- Set the SQL server admin password
sudo /opt/mssql/bin/mssql-conf setup
- Select #2, Developer edition
- Enter the SQL Server system administrator password
- Update
appsettings.json
accordingly. It defaults to local development settings with a SQL Server system administrator password ofpaul!!!12345
Navigate back to the top level of the application and run:
cd src/WebUI
dotnet run
- The backend server will run on
http://localhost:5001
- The client-side app will run on
http://localhost:44444
- Open your browser and go to
http://localhost:44444
to view the application.
In the appsettings.json
file, there is a configuration named UseLocalStorage
. This setting determines where the application saves files.
- If
UseLocalStorage
is set totrue
, the application will save files on the local machine. - If
UseLocalStorage
is set tofalse
, the application will store files in Azure Blob Storage. Ensure that you've correctly set up and configured Azure Blob Storage in your application and provided necessary connection strings.
Ensure to choose the appropriate storage method depending on your application's needs and deployment scenarios.
- Visual Studio: Preferred for .NET development.
- Visual Studio Code: Lightweight editor suitable for JavaScript development.
- SQL Server Management Studio (SSMS): For managing and querying SQL Server databases.
- Built-in debugging in Visual Studio of Visual Studio Code: Utilize breakpoints, watch variables, inspect the call stack.
- Browser Developer Tools: For client-side debugging.
- Clone the Repository: Get the latest codebase from the repository.
- Branching: Create feature or bug-fix branches.
- Development: Make changes using the recommended IDEs.
- Code Review: Submit pull requests and have peer reviews.
- Merge and Deploy: Merge into the main branch and deploy to the desired environment.
cd src/WebUI
dotnet run
Press Ctrl + C
in the terminal where the service is running.
Stop the service as above and start it again using dotnet run
.
Use the debugging tools in the IDE, setting breakpoints and watching variables as needed.
- FreeBrowse: Main application repository, including the backend and client app.
- Niivue.Fork: Contains the our version of the niivue package
Note: You don't have to build the frontend project every time you make changes to it. Simply refresh your browser to see the updates.
- Frontend:
cd src/WebUI/ClientApp
npm run build
- Backend:
cd src/WebUI
dotnet build
- Typescript (v5.x.x)
src/WebUI/ClientApp
npx tsc
- Prettier (to fix linting errors)
npx prettier --write src/to/file/ThrowingLintingErrors.ts
- Installed local Jupyter Notebook or access to online Jupyter Notebook instance
- Start Jupyter Notebook locally:
jupyter notebook
or
- Navigate to the online instance
Demos and more information on how to use ipyniivue can be found
- on GitHub
- Demo files
- An active Azure account
- Azure CLI installed
- Go to the Azure portal.
- Create a new SQL database and configure the firewall settings to allow connections.
- Note down the connection string.
Update the production section of appsettings.json
or use Azure's Application Settings for your app service to override the connection string with the one from your Azure SQL database.
In your terminal or command prompt, from the project directory: dotnet publish -c Release
-
First, log in to Azure CLI:
az login
-
Create a resource group:
az group create --name <your-resource-group-name> --location <preferred-location>
-
Create an Azure App Service plan:
az appservice plan create --name <your-app-service-plan-name> --resource-group <your-resource-group-name> --sku B1 --is-linux
-
Create a web app:
az webapp create --resource-group <your-resource-group-name> --plan <your-app-service-plan-name> --name <your-app-name> --runtime "DOTNET|5.0" --deployment-local-git
-
Set up local git deployment:
az webapp deployment user set --user-name <username> --password <password>
-
Push to Azure from your local git:
git remote add azure <deployment-local-git-url-from-previous-step> git push azure master
Go to https://<your-app-name>.azurewebsites.net
in your browser.