openhab / openhab-snap

Packaging of openHAB for Ubuntu Core
Eclipse Public License 2.0
18 stars 12 forks source link

Cannot change http and https ports #43

Open tfroidcoeur opened 1 month ago

tfroidcoeur commented 1 month ago

using the ubuntu 24.04 snap. I already have a services running on ports 8080 and 8843, so I want openhab to use different ports (I temporarily disabled those services while installing openhab).

$ sudo snap install openhab
openhab 4.1.1 from openHAB Foundation e.V. (openhab) installed

I need to change the http port, so

$ sudo snap set openhab openhab.http-port.value='8088'
2024-06-01T10:16:49+02:00 INFO Waiting for "snap.openhab.openhab.service" to stop.
$ sudo snap set openhab openhab.https-port.value='8843'
2024-06-01T10:18:40+02:00 INFO Waiting for "snap.openhab.openhab.service" to stop.

but the service is still configured on port 8080/8443:

$ sudo ss -tlpn | grep -e 8080 -e 8088 -e 8843 -e 8443
LISTEN 0      50                            *:8080             *:*    users:(("java",pid=472890,fd=155))                                                                                                                                             
LISTEN 0      50                            *:8443             *:*    users:(("java",pid=472890,fd=53))    
$ sudo snap logs openhab
2024-06-01T10:23:26+02:00 openhab.openhab[470584]: /snap/openhab/2629/runtime/bin/stop: 81: [: {: unexpected operator
2024-06-01T10:23:26+02:00 openhab.openhab[470584]: /snap/openhab/2629/runtime/bin/karaf: 75: [: {: unexpected operator
2024-06-01T10:23:26+02:00 openhab.openhab[470584]: /snap/openhab/2629/runtime/bin/karaf: 81: [: {: unexpected operator
2024-06-01T10:23:55+02:00 systemd[1]: snap.openhab.openhab.service: Deactivated successfully.
2024-06-01T10:23:55+02:00 systemd[1]: Stopped snap.openhab.openhab.service - Service for snap application openhab.openhab.
2024-06-01T10:23:55+02:00 systemd[1]: snap.openhab.openhab.service: Consumed 47.830s CPU time, 605.6M memory peak, 0B memory swap peak.
2024-06-01T10:23:55+02:00 systemd[1]: Started snap.openhab.openhab.service - Service for snap application openhab.openhab.
2024-06-01T10:24:00+02:00 openhab.openhab[471764]: openHAB is not running, check if influxdb should be started/stopped
2024-06-01T10:24:01+02:00 openhab.openhab[471764]: /snap/openhab/2629/runtime/bin/karaf: 75: [: {: unexpected operator
2024-06-01T10:24:01+02:00 openhab.openhab[471764]: /snap/openhab/2629/runtime/bin/karaf: 81: [: {: unexpected operator

apparently 8088 is the port internally used by influxdb, at least I think thats why this fails:

/snap/openhab/current/conf/influxdb.conf:# bind-address = "127.0.0.1:8088"

I guess it would be good to at least document that this port is reserved

I started over again:

$ sudo snap remove openhab
$ sudo snap install openhab
$ sudo snap set openhab openhab.http-port.value='8082'
$ sudo snap set openhab openhab.https-port.value='8843'

it was still using ports 8080 and 8843. I tried to restart, getting error messages mostly:

$ openhab.stop
/snap/openhab/2629/runtime/bin/stop: 75: [: {: unexpected operator
/snap/openhab/2629/runtime/bin/stop: 81: [: {: unexpected operator
/snap/openhab/2629/runtime/bin/karaf: 75: [: {: unexpected operator
/snap/openhab/2629/runtime/bin/karaf: 81: [: {: unexpected operator
$ openhab.start
/snap/openhab/2629/runtime/bin/karaf: 75: [: {: unexpected operator
/snap/openhab/2629/runtime/bin/karaf: 81: [: {: unexpected operator
There is a Root instance already running with name openhab and pid 494419. If you know what you are doing and want to force the run anyway, export CHECK_ROOT_INSTANCE_RUNNING=false and re run the command.
fraco@froidcoeur-pc:~/ws/openhab-snap$ sudo snap restart openhab
2024-06-01T10:36:33+02:00 INFO Waiting for "snap.openhab.openhab.service" to stop.
Restarted.
$ openhab.status
/snap/openhab/2629/runtime/bin/status: 75: [: {: unexpected operator
/snap/openhab/2629/runtime/bin/status: 81: [: {: unexpected operator
/snap/openhab/2629/runtime/bin/karaf: 75: [: {: unexpected operator
/snap/openhab/2629/runtime/bin/karaf: 81: [: {: unexpected operator

but still running on port 8080/8843