Click here to Skip to main content
15,883,901 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Host Web API Pin
markkuk26-Jul-22 21:05
markkuk26-Jul-22 21:05 
GeneralRe: Host Web API Pin
pkfox26-Jul-22 22:01
professionalpkfox26-Jul-22 22:01 
PraiseRe: Host Web API Pin
NPowDev28-Jul-22 0:07
NPowDev28-Jul-22 0:07 
GeneralRe: Host Web API Pin
DerekT-P27-Jul-22 9:37
professionalDerekT-P27-Jul-22 9:37 
GeneralRe: Host Web API Pin
peterkmx27-Jul-22 14:02
professionalpeterkmx27-Jul-22 14:02 
GeneralRe: Host Web API Pin
maze327-Jul-22 22:41
professionalmaze327-Jul-22 22:41 
GeneralRe: Host Web API Pin
Vaso Elias28-Jul-22 1:13
Vaso Elias28-Jul-22 1:13 
GeneralRe: Host Web API Pin
Peter Shaw28-Jul-22 2:36
professionalPeter Shaw28-Jul-22 2:36 
I host my own Smile | :)

About 5 years ago I pooled together about £400 gbp, and bought a second hand Dell server that was only 2 years old from a local dealer.

The server was a 4 Node C6100 server, with each node/sled fully populated (8 cores and 24gb Ram + 3 1Tb drives), However, what I'm about to describe can be run on any bit of old PC hardware built within the last 10 years or so, as long as it has a CPU with virtualisation extensions added, which today is all Xeons, and most i5/i7 series.

Put a decent size hard drive in the machine, download the latest Ubuntu Server LTS version (Currently 22.04 as I write this [I personally am still on 20.04]), burn the ISO to a CD or a keychain, and boot and install the PC with it.

Go with the defaults, if you download the server version you should not get asked if you want a desktop or anything on it, if you do though... the answer is NO, you don't need a GUI or anything on this system, just an SSH server (Which you may also get asked if you want)

Once you have the base installed, then you first want to do an update:
apt update; apt upgrade

Just to make sure everything's up to date.

Following that, you want LXD installing, no point in repeating what others have written, so you you can find all you need to know here:

https://www.cyberciti.biz/faq/install-lxd-on-ubuntu-20-04-lts-using-apt/

For performance reasons on a single stand alone PC, you probably want the "snap" version, and when you init your default storage pool "btrfs" as the file system type, unless of course you want access from your host machine direct into the containers you create then your storage type wants to be "dir", the rest are for more specialist cases and require too much overhead to maintain.

Once you have your Server set up, and LXD installed and initialised, then your ready to rock and roll:
lxc launch ubuntu:20.04 myfirstcontainer

Will spin up your first container running ubuntu LTS 20.04 ready for you to "lxc exec <name> bash" into it and start adding users, software etc to it.

LXD/LXC containers running ubuntu, use something called cloud-init, which allows you to add provisioning steps directly to your containers at creation time, I've already created a profile script to add to LXD and you can grab a copy from github here:

LXD Profile to add to your LXD install, allowing the creation of lightweight DOTNET 6 containers when using "lxc launch"

You can add the profile to your LXD install as follows
cat dotnet.profile | lxc profile edit dotnet

Then use it to create auto provisioning containers using
lxc launch ubuntu:20.04 mysecondcontainer -p dotnet

If your NOT using a container image that uses cloud init, then you can use my alternate script that uses "LXC commands" at the ubuntu host command line to provision your container, you can grab a copy of those here:

Bash script to provision a standalone Linux container based on Debian, setting it up to run DOTNET 6 SDK and including the Midnight Commander file manager and text editor.

For managing the users in the containers and generating SSH keys that you can then use in PuttySSH on a windows machine, you can grab a copy of the scripts I use for those tasks here:

Provisioning Scripts that I use for managing containers running DOTNET 6 projects on LXD/LXC

NOTE: To use the ssh creation script you will need to install "putty-tools" from the Ubuntu package manager so that you can generate windows compatible PPK certs for use with Putty on Windows. If you use a different SSH tool set, then you'll need to alter the script to run something like "ssh-keygen" instead.

