[Plugin] LXC Plugin


Recommended Posts

32 minutes ago, ich777 said:

Please run these commands from a Unraid Terminal:

LXC_PATH=$(cat /boot/config/plugins/lxc/lxc.conf | grep "lxc.lxcpath=" | cut -d '=' -f2 | head -1)
rm -rf /var/cache/lxc ${LXC_PATH}/cache
mkdir -p ${LXC_PATH}/cache
ln -s ${LXC_PATH}/cache /var/cache/lxc

(this should fix your issue, just copy past everything into the terminal)

 

May I ask if this is a fresh install and on what Unraid version are you?

Which path do you use for LXC?

I've seen this issue now twice but I can't reproduce it over here.

Thank you, the problem has been resolved. I have successfully started now. My Unraid version is 6.12.4 and I have installed LXC plugin freshly. The path for LXC setup is /mnt/cache/lxc

  • Like 1
Link to comment
10 minutes ago, wy586 said:

Thank you, the problem has been resolved. I have successfully started now. My Unraid version is 6.12.4 and I have installed LXC plugin freshly. The path for LXC setup is /mnt/cache/lxc

Really strange, thank you for the report.

Glad to hear that everything is working now.

Link to comment
1 hour ago, Roalkege said:

Would it be possible to create the lxc folder as a dataset on a ZFS cache? So that it is also displayed in the ZFS Master Plugin.

Yes, simply create a dataset and then point LXC to this dataset.

 

1 hour ago, Roalkege said:

Also, I'm not sure how to create a snapshot, but wouldn't this make it easier to create a snapshot?

I think I'm not following.

To create a Snapshot simply go to your LXC tab in Unraid, click on the Icon from the container that you want to snapshot and select Create Snapshot.

grafik.png.7837e3e29f2195781832326a4356d172.png

 

I don't know how it could be done more easily...?

 

Please note that this uses the built in snapshot function from LXC and not the ZFS Snapshot feature but I'm pretty sure it will create a proper snapshot <- I'm not entirely sure about that because I'm not a huge fan of ZFS, at least not more as for BTRFS, XFS and so on.

Link to comment
2 hours ago, ich777 said:

but I'm pretty sure it will create a proper snapshot <- I'm not entirely sure about that because I'm not a huge fan of ZFS, at least not more as for BTRFS, XFS and so on.

I think it depends on how the lxc container was created. If brtfs or zfs is specified in with the '-B' option of lxc-create then it should use the appropriate  backend when snapshotting. 

  • Like 1
Link to comment
9 minutes ago, primeval_god said:

I think it depends on how the lxc container was created. If brtfs or zfs is specified in with the '-B' option of lxc-create then it should use the appropriate  backend when snapshotting. 

By default it is dir and that means basically that it will be a subdirectory from you specified lxc path IIRC.

 

However this is something that needs to be tried since I think that lxc-snapshot should auto detect the filesystem where the container is on and then create a snapshot accordingly to the filesystem but I'm really not sure about that.

The plugin uses the default, so to speak 'dir'.

 

IIRC there are other special arguments for the option -B available.

Link to comment

@ich777 First of all, thank you so much for your work.

 

I'm very new to Docker, LXC, VMs, and so on, so I decided to learn and host some applications like Pi-hole, etc. Please don't judge me; I'm new to this.

 

I started by installing NPM, Redis, MariaDB, and Adminer as Docker containers so I wouldn't have to update them manually, and they are official images. My next idea was to set up Pterodactyl and AMP, but because there were no official Docker images available, I decided to create an LXC container. And here is where my story begins...

I forwarded my Nginx to ports 80 and 443. Then, I created a Debian LXC container and tried to install AMP using the official script. The problem was that the script was trying to use port 80, which was already in use. My idea was to change the listener for the LXC container, similar to Docker, but it didn't work. After making some changes here and there in my port configuration, it started working. But now, when I tried to install Pterodactyl, I ran into the same issue and can't resolve it.

 

Is there any way to change the listener for the LXC container? I tried googling it, and the answer I found was to use the command: "lxc config device add mycontainer myport80 proxy listen=tcp:0.0.0.0:8080 connect=tcp:localhost:80", but I can't seem to use this command.

 

I have another question as well. Do I need to open the ports for every LXC host in my Fritzbox, or is it enough to open the ports just on my Unraid host?

 

How have other people out there solved these issues?

Link to comment
28 minutes ago, GiGi said:

I started by installing NPM, Redis, MariaDB, and Adminer as Docker containers so I wouldn't have to update them manually, and they are official images.

