Open-Building-Management / emoncms

emoncms home-assistant addon
MIT License
5 stars 1 forks source link

Login issues #27

Open bmentink opened 5 days ago

bmentink commented 5 days ago

Hi, I have this sort of running in portainer. However, there are a couple of issues:

  1. The webpage does not come up correct on http port 8081, it just shows the login page, but only with the door at top right, nothing else. Clicking the door does nothing.

  2. If I login via https, I can get in and enter my account details, however the page is insecure. I take it the certificates have not been set up.

I don't need https for my application, so help getting login via http would be good.

alexandrecuer commented 4 days ago

if you don't ship your own certificates, the connexion on https is insecure but the connexion on http works without those certificates.

You can login with http://ip:8081 if you run the image on port 8081

The most basic way to run the emoncms container is :

docker run --rm -p 8081:80 -p 7883:1883 -v /data:/data -it alexjunk/emoncms

There is more help on the discussion part of the repo : https://github.com/Open-Building-Management/emoncms/discussions/5

And also on the specific documentation site : https://emoncms-docker.github.io/

I also mostly don't run the docker image with https but with http

I don't use portainer but simply docker and docker compose anyway things should work straigthforward with portainer.

Which tag do you use ? latest ?

PS : If you want more detailed help, please give more context, I dont know how portainer works....

PS2 : I've understood you dont want to run https, but there is some info here https://github.com/Open-Building-Management/containers/tree/main/emoncms/alpine_persistent#adding-ssl-and-https-for-secure-operation

alexandrecuer commented 4 days ago

Edit : things work also fine with portainer

image image

small test with the latest tag

sudo docker run -it --rm -p 8999:80 -p 6883:1883 -it alexjunk/emoncms

