Using Magic with Microsoft SQL Server

In this tutorial we will cover the following parts of Magic and Hyperlambda.

The default “docker-compose.yml” file for Magic will create a MySQL Docker container. If you instead want to use SQL Server, you’ll need a slightly modified “docker-compose.yml” file. Below is a complete docker-compose file, except it creates a Microsoft SQL Server database image, and not a MySQL image.

version: "3.3"

services:

  db:
    image: mcr.microsoft.com/mssql/server
    environment:
        SA_PASSWORD: Your_password123
        ACCEPT_EULA: Y

  backend:
    image: aistamagic/magic-backend:latest
    depends_on:
      - db
    restart: always
    ports:
      - "4444:4444"
    volumes:
      - etc_magic_folder_ms:/magic/files/etc
      - modules_magic_folder_ms:/magic/files/modules
      - config_magic_folder_ms:/magic/config

  frontend:
    image: aistamagic/magic-frontend:latest
    depends_on:
      - backend
    restart: always
    ports:
      - "5555:80"

volumes:
  etc_magic_folder_ms:
  modules_magic_folder_ms:
  config_magic_folder_ms:

If you create a file named “docker-compose.yml” and save it to any directory on your machine with the above content, for then to run the following command in that same directory, this will start an SQL Server instance on your machine.

docker-compose up

Configuring Magic

When you configure Magic, you’ll need to choose the “mssql” database type. Afterwards you’ll need to paste the following into its connection string settings and choose a root password.

Server=db;Initial Catalog={database};User=sa;Password=Your_password123;

The rest of the process is similar to the MySQL equivalent, and implies crudifying your backend, creating a key pair, and running the assumptions. You also need to have Docker installed on your development machine.