Emoncms access issue (403) on docker

I posted the issue also in GitHub:
I installed on ubuntu 20.04 server in docker emoncms and I always get the error at access (with localhost:8080) → 403 -Forbidden, you don’t have the permission to access/ on this server (Apache 2.4.38 (Debian Server). I stopped apache on the ubuntu server already, stopped the firewall, changed port settings to 8070/70 but I always get the same issue. Before I used this setup on a Synology Nas and it worked… (with an older Emoncms Docker image).

during docker-compose up I get these messages:

root@ubuntu1:/etc/emoncms-docker# docker-compose up
Creating emoncms-docker_redis_1 ... done
Creating emoncms-docker_db_1 ... done
Creating emoncms-docker_web_1 ... done
Attaching to emoncms-docker_db_1, emoncms-docker_redis_1, emoncms-docker_web_1
db_1 | 2020-08-30 22:17:18+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.5+maria<del>focal started.
db_1 | 2020-08-30 22:17:18+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1 | 2020-08-30 22:17:18+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.5.5+maria</del>focal started.
redis_1 | 1:C 30 Aug 2020 22:17:18.439 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1 | 1:C 30 Aug 2020 22:17:18.439 # Redis version=5.0.9, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1 | 1:C 30 Aug 2020 22:17:18.439 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
db_1 | 2020-08-30 22:17:19 0 [Note] mysqld (mysqld 10.5.5-MariaDB-1:10.5.5+maria<del>focal) starting as process 1 ...
redis_1 | 1:M 30 Aug 2020 22:17:18.442 * Running mode=standalone, port=6379.
redis_1 | 1:M 30 Aug 2020 22:17:18.442 # Server initialized
redis_1 | 1:M 30 Aug 2020 22:17:18.442 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 30 Aug 2020 22:17:18.442 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: Using Linux native AIO
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: Uses event mutexes
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: Number of pools: 1
redis_1 | 1:M 30 Aug 2020 22:17:18.443 * DB loaded from disk: 0.002 seconds
redis_1 | 1:M 30 Aug 2020 22:17:18.444 * Ready to accept connections
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: Using SSE4.2 crc32 instructions
db_1 | 2020-08-30 22:17:19 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: Completed initialization of buffer pool
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: 128 rollback segments are active.
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: 10.5.5 started; log sequence number 45139; transaction id 21
db_1 | 2020-08-30 22:17:19 0 [Note] Plugin 'FEEDBACK' is disabled.
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1 | 2020-08-30 22:17:19 0 [Note] InnoDB: Buffer pool(s) load completed at 200830 22:17:19
db_1 | 2020-08-30 22:17:19 0 [Note] Server socket created on IP: '::'.
db_1 | 2020-08-30 22:17:19 0 [Warning] 'proxies_priv' entry '@% root@3721b0d4f36c' ignored in --skip-name-resolve mode.
db_1 | 2020-08-30 22:17:19 0 [Note] Reading of all Master_info entries succeeded
db_1 | 2020-08-30 22:17:19 0 [Note] Added new Master_info '' to hash table
db_1 | 2020-08-30 22:17:19 0 [Note] mysqld: ready for connections.
db_1 | Version: '10.5.5-MariaDB-1:10.5.5+maria</del>focal' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
web_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.4. Set the 'ServerName' directive globally to suppress this message
web_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.4. Set the 'ServerName' directive globally to suppress this message
web_1 | [Sun Aug 30 22:17:20.308514 2020] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.3.9 configured -- resuming normal operations
web_1 | [Sun Aug 30 22:17:20.308574 2020] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
web_1 | localhost:80 172.18.0.1 - - [30/Aug/2020:22:18:05 +0000] "GET / HTTP/1.1" 403 503 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0"

Any idea? Thank you very much for your help!

How did you install? Suspect the Apache configuration is listening on port 80 (the usual HTTP Port).

I used the description in GitHub - emoncms/emoncms-docker: Emoncms docker container(s) -so I used:
$ git clone GitHub - emoncms/emoncms-docker: Emoncms docker container(s)
$ cd emoncms-docker
$ docker pull openenergymonitor/emoncms:latest
$ docker-compose up

and I also tried the manual way described - both resulted in the same issue

OK. Sorry, but I know nothing about this image @glyn.hudson may be able to help.

Is there another docker image you recommend?

Hello @ger73 you could try if you like v2 of the docker image, it is a paused development so never fully reached the release stage, but I think it does work from what I remember GitHub - emoncms/emoncms-docker at v2

I’ve just tested myself and the emoncms/emoncms-docker image works for me, maybe double-check the firewall is open on port 8080?

The terminal output from you posted from the container startup all looks good, and is identical to the output I have with no errors. This indicates the issue may not be with the container:

Try running this simple port checker image:

docker run -it --rm -p 8080:8000/tcp qmcgaw/port-checker

If it’s working you should see some info text on port 8080

The emoncms-docker uses port 8080 by default, this can be changed here if needed:

1 Like

I don’t understand it - having not the emoncms container running the port checker is checking - as soon as I start the emoncms container I get the error the port is allocated.

So it seems for me the 8080 is open (ufw firewall is inactive currently). In parallel I installed the full version (what was not my plan ) and it seems to work (even with the data on a nfs share)… So for now I think I will stick with the normal installation instead of container. Thank you very much for your help! BR Gerald

You must still have the emoncms container running, or some other service using port 8080. To see what docker containers are running use:

$ docker ps

To stop all running containers use:

$ docker stop $(docker ps -a -q)

If there arent any docker containers running on port 8080 then maybe there is another service, use

$ netstat -tulpn

Then you can try the port tester again.

1 Like

@ger73, Please copy the text and paste it here rather than pasting images that are impossible to read.

When posting code or bash output, please put in 3 ‘backticks’ (found at the top left of the keyboard normally) on a line on their own, then the code, then 3 more backticks on a line following the code.

    ```
    code
    ```

If it is something like php you can add a language identifier that after the first 3 backticks so ```php

Agree with you 100% on posting code vice images, but when clicked on,

the image expands to nearly full screen width and is quite readable.

Hi, I have the same issue. emoncms installed using docker and latest from github GitHub - emoncms/emoncms-docker: Emoncms docker container(s)
I get a 403 error form the web server but installation goes fine that the get request comes across fine in the logs.
This is on a brand new 20.04 ubuntu server install.
I can provide whatever logs you need.
When I stop the containers and run netstat -tulpn, nothing is shown on 8080.
the port-checker command shows text on 8080

sudo ufw status shows ‘inactive’.

I’m trying to move my emoncms from a raspi zero to a server running docker.

Error message in Firefox/Chrome
" Forbidden

You don’t have permission to access / on this server."

Hi Aaron, at the end I changed the port to 8090:80 and now it is running - the crazy thing is I didn’t see anything on 8080… Where to change: emoncms-docker/docker-compose.override.yml at master · emoncms/emoncms-docker · GitHub
BR Gerald

Hi Gerald,

Thank you for showing me this.

When I change the port in .override.yaml from 8080 to 8090 though I get the same 403 error;

Forbidden

You don't have permission to access / on this server.
Apache/2.4.38 (Debian) Server at 192.168.1.11 Port 8090

I dont understand why because permissions are set by docker. I do have to run docker-compose as sudo tho

Hi Aaron - sorry for being late - when I recognized it doesn’t work on docker, I made a complete local install (which worked) - then I tried to bring up docker again (then this worked, too) - so afterwards I deleted the local install - So at the end I don’t know what was the real reason - for me it looked like the open port 8090:80… BR Gerald

I had this issue just now. It turned out to be a simple oversight on my part but it took a minute to figure it out. Since this topic is the first result on google: if you get a 403 after running docker compose up then you should check that you first ran ./bin/setup_dev_repositories - if you skip that step, there is nothing copied into the container, so there is nothing for Apache to serve, and it gives a 403 instead.

I stopped the containers, ran that command then compose up again, and I get the emoncms login screen.

See 2a5b9c1

Hi @Dave-McCraw, welcome.

Would you have a set of instructions for creating a docker version of emoncms?

It is a question that comes up occasionally, but there is not a great deal of experience here with docker (for me pretty much zero).

I’m afraid I don’t really have much experience of either docker or emoncms. A few years ago I did run a local emoncms and tinker around a bit, just trying to get back into it now and wanted a container option if possible to reduce maintenance headaches.

I started with a clean vanilla installation of Ubuntu server, then I followed the installation instructions here to install docker engine and docker compose, then I followed the instructions on the emoncms docker repo here, but the step to run setup_dev_repositories isn’t obvious. I might submit a PR onto that readme file just now.

1 Like

Ok thanks. Just to know those instructions do seem to work is a help.

If you could do the PR that would be great.

Sure. I submitted it as issue #39 and PR 40

2 Likes