the log should be something like that

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service emoncms_pre: starting
Creating timeseries folders
initializing a security.conf file in /config
Creating a new mariadb
CUSTOMIZING APACHE CONF FOR EMONCMS
APACHE ACCESS LOG TO STANDARD OUTPUT
APACHE ERROR LOG TO STANDARD ERROR
CREATING /etc/my.cnf
CREATING MQTT CONF
GENERATING EMONCMS SETTINGS.INI
CREATING USER/PWD FOR MOSQUITTO
Warning: File /etc/mosquitto/passwd has world readable permissions. Future versions will refuse to load this file.
To fix this, use `chmod 0700 /etc/mosquitto/passwd`.GENERATING config.cfg for BACKUP MODULE
GENERATING backup.ini PHP extension
s6-rc: info: service emoncms_pre successfully started
s6-rc: info: service redis: starting
s6-rc: info: service mosquitto: starting
s6-rc: info: service mariadb: starting
s6-rc: info: service apache2: starting
s6-rc: info: service redis successfully started
s6-rc: info: service mosquitto successfully started
s6-rc: info: service apache2 successfully started
s6-rc: info: service mariadb successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
s6-rc: info: service sql_ready: starting
2024-11-12 10:18:22 0 [Note] Starting MariaDB 10.11.6-MariaDB source revision fecd78b83785d5ae96f2c6ff340375be803cd299 as process 141
[Tue Nov 12 10:18:22.743405 2024] [ssl:warn] [pid 142:tid 142] AH01906: localhost:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Tue Nov 12 10:18:22.746481 2024] [ssl:warn] [pid 142:tid 142] AH01906: localhost:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
2024-11-12 10:18:22 0 [Note] InnoDB: Compressed tables use zlib 1.3.1
2024-11-12 10:18:22 0 [Note] InnoDB: Number of transaction pools: 1
2024-11-12 10:18:22 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2024-11-12 10:18:22 0 [Note] mysqld: O_TMPFILE is not supported on /var/tmp (disabling future attempts)
[Tue Nov 12 10:18:22.777286 2024] [mpm_prefork:notice] [pid 142:tid 142] AH00163: Apache/2.4.62 (Unix) OpenSSL/3.1.7 PHP/8.2.20 configured -- resuming normal operations
[Tue Nov 12 10:18:22.777348 2024] [core:notice] [pid 142:tid 142] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
2024-11-12 10:18:22 0 [Note] InnoDB: Using Linux native AIO
2024-11-12 10:18:22 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2024-11-12 10:18:22 0 [Note] InnoDB: Completed initialization of buffer pool
2024-11-12 10:18:22 0 [Note] InnoDB: Buffered log writes (block size=512 bytes)
2024-11-12 10:18:22 0 [Note] InnoDB: End of log at LSN=46980
2024-11-12 10:18:22 0 [Note] InnoDB: 128 rollback segments are active.
2024-11-12 10:18:22 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2024-11-12 10:18:22 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2024-11-12 10:18:22 0 [Note] InnoDB: log sequence number 46980; transaction id 14
2024-11-12 10:18:22 0 [Note] InnoDB: Loading buffer pool(s) from /data/emoncms/mysql/ib_buffer_pool
2024-11-12 10:18:22 0 [Note] Plugin 'FEEDBACK' is disabled.
2024-11-12 10:18:22 0 [Note] InnoDB: Buffer pool(s) load completed at 241112 10:18:22
2024-11-12 10:18:22 0 [Note] Server socket created on IP: '0.0.0.0'.
2024-11-12 10:18:22 0 [Note] Server socket created on IP: '::'.
2024-11-12 10:18:22 0 [Note] mysqld: ready for connections.
Version: '10.11.6-MariaDB'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Alpine Linux
mysql running, so workers can be started
Securing mysql, creating database emoncms and user emoncms
["CREATE TABLE `app` (`id` int(11) NOT NULL auto_increment PRIMARY KEY, `app` varchar(255), `userid` int(11), `name` varchar(255), `public` tinyint(1) DEFAULT '0', `config` text) ENGINE=MYISAM","CREATE TABLE `app_config` (`userid` int(11), `data` text) ENGINE=MYISAM","CREATE TABLE `myheatpump_daily_stats` (`id` int(11), `timestamp` int(11), `combined_elec_kwh` float, `combined_heat_kwh` float, `combined_cop` float, `combined_data_length` float, `combined_elec_mean` float, `combined_heat_mean` float, `combined_flowT_mean` float, `combined_returnT_mean` float, `combined_outsideT_mean` float, `combined_roomT_mean` float, `combined_prc_carnot` float, `combined_cooling_kwh` float, `combined_starts` float, `combined_starts_per_hour` float, `running_elec_kwh` float, `running_heat_kwh` float, `running_cop` float, `running_data_length` float, `running_elec_mean` float, `running_heat_mean` float, `running_flowT_mean` float, `running_returnT_mean` float, `running_outsideT_mean` float, `running_roomT_mean` float, `running_prc_carnot` float, `space_elec_kwh` float, `space_heat_kwh` float, `space_cop` float, `space_data_length` float, `space_elec_mean` float, `space_heat_mean` float, `space_flowT_mean` float, `space_returnT_mean` float, `space_outsideT_mean` float, `space_roomT_mean` float, `space_prc_carnot` float, `water_elec_kwh` float, `water_heat_kwh` float, `water_cop` float, `water_data_length` float, `water_elec_mean` float, `water_heat_mean` float, `water_flowT_mean` float, `water_returnT_mean` float, `water_outsideT_mean` float, `water_roomT_mean` float, `water_prc_carnot` float, `cooling_elec_kwh` float, `cooling_heat_kwh` float, `cooling_cop` float, `cooling_data_length` float, `cooling_elec_mean` float, `cooling_heat_mean` float, `cooling_flowT_mean` float, `cooling_returnT_mean` float, `cooling_outsideT_mean` float, `cooling_roomT_mean` float, `cooling_prc_carnot` float, `from_energy_feeds_elec_kwh` float, `from_energy_feeds_heat_kwh` float, `from_energy_feeds_cop` float, `quality_elec` float, `quality_heat` float, `quality_flowT` float, `quality_returnT` float, `quality_outsideT` float, `quality_roomT` float, `error_air` int(11), `error_air_kwh` float, `immersion_kwh` float, `unit_rate_agile` float, `unit_rate_cosy` float, `unit_rate_go` float) ENGINE=MYISAM","CREATE TABLE `dashboard` (`id` int(11) NOT NULL auto_increment PRIMARY KEY, `userid` int(11), `content` text, `height` int(11) DEFAULT '600', `name` varchar(30) DEFAULT 'no name', `alias` varchar(20) DEFAULT '', `description` varchar(255) DEFAULT 'no description', `main` tinyint(1) DEFAULT '0', `public` tinyint(1) DEFAULT '0', `published` tinyint(1) DEFAULT '0', `showdescription` tinyint(1) DEFAULT '0', `backgroundcolor` varchar(6) DEFAULT 'EDF7FC', `gridsize` tinyint(1) DEFAULT '20', `fullscreen` tinyint(1) DEFAULT '0', `feedmode` varchar(8) DEFAULT 'feedid') ENGINE=MYISAM","CREATE TABLE `feeds` (`id` int(11) NOT NULL auto_increment PRIMARY KEY, `name` text, `userid` int(11), `tag` text, `time` int(10), `value` double, `datatype` int(11) NOT NULL, `public` tinyint(1) DEFAULT '0', `size` int(11), `engine` int(11) DEFAULT '0' NOT NULL, `server` int(11) DEFAULT '0' NOT NULL, `processList` text, `unit` varchar(10) DEFAULT '') ENGINE=MYISAM","CREATE TABLE `graph` (`id` int(11) NOT NULL auto_increment PRIMARY KEY, `userid` int(11), `groupid` int(11) DEFAULT '0', `data` text) ENGINE=MYISAM","CREATE TABLE `input` (`id` int(11) NOT NULL auto_increment PRIMARY KEY, `userid` int(11), `nodeid` text, `name` text, `description` text, `processList` text, `time` int(10), `value` float) ENGINE=MYISAM","CREATE TABLE `postprocess` (`processid` int(11) NOT NULL auto_increment PRIMARY KEY, `userid` int(11), `status` varchar(255), `status_updated` int(11), `status_message` varchar(255), `params` text) ENGINE=MYISAM","CREATE TABLE `schedule` (`id` int(11) NOT NULL auto_increment PRIMARY KEY, `userid` int(11), `name` varchar(30), `expression` text, `timezone` varchar(64) DEFAULT 'UTC', `public` tinyint(1) DEFAULT '0') ENGINE=MYISAM","CREATE TABLE `sync` (`userid` int(11), `host` varchar(64), `username` varchar(30), `apikey_read` varchar(64), `apikey_write` varchar(64), `auth_with_apikey` int(11), `upload_interval` int(11)) ENGINE=MYISAM","CREATE TABLE `sync_feeds` (`userid` int(11), `local_id` int(11), `upload` tinyint(1)) ENGINE=MYISAM","CREATE TABLE `users` (`id` int(11) NOT NULL auto_increment PRIMARY KEY, `username` varchar(30), `email` varchar(64), `password` varchar(64), `salt` varchar(32), `apikey_write` varchar(64), `apikey_read` varchar(64), `lastlogin` datetime, `admin` int(11) NOT NULL, `gravatar` varchar(30) DEFAULT '', `name` varchar(30) DEFAULT '', `location` varchar(30) DEFAULT '', `timezone` varchar(64) DEFAULT 'UTC', `language` varchar(5) DEFAULT 'en_EN', `bio` text, `tags` text, `startingpage` varchar(64) DEFAULT 'feed\/list', `email_verified` int(11) DEFAULT '0', `verification_key` varchar(64) DEFAULT '', `uuid` varchar(36) DEFAULT '') ENGINE=MYISAM","CREATE TABLE `rememberme` (`userid` int(11), `token` varchar(40), `persistentToken` varchar(40), `expire` datetime) ENGINE=MYISAM","CREATE TABLE `multigraph` (`id` int(11) NOT NULL auto_increment PRIMARY KEY, `name` text, `userid` int(11), `feedlist` text) ENGINE=MYISAM"]\ns6-rc: info: service sql_ready successfully started
s6-rc: info: service sync_upload: starting
s6-rc: info: service service-runner: starting
s6-rc: info: service feedwriter: starting
s6-rc: info: service emoncms_mqtt: starting
s6-rc: info: service sync_upload successfully started
s6-rc: info: service service-runner successfully started
s6-rc: info: service feedwriter successfully started
s6-rc: info: service emoncms_mqtt successfully started
Error: could not load feeds
Sync all
11/12/2024 09:18:23 am
- Nothing to uploadStarting service-runner
Connected to redis server
 (sleep 96s)