On Unraid correct?

 

28 minutes ago, GiGi said:

My next idea was to set up Pterodactyl and AMP, but because there were no official Docker images available, I decided to create an LXC container.

This is actually a good idea because I do the same with AMP:

grafik.png.83ef5cc5d9bd4da009f4150af2a72232.png

 

29 minutes ago, GiGi said:

I forwarded my Nginx to ports 80 and 443.

I don't understand what you are saying with that? You mean NPM correct?

 

30 minutes ago, GiGi said:

Then, I created a Debian LXC container and tried to install AMP using the official script. The problem was that the script was trying to use port 80, which was already in use.

For what did it try 80? You know that you can change that and by default it is running on port 8080 IIRC

 

30 minutes ago, GiGi said:

My idea was to change the listener for the LXC container, similar to Docker, but it didn't work.

I really don't understand what you are saying here, the LXC container has it's own IP so it doesn't matter which port because each IP can have it's own port 80.

 

34 minutes ago, GiGi said:

Is there any way to change the listener for the LXC container?

I really don't know what you mean with the listener.

 

If you want to port forward your AMP server, even if it runs on port 80 you need to set up a reverse proxy in NPM but this is out of scope for this thread.

 

 

BTW I have something really cool coming up but that needs first approval:
grafik.thumb.png.8c83a9a705161745827d6df906deaddf.png

This is basically a pre setup AMP container with Docker support so that you can install all games within AMP.

Link to comment
6 minutes ago, ich777 said:

On Unraid correct?

Yes on Unraid via Docker. And NPM is reachable from outside on port 80 and 443.

 

7 minutes ago, ich777 said:

I don't understand what you are saying with that? You mean NPM correct?

 

Yes i mean NPM

 

8 minutes ago, ich777 said:

For what did it try 80? You know that you can change that and by default it is running on port 8080 IIRC

Yes but when you start the script from cubecuoders it will fail. It asks for port 80 and 443.

I tried 80 and 8080 but it stuck while the installation. How do you setup your reverseproxy before this installation?

14 minutes ago, ich777 said:

I really don't understand what you are saying here, the LXC container has it's own IP so it doesn't matter which port because each IP can have it's own port 80.

 

I found a command as i said lxc config device add mycontainer myport80 proxy listen=tcp:0.0.0.0:8181 connect=tcp:localhost:80 that makes it possbile like docker to work internally with port 80 but is reachable with port 8181 for exampel. you got me? :)

 

in gernerell there are command like that in some forums, but we cant use them.

Link to comment
58 minutes ago, GiGi said:

Yes but when you start the script from cubecuoders it will fail. It asks for port 80 and 443.

Sorry, I don't see that:

grafik.png.682254b65b6058eb928781cb106384f9.png

 

This is a fresh installed Debian Bookworm container with the script from Cube Coders to install AMP.

 

Can you maybe post a screenshot?

 

58 minutes ago, GiGi said:

How do you setup your reverseproxy before this installation?

You need a reverse proxy after the installation not before. You only need the reverse proxy to forward the WebUI from AMP if you want to make it reachable from outside.

 

58 minutes ago, GiGi said:

that makes it possbile like docker to work internally with port 80 but is reachable with port 8181 for exampel. you got me? :)

Yes, but that's not necessary at all, even if it runs on port 80.

Please post a screenshot from that where it asks about port 80 or 8080 and from where it is not working.

 

I'll explain that a bit more in detail:

You'll only need to port forward for Docker since only the forwarded ports are reachable but for LXC it is a completely different story, each container has it's own dedicated IP and it acts more as a VM not like a container and all ports assigned to that IP are reachable.

Again, you don't have to forward anything... Don't mix Docker and LXC... a LXC container acts more like a VM with it's own dedicated IP where Docker shares the IP with the host and you have to forward the ports form each container.

 

 

EDIT:

grafik.thumb.png.2a53a36814534abc8b1176e40b866943.png

 

grafik.thumb.png.8dd4fcbf7491efd5de1e6676d5afc113.png

Link to comment
46 minutes ago, ich777 said:

You need a reverse proxy after the installation not before. You only need the reverse proxy to forward the WebUI from AMP if you want to make it reachable from outside.

I think that is the problem. I want to make it reachable from outside.

 

81BA2824-73DA-4A74-A0BD-C4FDEE724A15.thumb.jpeg.8f361f9405e77ce060df62904a930a8e.jpeg

 

657925431_Bildschirmfoto2023-09-27um19_53_54.thumb.png.991885636253931373437120f92af6b8.png