You can customise the profile and scripts to include any language runtimes you want. I work mostly with C# & .NET hence why mine are all DN6, but you can use this method & scripts to set-up python, node, go, flutter anything you want.

You could even create separate profiles for different language installs if your using cloud-init aware OS's, then it's a simple matter of just "-p blahprofile" as needed when you launch a new image.

I also have "Team City & Jenkins" installed on the container host, and with a lot of my projects I have a full CI/CD process that allows me to just check code in to my Git-Server (Which I also run locally on my own gear) , and the CI/CD process then tears down any old container running, builds a new one, builds the code, pushes the built code into the new container, then re-starts it.

Make no mistake here either, LXD/LXC containers are NOT Like docker images. These thinks look, feel and behave like full blown miniature VM's, they will acquire their own IP address from the host (You WILL have to do the extra work of manually creating a bridged network interface if you want them to use the same DHCP on your router as everything else does) and they will set up their own file system that you can run an SSH service on, and that appears as if it was a separate directly addressable server in your network.

Best part about it all... if you have an OLD pc (Doesn't have to be stupid powerful) that's sitting gathering dust, doing this should cost you nothing, but a bit of learning and setting up time.

I did an earlier video on my YouTube page, showing how to use the same sort of methods for setting up and running a DOTNET Core Blazor Server app, but that is a bit out of date now, you can watch it here if you want to however:

building a blazor app on LXC - YouTube

modified 28-Jul-22 10:41am.

GeneralRe: Host Web API Pin
pkfox28-Jul-22 3:47
professionalpkfox28-Jul-22 3:47 
GeneralRe: Host Web API Pin
Peter Shaw28-Jul-22 4:41
professionalPeter Shaw28-Jul-22 4:41 
GeneralRe: Host Web API Pin
pkfox28-Jul-22 10:18
professionalpkfox28-Jul-22 10:18 
GeneralRe: Host Web API Pin
Peter Shaw29-Jul-22 6:52
professionalPeter Shaw29-Jul-22 6:52 
GeneralRe: Host Web API Pin
L. Braun28-Jul-22 3:58
L. Braun28-Jul-22 3:58 
GeneralRe: Host Web API Pin
MikeCO1028-Jul-22 3:09
MikeCO1028-Jul-22 3:09 
GeneralRe: Host Web API Pin
Joss45128-Jul-22 6:00
Joss45128-Jul-22 6:00 
RantAnother MS perplexion (actually, more) Pin
David O'Neil26-Jul-22 13:23
professionalDavid O'Neil26-Jul-22 13:23 
GeneralRe: Another MS perplexion (actually, more) Pin
Andreas Mertens26-Jul-22 16:54
professionalAndreas Mertens26-Jul-22 16:54 
GeneralRe: Another MS perplexion (actually, more) Pin
OriginalGriff26-Jul-22 20:00
mveOriginalGriff26-Jul-22 20:00 
GeneralRe: Another MS perplexion (actually, more) Pin
David O'Neil26-Jul-22 20:26
professionalDavid O'Neil26-Jul-22 20:26 
GeneralRe: Another MS perplexion (actually, more) Pin
Jacquers26-Jul-22 21:18
Jacquers26-Jul-22 21:18 
GeneralRe: Another MS perplexion (actually, more) Pin
yacCarsten26-Jul-22 21:53
yacCarsten26-Jul-22 21:53 
GeneralRe: Another MS perplexion (actually, more) Pin
Richard Andrew x6427-Jul-22 6:51
professionalRichard Andrew x6427-Jul-22 6:51 
GeneralRe: Another MS perplexion (actually, more) Pin
obermd27-Jul-22 3:31
obermd27-Jul-22 3:31 
GeneralRe: Another MS perplexion (actually, more) Pin
Peter Shaw28-Jul-22 3:04
professionalPeter Shaw28-Jul-22 3:04 
GeneralRe: Another MS perplexion (actually, more) Pin
Kirk 1038982128-Jul-22 3:24
Kirk 1038982128-Jul-22 3:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.