then browsing to http://127.0.0.1:8999 gives : image

bmentink commented 4 days ago

Many thanks for your prompt reply.

I was having issue with the machine/browser that I was testing on, it worked fine on http port 8081 on another machine. All good now. Thanks

bmentink commented 4 days ago

I am having issues with login username/password though. I register making a new name and password, then try to use it, but the password fails, and I no longer have the opportunity to re-register, how do I fix this?

alexandrecuer commented 4 days ago

This is a single user installation of emoncms. So if you forget the password, you have to delete your container and recreate a new one. Anyway what you can do is to open a console and then update the user password using mysql in command line mode....But if you dont know how to use that tool and you are not familiar with the structure of the emoncms database, I don't recommend

bmentink commented 4 days ago

Deleting container did not work. Since I have a named volume, I guess I have to delete that as well ..? Also, can I use a username/password I had on another instance of emoncms? Or, does it not matter, if it's just local ..

bmentink commented 4 days ago

So I deleted the container, and the volume, started again, and now I can register again, but when I try to login with that username/password I set, it does not work, and the register option is gone again ... what gives ....?

I am using the "latest" image. Does the MYSQL and MQTT user and password have to match the registration details?

alexandrecuer commented 3 days ago

I guess you speak of a named volume for the data ? It is more designed to be used with a bind, but indeed it should work with a volume.

So if you forgot the password you entered, and if you delete the data bind, you will be able to restart the registration from the beginning.

As far as mysql and mqtt settings, they are defined as env vars. mqtt details can be changed when you want, mysql credits only at the first container run....of course they dont have to match with the emoncms user and password

https://emoncms-docker.github.io/setup/

When you register the first time, you are automatically logged in. What have you done then ? Did you restore a backup ? If yes, then you restored the user name and password associated to the backup and when you login the next time you have to use this username and password associated to the backup.....

If you want help, you need to explain what you are trying to achieve. Give screenshots, show log extracts....