NathanVaughn / powerpanel-business-docker

Docker image for CyberPower PowerPanel Business
https://hub.docker.com/r/nathanvaughn/powerpanel-business
MIT License
25 stars 15 forks source link

[Feature Request] Powerpanel Management Edition #4

Open MeCJay12 opened 2 years ago

MeCJay12 commented 2 years ago

It would be cool to see management addition added as an option to install :)

NathanVaughn commented 2 years ago

I can look into it. I don't have a network card on my UPS (I made this for myself) so it's pretty hard for me to test.

On Mon, Jan 10, 2022, 22:18 MeCJay12 @.***> wrote:

It would be cool to see management addition added as an option to install :)

— Reply to this email directly, view it on GitHub https://github.com/NathanVaughn/powerpanel-business-docker/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACB4QK5ADYHJ7N7BXYUFJOLUVOVSLANCNFSM5LVJQNGQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

MeCJay12 commented 2 years ago

Let me see how I can help. I have 5 cards. I started working on the expect file and the Dockerfile but I ran into some issues. When you built the local/remote expect files, did you just run sudo autoexpect ./ppb... or did you have any flags? My install-mgmt.exp keeps getting stuck right after 5B in the license when I'm building the image.

NathanVaughn commented 2 years ago

I created the expect scripts just by running autoexpect sudo ./ppb-linux-x86_64.sh in WSL, then modified the selection for local vs remote install.

I'm having trouble reproducing it, but I've run into an issue in the past where for some reasonautoexpect would garble a few characters. I would try checking the expect script wherever it's getting hung up, and make sure the text is correct, line-by-line.

MeCJay12 commented 2 years ago

Alright, I've got the container built and running. I am, however, running into an issue where mounting anything to the db_ directories breaks the container. I see in your sample docker compose that you have the db mounted. Did you see anything like this? I'm going back and testing with remote-450 and I'm seeing a similar crash there so I'm thinking there is something wrong with my mount points.

NathanVaughn commented 2 years ago

No, I haven't seen any weird crashes like that before. I've had a lot of problems with version 450 and above with reverse proxies, but nothing database related.

On Wed, Jan 12, 2022 at 8:09 PM MeCJay12 @.***> wrote:

Alright, I've got the container built and running. I am, however, running into an issue where mounting anything to the db_ directories breaks the container. I see in your sample docker compose that you have the db mounted. Did you see anything like this? I'm going back and testing with remote-450 and I'm seeing a similar crash there so I'm thinking there is something wrong with my mount points.

— Reply to this email directly, view it on GitHub https://github.com/NathanVaughn/powerpanel-business-docker/issues/4#issuecomment-1011675543, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACB4QK7FIRD5GWCKRDUYIL3UVYX55ANCNFSM5LVJQNGQ . You are receiving this because you commented.Message ID: @.***>

MeCJay12 commented 2 years ago

Can you do me a favor and try to run my build with the db mounted and see if you have an issue? I have your repo forked here with the changes: https://github.com/MeCJay12/powerpanel-business-docker. Just clone it and run build.mgmt.sh. The container will use the tag power.mgmt and the DB is is db_management like you'd expect from the others.

NathanVaughn commented 2 years ago

Sorry for the delay, some things came up in the past week. I cloned your repo and ran the build.mgmt.sh script in WSL, then tried to launch the container. Whether I tried to add a bind mount for /usr/local/ppbe/ or not, it fails to start. docker run power.mgmt -p 3052:3052 Lots of SQL errors, it's definitely something with the database. image

MeCJay12 commented 2 years ago

No worries. I made a change to the Dockerfile. It looks like the VOLUME line makes the container fail immediately. I removed the VOLUME lines and I can run all three (local, remote, mgmt) WITHOUT a mount. As soon as I try to mount the db for any of them they fail; your builds or mine. Is that consistent with what you see? As far as I can tell, it uses a SQLite backend which is very temperamental in Docker (and in general).

