A virtual reality (VR) application life cycle (ALM) management utility written for the Google Daydream and targeting Trello.
This repository contains the server component of AlmVR. The server is responsible for managing the connection to the ALM products that AlmVR uses as its backend (ie Trello).
The server component is written in C#
using .NET Core
, ASP.NET Core
, and SignalR
. The server is written with a plugin architecture that allows the ALM platforms (i.e. Trello) to be replaced without having to modify any of the clients.
Plugins are a .NET Standard
or .NET Core
assembly that contain a class which implements AlmVR.Server.Core.IPlugin
. The implementations of IPlugin
then register their own implementations of the core providers, which reside in the AlmVR.Server.Core.Providers
namespace, with Autofac
. An example plugin for Trello can be found in the AlmVR.Server.Providers.Trello
project.
Plugins are located by looking for a Plugins
directory in the same directory as the executable for the server. An implementation of this strategy can be seen below.
private static IEnumerable<Assembly> GetAssemblies()
{
var exeLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
var pluginLocation = Path.Combine(exeLocation, "Plugins");
return Directory.GetFiles(pluginLocation, "*.dll", SearchOption.AllDirectories)
.Select(path => AssemblyLoadContext.Default.LoadFromAssemblyPath(path))
.Where(x => x != null)
.Select(x => x.GetTypes())
.SelectMany(x => x)
.Where(x => x.GetInterfaces().Contains(typeof(IPlugin)))
.Select(x => x.Assembly)
.Distinct()
.ToArray();
}
The server uses web sockets implemented by SignalR
for real time communication with each client. This allows the server to be able to push updates to the client without the clients polling the server for updates, thus increasing efficiency. The hubs for SignalR
reside in the AlmVR.Server.Hubs
project.
The Trello plugin requests data from Trello using its REST API
. It also sets up a ASP.NET Core MVC
controller to receive responses from Trello using webhooks. Webhooks are registered with Trello upon the first request of a Trello card. In order for this to function correctly, Trello must be able to hit the controller with a HEAD
request. This requires the server to be public facing. When Trello calls a webhook, the server responds by raising an event on the clients using SignalR
.
The build for the server generates a Docker
container and pushes to a public facing repository.
The server (as well as the remainder of AlmVR) is built using Cake Build
run in AppVeyor
. The build executes the following on every commit that is pushed to GitHub:
- A clean of all of the build files.
- Generate the version number using Nerdbank.GitVersioning.
- Build the server using the dotnet CLI.
- Publish the server to the local file system using the dotnet CLI to prepare it to be packaged for consumption within a Docker container.
- Copies the plugins from step 4 into the published server directory.
- Builds a Docker container based on Alpine Linux.
- Pushes the Docker container to a public repository for consumption by the virtual private server (VPS) that hosts the container.
- Auto deploys to a VPS.
The choice to create a Client-Server
architecture instead of a Peer-to-Peer
architecture was made in order to ensure that the plugins only had to be installed and configured in a single location.
Another motivation for the Client-Server architecture is to support Trello's webhooks, since they need to be a web service that responds to HEAD
and PUT
.
The choice to implement a plugin architecture was made so that the project could easily be adopted to use other ALM platforms (ie Azure DevOps, Jira, etc).
The continuous integration build script was put together to facilitate deployments of the server binaries without connecting to the VPS manually.
- Beta software - During development, we started with beta versions of
.NET Core
,ASP.NET Core
,SignalR
. These dependencies saw their APIs change during development. - Public facing server for Trello webhooks - It was necessary for Trello to be able to hit our server, so it needed to be public facing. This prevented us from being able run/deploy the server from the lab necessitating significant build efforts.
- Initially
AppVeyor
did not support Linux builds, so it was not possible to build the project and deploy to our VPS usingAppVeyor
. We ended up setting upTravisCI
and then migrating backAppVeyor
.
The following software is required to build this project:
- Visual Studio 2017
- .NET Core 2.1 SDK
- PowerShell 5.1/PowerShell 6 Core/Bash (minimum one)
- Docker
Execute the build.ps1
or build.sh
file found in the root of the repository. This builds the Docker
container which can then be run.