Deploy FlexIt with Docker on Windows
Recommended for Windows Server: use the on-premise installer. It runs FlexIt as a Windows service, supports Windows authentication to SQL Server, and does not need Docker.
If you want to run FlexIt in containers on Windows, run the Linux Docker deployment inside the Windows Subsystem for Linux (WSL2).
Note FlexIt via Docker does not support SQL Server database connections using Windows Domain authentication. If you need to connect to SQL Server, you must use SQL authentication.
Requirements
- Windows Server 2022 (with the June 2022 update or later) or newer, or Windows 11
- Administrator access
- Virtualization enabled. If the Windows machine is itself a virtual machine, nested virtualization must be enabled on the host.
Docker Desktop is not supported on Windows Server, so Docker Engine is installed inside WSL2 instead.
1. Install WSL2 and Ubuntu
In an Administrator PowerShell:
wsl --install -d Ubuntu
Restart Windows when prompted, then open Ubuntu from the Start menu and create a Linux user.
2. Enable systemd
So that Docker starts automatically inside Ubuntu, add the following to /etc/wsl.conf in Ubuntu:
[boot]
systemd=true
Then restart WSL from PowerShell:
wsl --shutdown
3. Install FlexIt
Open Ubuntu again and follow the Linux Docker deployment from step 1: clone the repository, create the .env file, and run sudo ./install.sh. The install script installs Docker Engine for you.
From the Windows machine itself, FlexIt is now available at http://localhost:<FLEXIT_PORT>.
4. Allow Access from Other Machines
By default, the containers are only reachable from the Windows machine. To let other machines connect, forward the FlexIt port from Windows to WSL in an Administrator PowerShell:
$wslIp = (wsl -d Ubuntu hostname -I).Split(" ")[0]
netsh interface portproxy add v4tov4 listenport=3030 listenaddress=0.0.0.0 connectport=3030 connectaddress=$wslIp
New-NetFirewallRule -DisplayName "FlexIt" -Direction Inbound -Protocol TCP -LocalPort 3030 -Action Allow
Replace 3030 with your FLEXIT_PORT (or NGINX_HTTPS_PORT and NGINX_HTTP_PORT if you use Nginx). The WSL address can change when Windows restarts, so run the portproxy command again at startup, as shown below.
On Windows 11, you can instead enable mirrored networking by adding the following to %UserProfile%\.wslconfig:
[wsl2]
networkingMode=mirrored
5. Start FlexIt When Windows Starts
WSL does not start on its own when Windows boots. The FlexIt containers restart automatically once Ubuntu is running, so create a scheduled task that starts Ubuntu at boot and keeps it running. In an Administrator PowerShell, replacing <user> and <password> with the Windows account that installed Ubuntu:
$action = New-ScheduledTaskAction -Execute "wsl.exe" -Argument "-d Ubuntu --exec sleep infinity"
$trigger = New-ScheduledTaskTrigger -AtStartup
Register-ScheduledTask -TaskName "FlexIt WSL" -Action $action -Trigger $trigger -User "<user>" -Password "<password>" -RunLevel Highest
If you use portproxy, add a second scheduled task at startup that refreshes it with the commands from step 4.
Managing the Docker Containers
Run the Linux management scripts from Ubuntu, in the flexit-docker-linux directory.
Restarting the Application
To pull the latest changes and restart FlexIt, from Ubuntu:
./scripts/restart_server.sh
Or from PowerShell:
wsl -d Ubuntu --cd ~/flexit-docker-linux -- ./scripts/restart_server.sh