MDriven Docker Deployment

MDriven Turnkey and MDriven Server have linux distributions and can be run as linux container applications. Making them more portable, easier to share and run. With docker containers, deploying apps is more faster and less complex.

Local Deployment

Install Docker Desktop. Versions are available for Windows and linux.

Choose one of the linux distributions to deploy with:

  • Alpine - Extremely light weight with a minimalist approach. Ideal for light weight apps, microservices and environments where efficienct resource utilization is critical.
  • Ubuntu - Has a larger footprint with more preinstalled packages and tools, ideal for an enviroment where a wide range of tools and libraries are needed.

Create a docker file for the MDriven Server

Contents of MDrivenServer.Dockerfile

# syntax=docker/dockerfile:1

FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine

RUN apk add --upgrade --no-cache \
        curl \
        unzip \
        xmlstarlet 

WORKDIR /app

ARG MS_VERSION

RUN curl -O https://mdriven.net/PublicDownloads/MDrivenServerOnCoreVersion.xml \
    && MS_VERSION=$(xmlstarlet sel -t -v "//root/date" MDrivenServerOnCoreVersion.xml) \
    && rm -f MDrivenServerOnCoreVersion.xml \
    && curl -O "https://mdriven.net/PublicDownloads/MDrivenServerCoreLinux_${MS_VERSION}.zip" \
    && unzip "MDrivenServerCoreLinux_${MS_VERSION}.zip" \
    && rm -f "MDrivenServerCoreLinux_${MS_VERSION}.zip"


RUN dotnet nuget add source /mnt/c/capableobjectswush/Xternal/VistaDB --name  XternatVistaDB

ENTRYPOINT ["dotnet", "AppCompleteGenericCore.dll", "-port=5010", "-nohttps"]
Command Description
FROM mcr.microsoft.com/dotnet/sdk:

8.0-alpine

Base image for the container MDriven Server app. An Alpine Linux distribution with .NET 8.0 SDK for running .NET applications.

Check https://github.com/dotnet/dotnet-docker/blob/main/README.sdk.md for more .NET SDK container images.

RUN apk add --upgrade --no-cache \

        curl \

        unzip \

        xmlstarlet

Updates the existing linux packages and installs packages: curl for downloading files, unzip for extracting zip file contents and xmlstarlet for parsing xml content.
WORKDIR /app Sets the working dir for the following commands.
ARG MS_VERSION Creates MS_VERSION build-time variable called MS_VERSION.
RUN curl -O https://mdriven.net/PublicDownloads/MDrivenServerOnCoreVersion.xml \

    && MS_VERSION=$(xmlstarlet sel -t -v "//root/date" MDrivenServerOnCoreVersion.xml) \

    && rm -f MDrivenServerOnCoreVersion.xml \

    && curl -O "https://mdriven.net/PublicDownloads/MDrivenServerCoreLinux_${MS_VERSION}.zip" \

    && unzip "MDrivenServerCoreLinux_${MS_VERSION}.zip" \

    && rm -f "MDrivenServerCoreLinux_${MS_VERSION}.zip"

Get the current MDriven Version, use it to download the current MDriven Server app and unzip it into the current working directory. If you have an existing MDriven Server instance, copy the files to the container.
COPY ./mdriven-files .
RUN dotnet nuget add source /mnt/c/capableobjectswush/Xternal/VistaDB --name  XternatVistaDB Add the VistaDB package source.
ENTRYPOINT ["dotnet", "AppCompleteGenericCore.dll", "-port=5010", "-nohttps"] Run the application on port 5010 and over http.

Create a docker file for the Turnkey Server

contents of MDrivenTurnkey.Dockerfile

# syntax=docker/dockerfile:1

FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine

RUN apk add --upgrade --no-cache \
        curl \
        unzip \
        xmlstarlet \
        musl-locales \
        libintl

# ENV LANG=en_US.UTF-8
# ENV LANGUAGE=en_US:en
# ENV LC_ALL=en_US.UTF-8

RUN locale -a

WORKDIR /app

ARG TK_VERSION

RUN curl -O https://mdriven.net/PublicDownloads/MDrivenTurnkeyOnCoreVersion.xml \
    && TK_VERSION=$(xmlstarlet sel -t -v "//root/date" MDrivenTurnkeyOnCoreVersion.xml) \
    && rm -f MDrivenTurnkeyOnCoreVersion.xml \
    && curl -O "https://mdriven.net/PublicDownloads/MDrivenTurnkeyCoreLinuxMUSL_${TK_VERSION}.zip" \
    && unzip "MDrivenTurnkeyCoreLinuxMUSL_${TK_VERSION}.zip" \
    && rm -f "MDrivenTurnkeyCoreLinuxMUSL_${TK_VERSION}.zip"


COPY ./turnkey-settings ./App_Data

# USER $APP_UID

ENTRYPOINT ["dotnet", "StreaminAppCoreWebApp.dll", "-port=5020", "-nohttps"]
NOTE: For Turnkey Server, install locale packages and set language to prevent locale errors. The Turnkey uses the OS locale settings to determine which locale file is used by the Turnkey.

copy Turnkey settings to Turnkey APP_Data Folder. The turnkey-settings folder contains:

HardServerUrl Settings: To specify the address to be used by the Turnkey Server.

MDrivenServerOverride Settings: TO specify credentials for connecting to the MDriven Server

contents of turnkey-settings/HardServerUrl.xml

<?xml version="1.0" encoding="utf-8"?>
<root HardServerUrl="http://localhost:5020">
</root>

contents of turnkey-settings/MDrivenServerOverride.xml

<?xml version="1.0" encoding="utf-8"?>
<root>
  <MDrivenServerOverride MDrivenServerPWD="123456" MDrivenServerUSER="a">http://mdriven_server:5010</MDrivenServerOverride>
</root>

contents of compose.yaml

services:
  mdriven_server:
    build:
      dockerfile: MDrivenServer.Dockerfile
    networks:
      - app_net
    volumes:
      - mdriven_server_data:/app
    ports:
      - 5010:5010
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5010"]
      interval: 24h
      timeout: 30s
      retries: 5
      start_period: 30s

  mdriven_turnkey:
    build:
      dockerfile: MDrivenTurnkey.Dockerfile
    networks:
      - app_net
    volumes:
      - mdriven_turnkey_data:/app
    ports:
      - 5020:5020
    depends_on:
      - mdriven_server

volumes:
  mdriven_turnkey_data:
  mdriven_server_data:
networks:
  app_net:

See also:

This page was edited 125 days ago on 11/11/2024. What links here