Edited by GiGi
Link to comment
2 hours ago, GiGi said:

I think that is the problem. I want to make it reachable from outside.

That's no problem but do it through NPM <- so to speak a Reverse Proxy. AMP tries to pull a certificate from LetsEncrypt but you shouldn't do that because you already have a certificate in NPM that's why you usually use a Reverse Proxy for that.

 

Disable https and I would recommend that you start with a new container since it already told you that AMP exists.

 

I would also recommend that you do a bit of research what a Reverse Proxy is and what you can do with it. @SpaceInvaderOne did a good videos on that and how to configure them.

As said above if you have already a webserver with a certificate (NPM) you route the whole http/https traffic that you want to make reachable from outside through this one webserver.

 

But as said this is out of this scope and does not belong in this thread.

Link to comment
23 hours ago, primeval_god said:

lxc container was created

On 9/27/2023 at 11:38 AM, Roalkege said:

Would it be possible to create the lxc folder as a dataset on a ZFS cache?

The plugin now has (experimental) support for ZFS and BTRFS as backing storage types, default is: directory

All already set up containers will use directory.

 

To change the backing storage type to one of the two new ones go to the Settings page from LXC and select ZFS or BTRFS (the appropriate option will show up depending on which filesystem the default path is located).

 

When creating a LXC container the plugin will automatically create a dataset on the ZFS pool where the default lxc directory is located on, with the path: <ZFSPOOLNAME>/zfs_lxccontainers/<CONTAINERNAME>

The configuration will be still visible in the default lxc directory.

 

If you find any bugs please report them here. ;)

  • Thanks 1
Link to comment
37 minutes ago, Roalkege said:

Hey, with the photon container, the debian logo has simply disappeared. Total RX/TX is also missing and when I activate Autostart for the container and then reload the page, Autostart=off.

Please post your Diagnostics.

 

Seems something is wrong with the container, did you maybe create a dataset over the container path or something similar?

Link to comment
13 minutes ago, Roalkege said:

I created a dataset with ZFS Master. Is this the problem?

Yes, I've wrote above the plugin will do that automatically. I'm assuming you are using the ZFS as a backing storage type correct?

 

Why did you do that in the first place? Please don't mess with the lxc directory itself.

 

Delete this one dataset that you've created for this specific container per hand and it should be back to normal (hopefully).

There is now only one container config available from what I see in your Diagnostics.

Link to comment
7 minutes ago, Roalkege said:

I stopped my photon container and now the container is gone.

Because you overwrote the container with the dataset (at least that's what I assume).

In the Diagnostics from above I only see the DNS container and no second container, the visible container was just a leftover since the container was started but did do nothing anymore because as said, you've overwrote it with the dataset.

 

7 minutes ago, Roalkege said:

I also removed before that the snapshot. Is there any way to recover the container?

Look into your lxc default directory if there is a folder in there for your missing container, if not you are sadly enough out of luck.

 

Please don't mess with the lxc default path. This directory should not be touched!

 

EDIT: I would recommend that you set up the built in Backup function and create a backup from each container from time to time since those are not removed, even if you remove the container (...or mess up the directory).

Link to comment
2 minutes ago, ich777 said:

Look into your lxc default directory if there is a folder in there for your missing container, if not you are sadly enough out of luck.

I can still see the dataset. ZFS Plugin shows 106GB used.

But the zfs_lxccontainers/photon is empty. And the lxc/photon has only a snaps folder and ends with an empty rootfs folder.

I think I have to delete the dataset? and setup a new container?

image.thumb.png.0be6a072e0dcd494343fb2dec67f7d1a.png

Link to comment

I havent created a dataset.

Your plugin created the zfs_lxccontainers dataset and then another dataset zfs_lxccontainers/photon and zfs_lxccontainers/dns with /mnt/cache/lxc/photon/rootfs and /mnt/cache/lxc/dns/rootfs. Created a snapshot with the ZFS Master from the photon container. After that the config was gone. Deleting the snapshot changed nothing.

Today I rebooted my system. Now the DNS container is also gone. I havent changed anything and I havent created a snapshot from this container.

 

Link to comment
1 hour ago, Roalkege said:

Now the DNS container is also gone.

The DNS container was created with a directory and not with ZFS correct?

 

I will try this later on my server and see if I can reproduce this.

 

EDIT: Okay so I looked at your Diags and I see that it was created from ZFS, have to try this again on my server, strangely enough your paths point to the dataset created by the plugin and not to the LXC path which was the opposite on my server.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.