NathanVaughn commented 2 years ago

After pulling your latest changes, mounting the directory makes no difference for me, it fails to launch either way.

/mnt/c/Users/nvaug/Repos/powerpanel-business-docker-mecjay12 master 13ms 
WSL - nathan@Hercules >> ./build.mgmt.sh
--2022-01-18 19:29:09--  https://dl4jz3rbrsfum.cloudfront.net/software/ppb470_mgt-linux-x86_x64.sh
Resolving dl4jz3rbrsfum.cloudfront.net (dl4jz3rbrsfum.cloudfront.net)... 54.230.252.114, 54.230.252.82, 54.230.252.6, ...
Connecting to dl4jz3rbrsfum.cloudfront.net (dl4jz3rbrsfum.cloudfront.net)|54.230.252.114|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 139763403 (133M) [application/x-sh]
Saving to: ‘ppb-linux-x86_64.sh’

ppb-linux-x86_64.sh                               100%[=============================================================================================================>] 133.29M  14.1MB/s    in 9.0s    

2022-01-18 19:29:18 (14.7 MB/s) - ‘ppb-linux-x86_64.sh’ saved [139763403/139763403]

[+] Building 6.6s (10/10) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                               0.0s
 => => transferring dockerfile: 38B                                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                                  0.0s
 => => transferring context: 34B                                                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/ubuntu:latest                                                                                                                                   6.4s
 => [internal] load build context                                                                                                                                                                  0.0s
 => => transferring context: 14.75kB                                                                                                                                                               0.0s
 => [1/5] FROM docker.io/library/ubuntu:latest@sha256:b5a61709a9a44284d88fb12e5c48db0409cfad5b69d4ff8224077c57302df9cf                                                                             0.0s
 => CACHED [2/5] RUN apt-get update && apt-get install -y       curl       ca-certificates       libgusb2       libusb-1.0-0       usb.ids       usbutils       expect       --no-install-recomme  0.0s
 => CACHED [3/5] COPY ppb-linux-x86_64.sh ppb-linux-x86_64.sh                                                                                                                                      0.0s
 => CACHED [4/5] COPY install.exp install.exp                                                                                                                                                      0.0s
 => CACHED [5/5] RUN chmod +x ppb-linux-x86_64.sh && chmod +x install.exp && expect -d ./install.exp && rm ppb-linux-x86_64.sh && rm install.exp                                                   0.0s
 => exporting to image                                                                                                                                                                             0.0s
 => => exporting layers                                                                                                                                                                            0.0s
 => => writing image sha256:3c90427526eca3f374f9db139651d97a5e834cd73c0653a6401424751721396c                                                                                                       0.0s
 => => naming to docker.io/library/power.mgmt                                                                                                                                                      0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
