Skip to content

Orchestration (Docker)

John Mazouri edited this page Feb 20, 2019 · 1 revision

Modix uses Kubernetes to orchestrate its various components and services. You can view the cluster configuration here - each section has a comment header to help you read through it.

What's a Kubernetes?

Kubernetes is used to compose & orchestrate containers - typically created with Docker. Modix itself is one container, part of the greater cluster along with a database service, CSDiscord, etc.

How does the Modix pipeline work?

We utilize Azure Pipelines for Modix's deployment. It builds the Modix container, uploads it to the Docker hub, and triggers a deployment on our Kubernetes cluster to update any relevant containers. This allows us to have a very simple deployment workflow, where all it takes is a commit on Master to push changes into production right away - for better, or for worse.

What's a container?

Great question, but, outside the scope of this documentation - regardless, here's a quick rundown of Modix's Dockerfile:

Basing off the .NET Core 2.1 SDK image (Debian Stretch), copy the repo files into the container & run all our tests

FROM microsoft/dotnet:2.1-sdk-stretch as dotnet-test
WORKDIR /src
COPY . .
RUN dotnet test Modix.Data.Test

Basing off the .NET Core 2.1 SDK image (Debian Stretch), copy the repo files into the container

FROM microsoft/dotnet:2.1-sdk-stretch as dotnet-build
WORKDIR /src
COPY . .

In the same container, install Node 10 to compile the frontend

RUN apt-get update && apt install curl -y
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install nodejs -y

Publish Modix for linux-x64 - this also builds the frontend (defined as an msbuild task in the csproj)

RUN dotnet publish Modix.sln -c Release -r linux-x64 -o /app

Finally, from the ASP.NET Core runtime image, copy the built application and the built frontend from the previous container into the appropriate locations in the final container

FROM microsoft/dotnet:2.1-aspnetcore-runtime
WORKDIR /app
COPY --from=dotnet-build /app .
ENTRYPOINT ["dotnet", "Modix.dll"]