WillyXJ / facileManager

A modular suite of web apps built with the sysadmin in mind.
www.facilemanager.com
GNU General Public License v2.0
87 stars 37 forks source link

[FEATURE REQUEST] Ability to run within docker without bind #491

Open CoryGH opened 4 years ago

CoryGH commented 4 years ago

Please prefix your issue title with one of the following: [BUG], [ISSUE], [FEATURE REQUEST], [MODULE REQUEST], [OTHER].

Replace everything between stars with current version of your facileManager and module installations:
fM Version : 3.5.7 fmDNS Version : 3.4.1

In raising this issue, I confirm the following (please check boxes, eg [X]):


Expected Behavior: Ability to run facileManager+fmDNS within a docker container.

Actual Behavior: fmDNS clients have checks in place to determine if httpd/apache and bind are installed on the machine.

Steps to reproduce: 3 docker containers: -bind is in one docker container -facileManager in another docker container -fmDNS client in another docker container

Ideally the fmDNS client would be able to have mapped volumes straight from the host or shared between docker containers which allow for editing of the DNS zone files used by bind via those file mappings without checks to see if bind is installed outside those files existing and without checks to see if httpd/apache is installed. It seems like this might work if I installed bind+facileManager+the-fmDNS-client all on the same docker container, but that's a bit bloated for a docker container and with the issues the fmDNS client installer has via docker's -ti interactive build (e.g. constant scrolling prompts which can't take input or just skipping input entirely depending on config) it would be overly cumbersome to have to blow away the bind+facileManager+fmDNS configs if any one of them had issues.

aredan commented 4 years ago

I've been working on moving my facileManager DNS to Kubernetes. I first try PowerDNS but I don't like how it works and I love how easy fmDNS manage zones and let me see what is going on. So, I played a bit with https://github.com/erindru/fmDNS-docker and create two containers, one with facileManager and the second one with fmdDNS module.

Right now I have facileManager + MySQL in a Pod and another deployment running bind + fmdns module. The only issue now is that my bind + fmds is stateless (no persistent volume) and everytime I destroy de pod and get recreated by k8s, I have to enable the server in facileManager. looking at fixing that, I don't want to give storage to bind + fmdns if it's not necessary.

I hope to get this working so I can send you my YAML and a bit of documentation, also, will try to create a Helm chart jus to learn how to do it.

MeCJay12 commented 2 years ago

I'm working on this now. I have the FM server in a container right now but I'm getting stuck on running it behind an Nginx reverse proxy. Any idea what directives might be required?

Mr-Mors commented 2 years ago

I got something working, I'm currently adding Traefik to it and should get that pushed to my repo here in the next few days. In the mean time maybe this will also help someone else: https://github.com/Mr-Mors/fmDNS-docker.

I'm having it work like 50% of the time with Traefik infront. Not sure why it just sometimes will not work. Will update when I got it working.

Mr-Mors commented 2 years ago

@MeCJay12 I got it working with Traefik, I had to comment out a line (158 I think) in fm-includes/init.php as facileManager does not like to be behind a proxy that if redirecting HTTP to HTTPs. You can check out my commit to my fork of the fmDNS-docker project for the patch file.

MeCJay12 commented 2 years ago

That did it!

I'm going to fork your repo (link) and make some changes for me personally (updating the php version, removing Traefik stuff for Nginx, and removing the docker-compose stuff for one liners) but you should take a look. There's three lines you should add to your FM Dockerfile apt-get ssh, mkdir /fm_tmp, and chown -R www-data:www-data /fm_tmp which enable ssh clients. I personally will be connecting FM to some non-Docker clients which is why I'm adding it. There's also a line that removes apt-get lists when done to same some space in the image.

Additionally, I'll be watching your commits and working myself to try and solve the missing icons in the builds. It'd be cool of you to post here if you find a solution.

@WillyXJ I think you can consider this done. It would be great of you to look at that check you have in init.php to see if can be reworked to work natively rather than needing to be removed. Of course, if you need help testing, lmk.

Mr-Mors commented 2 years ago

@MeCJay12 Thanks about the ideas of supporting SSH, I'll for sure take a look at that. What missing icons are you have? I haven't noticed that. Regarding the init.php patch, I opened a issue specifically about that: https://github.com/WillyXJ/facileManager/issues/549

MeCJay12 commented 2 years ago

Disregard. There is a settings for where the icon is (in case you want to rebrand the webUI) and when I migrated FM to Docker the container had it in a different location than my VM did so I just had to adjust it.

This issue is probably good to close then!

MeCJay12 commented 2 years ago

@WillyXJ I decided to work on the fmDNS client again. I wanted to see if you could help me understand how the fmDNS client determines if the client is already installed or not. I see this in the client code that seems to rely on the server but I'm not familiar enough with PHP to find the server side of this. Can you provide a TLDR on how the server determines this? I have a container right now that works great on the same host as the server but for some reason keeps reinstalling when run from another host. Thanks!

@Mr-Mors Have you considered adding your Dockerfiles/build files to your repo? It would be helpful at times to see how you went about doing various parts of the container.

myah-mitchell commented 2 years ago

@MeCJay12 take a look at the following. Looks like there is an update to fmDNS (5.2.1) that i need merge. Otherwise these are functioning images. https://github.com/micah-mitchell/fmDNS-docker https://github.com/micah-mitchell/facileManager-docker

MeCJay12 commented 2 years ago

@micah-mitchell Thanks for the links. I wasn't aware of your repo before now. I will be putting this in the toolbox. That said, at least in my environment, your container seems to have the same issue as mine. I feel like it has something to do with the client address since the server will view it differently when behind a reverse proxy (like in my env).