/mnt/c/Users/nvaug/Repos/powerpanel-business-docker-mecjay12 master 18.262s 
WSL - nathan@Hercules >> docker run power.mgmt --rm -p 3052:3052
[DEBUG][22/01/19 01:29:35] [ com.cyberpowersystems.ppbe.startup.Startup.start(Startup.java:71) ] inside ppbe Bootsrap.start()
[DEBUG][22/01/19 01:29:35] [ com.cyberpowersystems.ppbe.startup.Startup.start(Startup.java:75) ] heapMaxSize : 239075328 Bytes / 228 MB
[DEBUG][22/01/19 01:29:35] [ com.cyberpowersystems.ppbe.startup.Startup.launchTomcat(Startup.java:116) ] Launch tomcat
[DEBUG][22/01/19 01:29:35] [ com.cyberpowersystems.ppbe.startup.Startup.getModuleListValue(Startup.java:335) ] Load module list setting
[DEBUG][22/01/19 01:29:36] [ com.cyberpowersystems.ppbe.startup.Startup.loadSslSetting(Startup.java:236) ] Load database https setting
[DEBUG][22/01/19 01:29:36] [ com.cyberpowersystems.ppbe.startup.Startup.launchTomcat(Startup.java:119) ] before start
[DEBUG][22/01/19 01:29:36] [ com.cyberpowersystems.utility.os.OperationSystem.isVirtualAppliance(OperationSystem.java:180) ] etc/config.properties (No such file or directory)
Jan 19, 2022 1:29:36 AM org.apache.catalina.core.StandardContext setPath
WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []
[DEBUG][22/01/19 01:29:36] [ com.cyberpowersystems.ppbe.startup.Startup.launchTomcat(Startup.java:153) ] tomcat add management
[DEBUG][22/01/19 01:29:36] [ com.cyberpowersystems.ppbe.startup.Startup.launchTomcat(Startup.java:155) ] /usr/local/ppbe/./web/CenterWeb-0.0.1-SNAPSHOT.war
Jan 19, 2022 1:29:36 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-3052"]
Jan 19, 2022 1:29:36 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Jan 19, 2022 1:29:36 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Tomcat]
Jan 19, 2022 1:29:36 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.40
Jan 19, 2022 1:29:36 AM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
INFO: No global web.xml found
Jan 19, 2022 1:29:36 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jan 19, 2022 1:29:36 AM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet [jsp] as unavailable
Jan 19, 2022 1:29:36 AM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [jsp] in web application [] threw load() exception
java.lang.ClassNotFoundException: org.apache.jasper.servlet.JspServlet
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1364)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1185)
        at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:546)
        at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:527)
        at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:150)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1042)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:983)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4956)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5270)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Jan 19, 2022 1:29:36 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jan 19, 2022 1:29:36 AM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet [jsp] as unavailable
Jan 19, 2022 1:29:36 AM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [jsp] in web application [/management] threw load() exception
java.lang.ClassNotFoundException: org.apache.jasper.servlet.JspServlet
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1364)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1185)
        at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:546)
        at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:527)
        at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:150)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1042)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:983)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4956)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5270)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1423)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1413)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Jan 19, 2022 1:29:36 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-3052"]
[DEBUG][22/01/19 01:29:36] [ com.cyberpowersystems.ppbe.startup.Startup.launchTomcat(Startup.java:180) ] tomcat start
[DEBUG][22/01/19 01:29:36] [ com.cyberpowersystems.ppbe.startup.Startup.launchTomcat(Startup.java:183) ] getServerBuilt : Apr 10 2019 14:31:19 UTC
[DEBUG][22/01/19 01:29:36] [ com.cyberpowersystems.ppbe.startup.Startup.launchTomcat(Startup.java:184) ] getServerInfo : Apache Tomcat/8.5.40
[DEBUG][22/01/19 01:29:36] [ com.cyberpowersystems.ppbe.startup.Startup.launchTomcat(Startup.java:185) ] getServerNumber : 8.5.40.0
[DEBUG][22/01/19 01:29:36] [ com.cyberpowersystems.ppbe.startup.Startup.start(Startup.java:83) ] Bootsrap.start(): startup finished in linux

While the container runs, I don't think it's starting correctly as I get connection refused on port 3052.

Also, I don't think it uses SQLite, but rather HyperSQL (never heard of it before, but I'm not a Java person).

root@4665cb638014:/usr/local/ppbe# cat db_local/filedb.properties 
#HSQL Database Engine 2.4.1
#Tue Jan 18 17:42:51 CST 2022
version=2.4.1
hsqldb.script_format=3
modified=yes
tx_timestamp=0
root@4665cb638014:/usr/local/ppbe#
MeCJay12 commented 2 years ago

Do you get similar errors if you mount the db from your images as well or is this unique to my builds/environment? I was getting the db errors on both of our builds.

NathanVaughn commented 2 years ago

I'm getting DB errors as well on version 450 as well on my image. I have no idea why either. I've still been running 440 in my homelab because I hadn't been bothered enough yet to dig into it.