.net core Plastic SCM Server on Windows Server Core
Let us share how to create a minimalist Microsoft Windows installation to host our new .net Core Plastic SCM Server. Didn't you know we run on .net core? Check this blogpost.
What is Windows Server Core?
Windows Server Core is a minimal installation option that is available when you are deploying a regular Windows Server. It includes most but not all server roles, which makes the disk footprint around 3-5GB.
With Server Core, Microsoft stripped away the graphical user interface, so you must run all the operations using the command line. Not a problem for a server-side environment.
You can always install Windows Core Server in your office using a small machine, but as it requires a small number of resources, it is perfect for hosting it at Amazon.
Amazon instance creation
First, create a new instance selecting this Amazon AMI, or anyone else more modern:
The installation footprint is tiny. In my case, it takes less than 5GB. Notice a regular windows server weighs, at least, double.
It only brings a command line window with PowerShell, of course, so let’s use it to install everything we need.
To access the machine from the outside we need SSH, RDP does not work here. My installation brings the Client, but we need the Server component:
> Get-WindowsCapability -Online | ? Name -like `OpenSSH*' Name : OpenSSH.Client~~~~0.0.1.0 State : Installed Name : OpenSSH.Server~~~~0.0.1.0 State : NotPresent
Run the following command to install the Open SSH Server:
> Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 Path : Online : True RestartNeeded : False
SSH default port is 22, so add a new firewall rule to allow the traffic through that port:
>firewall add rule name="Open Port 22" dir=in action=allow protocol=TCP localport=22
Now, start the SSH server:
Start-Service sshd
And voila, we can access from our computer to the new Window Server core machine:
PS C:\Users\manu> ssh Administrator@ec2-3-8-208-151.eu-west-2.compute.amazonaws.com The authenticity of host 'ec2-3-8-208-151.eu-west-2.compute.amazonaws.com (3.8.208.151)' can't be established. ECDSA key fingerprint is SHA256:d5EePSplh6S+mDBaoCcyW4lyepBli8RXUlIcZzSsB6I. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'ec2-3-8-208-151.eu-west-2.compute.amazonaws.com,3.8.208.151' (ECDSA) to the list of known hosts. Administrator@ec2-3-8-208-151.eu-west-2.compute.amazonaws.com's password: Microsoft Windows [Version 10.0.18363.778] (c) 2019 Microsoft Corporation. All rights reserved. administrator@EC2AMAZ-IR0S49V C:\Users\Administrator>
Plastic SCM .net core Server installation
Everything is really to get the Plastic SCM .net core Server bundle inside the machine. You can always get it from our website. Hey! Remember to disable the Invoke-WebRequest command progress; otherwise, it is super-slow!
$progresspreference = 'silentlyContinue' Invoke-WebRequest https://s3.eu-west-2.amazonaws.com/plastic-releases/releases/9.0.16.4182/plasticscm/windows/PlasticSCM-9.0.16.4182-win-x64-server-netcore.zip -OutFile .\server-netcore.zip $progressPreference = 'Continue'
Unzip the bundle:
PS C:\Users\Administrator>Expand-Archive server-netcore.zip -DestinationPath c:\PlasticSCM\server-net-core
Add another firewall rule for the Plastic SCM Server port. Note: If this Plastic SCM Server is outside of your office, make sure you only use the SSL port.
PS c:\PlasticSCM\server-net-core> netsh advfirewall firewall add rule name="Open Port 8787" dir=in action=allow protocol=TCP localport=8787 Ok.
It's always good to test if the Plastic SCM Server can start before going further. You can do it by running the server console mode. The Plastic SCM Server has two ways to start, console, and daemon/service. A Plastic SCM Server in console mode lives until the console where it runs keeps open, or until you type enter key twice.
PS C:\plastic\server-net-core> .\plasticd.exe --console plasticd daemon up. 8.0.1.0 578 ms startup time Hosting environment: Production Content root path: C:\plastic\server-net-core\webadmin Now listening on: http://[::]:7878
From my local machine, I verify I can list the server default repository:
PS C:\wkspaces\codice> cm repository list ec2-3-8-208-151.eu-west-2.compute.amazonaws.com:8787 default@ec2-3-8-208-151.eu-west-2.compute.amazonaws.com:8787
Everything seems to be working fine, so type the enter key twice at the server console, and you will see how the Plastic SCM server stops. Now, let's create a Windows Service to launch it properly:
sc.exe create plasticscm-net-core-server binpath=C:\plastic\server-net-core\plasticd.exe
Now, you should have a .net core Plastic SCM server running on a Windows Server core machine Enjoy it! 😊
Next steps
Try to do the same with the new "Nano" Windows Server. It seems to be several times smaller!
0 comentarios: