Closed MaximilianKohler closed 5 months ago
Hello,
Docker containers are isolated and won't conflict with your system's PHP and Nginx. There could be a conflict with ports, so if port 80 is already taken, you could change it in docker-compose.yml to use another one.
If there is a problem with Composer installation for non-docker setup, you could try to run it locally and copy the vendor folder.
Ok, I changed the ports to 82:82 and it worked, but when I went to http://serverip/login it shows a prompt to login but the prompt just refreshes after entering my admin username and pw, and then gives an nginx error (401 Authorization Required) if I click cancel. I thought it might have to do with the .htaccess
file, so I renamed that to apache .htaccess
then ran sudo docker compose stop ; sudo docker compose up -d
, but that didn't change anything.
I think it was a Centmin Mod thing because it seemed to accept my centmin mod password but then I get an nginx 404 page.
Maybe it's a port issue?
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4674173afcfd sesdashboard-php-fpm "/usr/sbin/php-fpm8.…" 56 minutes ago Up 56 minutes 9000/tcp sesdashboard-php-fpm
8ef212cbf7d5 mysql:8.0 "docker-entrypoint.s…" 56 minutes ago Up 56 minutes 3306/tcp, 33060/tcp sesdashboard-mysql
23c10ffd7bfa nginx:alpine "/docker-entrypoint.…" 56 minutes ago Up 56 minutes 80/tcp, 0.0.0.0:82->82/tcp, :::82->82/tcp sesdashboard-webserver
Looking at this example traefik config https://github.com/Nikeev/sesdashboard/issues/52#issuecomment-1348543609 they use "80" instead of "80:80". So I tried "82" instead of "82:82" but that didn't help. But it did change the outcome of docker ps
:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e28b6030697f nginx:alpine "/docker-entrypoint.…" 21 seconds ago Up 21 seconds 80/tcp, 0.0.0.0:1024->82/tcp, :::1024->82/tcp sesdashboard-webserver
4674173afcfd sesdashboard-php-fpm "/usr/sbin/php-fpm8.…" About an hour ago Up 21 seconds 9000/tcp sesdashboard-php-fpm
8ef212cbf7d5 mysql:8.0 "docker-entrypoint.s…" About an hour ago Up 21 seconds 3306/tcp, 33060/tcp sesdashboard-mysql
I tried http://serverip:82/login and got a "connection refused". I put it back to "82:82", restarted docker, and tried http://serverip:82/login again and still got a "connection refused". "80:82" gives a conflict error.
"82:80" worked. http://serverip:82/login says "file not found". http://serverip/login = 404. http://serverip:80/login redirects to http://serverip/login.
I gave up and copied the traefik config https://github.com/Nikeev/sesdashboard/issues/52#issuecomment-1348543609. I got a conflict error:
Error starting userland proxy: listen tcp4 0.0.0.0:443: bind: address already in use
I changed the ports to "82" and "333:333" and it "worked" but when I visit sesdashboard.xxxxx.com
I get an nginx 404. I think one of the problems may be a firewall issue, but I don't want to disable my whole firewall to troubleshoot that.
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8b8373d02656 nginx:alpine "/docker-entrypoint.…" 8 seconds ago Up 7 seconds 80/tcp, 0.0.0.0:1027->82/tcp, :::1027->82/tcp sesdashboard-webserver
97a1924c21b1 traefik:2.9 "/entrypoint.sh --pr…" 8 seconds ago Up 7 seconds 80/tcp, 0.0.0.0:333->333/tcp, :::333->333/tcp sesdashboard-traefik-1
f22e95623bc8 sesdashboard-php-fpm "/usr/sbin/php-fpm8.…" 3 minutes ago Up 7 seconds 9000/tcp sesdashboard-php-fpm
1afbe03b4a3b mysql:8.0 "docker-entrypoint.s…" 3 minutes ago Up 7 seconds 3306/tcp, 33060/tcp sesdashboard-mysql
I'm out of ideas.
I looked it up and replacing "80:80" and "443:443" with one of these "81:80", "8880:80", "8089:80", "8443:443", "9443:443", seems to be correct. And then visit http://serverip:81/login. But with the traefik config it should be loading at sesdashboard.xxxxx.com. But I still get an nginx 404 with "81:80" and "8443:443" in the config. It shows the favicon though:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dbe573427416 nginx:alpine "/docker-entrypoint.…" 9 seconds ago Up 8 seconds 0.0.0.0:81->80/tcp, :::81->80/tcp sesdashboard-webserver
77abc5af17b8 traefik:2.9 "/entrypoint.sh --pr…" 9 seconds ago Up 8 seconds 80/tcp, 0.0.0.0:8443->443/tcp, :::8443->443/tcp sesdashboard-traefik-1
f22e95623bc8 sesdashboard-php-fpm "/usr/sbin/php-fpm8.…" 2 hours ago Up 8 seconds 9000/tcp sesdashboard-php-fpm
1afbe03b4a3b mysql:8.0 "docker-entrypoint.s…" 2 hours ago Up 8 seconds 3306/tcp, 33060/tcp sesdashboard-mysql
And http://serverip:81/login says "file not found". As does http://serverip:81. And they have no favicon.
Ooo I upgraded the error. I added proxy_pass to the vhost nginx config (/usr/local/nginx/conf/conf.d):
location / {
proxy_pass http://127.0.0.1:81;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
And now sesdashboard.xxxxx.com has a "file not found" instead of an nginx 404.
I did searches for "docker file not found browser" but I didn't see anything that seems helpful. I disabled my firewall and it didn't do anything.
Thinking about this more, it seems odd that it didn't give an error for port 9000 too since I already have php-fpm running globally on that port.
sudo netstat -nlpt |grep 9000
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 1040/php-fpm: maste
Also, this docker config isn't installing any "SES dashboard" app, it's installing things that are already installed on my server -- nginx, php-fpm, mysql. There doesn't seem to be any need for this docker config...
Looking at the docker installation instructions, I'm guessing that make init
executes the Makefile
file. Looking at that file, it seems that it installs PHP Composer anyway? So I'm not even saving any resources by using docker?
Ok, I removed proxy_pass since it doesn't appear necessary. I restarted nginx and visited sesdashboard.xxxxx.com and it doesn't load a page but rather downloaded this file (Y94myS8Q
):
<?php
use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
Since I don't see any reference of a server or nginx in the makefile, I removed the webserver lines from the docker-compose
file and ran sudo docker compose stop ; sudo docker compose up -d
again, and it's still downloading that file.
I realized I've been using sudo docker compose stop ; sudo docker compose up -d
every time I make changes and perhaps that's not correct. Maybe I should be running make init
instead. I tried that, and it doesn't seem to be correct since it brought me through the username, password, and email steps and then threw an error There is already a user registered with the "xxx" email.
.
I ran docker compose down --rmi all -v --remove-orphans
and it still tries to download the file when I visit sesdashboard.xxxxx.com.
If you run docker compose down and something still opens at sesdashboard.xxxxx.com, it means your local web server is running at that address. Most likely, it is the server that makes the requests. You need to either set up a completely local environment or use the docker option.
make init
deploys the project in docker, your local php, nginx and mysql are not involved. Even the composer command in the Makefile accesses composer inside the php-fpm docker container. In addition, the default behavior for starting a project in docker is http://server-ip/. If you need to configure something else, you need to configure phpdocker/nginx/nginx.conf
file and docker-compose.yml
if you need other ports.
You need to either set up a completely local environment or use the docker option.
Ok, I'll add this to the OP to highlight it as the answer.
If there is a problem with Composer installation for non-docker setup, you could try to run it locally and copy the vendor folder.
Regarding this, I tried it and it doesn't seem to be "complete". I even tried to copy over the whole /home/nginx/domains/sesdash.xxx.com/
directory, which includes vendor
and everything else. The login page loads but trying to login causes an error:
Oops! An Error Occurred
The server returned a "500 Internal Server Error".
Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
And once, when refreshing the login page it showed Invalid CSRF token.
in red text.
Oh, nvm, I was thinking the other commands here https://sesdashboard.readthedocs.io/en/latest/install.html#shared-hosting-installation were dependent on Composer. I ran both of the bin/console
commands and solved the issue.
EDIT: dev says:
I'm a total noob, but I have some experience running listmonk with and without docker. Looking at the installation instructions https://sesdashboard.readthedocs.io/en/latest/install.html#docker-installation, the docker install downloads the contents of the .zip file https://github.com/Nikeev/sesdashboard/releases. In that folder there's a
docker-compose.yml
, which I assume is whatmake init
will read from.Looking at the
docker-compose.yml
I expect it to not work properly. It looks like it's set up to install its own version of nginx and mysql, and even php? So I'm guessing that's going to conflict with my system which already has each of those installed.For comparison, here are the nginx and docker configs that get listmonk working on an nginx vhost https://github.com/knadh/listmonk/issues/1590#issuecomment-1812399067.
Am I correct that it's not possible to install sesdash on my system with docker? Or is there another
docker-compose.yml
file I could use? If not, maybe running it via Docker Desktop on my PC could work?