Closed agilob closed 7 years ago
I believe it's not an nginx error but one with PHP accessing ElasticSearch. Look in middleware/es.php and change the ES connection to use the correct host
@Prefinem scraper works correctly and it adds magnets to ES database, ES is run on localhost:9200. How exactly do I hardcode the host in es.php?
Line 6 here: https://github.com/AlphaReign/www-php/blob/master/middleware/es.php
setHosts should accepts an ip:port setup
Docs here: https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/_configuration.html
When I defined hosts of my ip, hostname or localhost it still fails with status code 500 and doesn't even log anything. I can use ip, hostname to query ES with curl
GET /torrents/_search and it works correctly.
You will probably need to ensure that your ES is inside the same docker container as the php app or give it an external IP
Yup, www-php, scraper, ES, nginx and mariadb is in one container, I wanted to make it work out-of-box, just download docker image, start container and it's on.
so, for middleware/es.php you should have this line
$this->client = Elasticsearch\ClientBuilder::create()->setHosts('127.0.0.1:9200')->build();
where 9200 is the port that Elasticsearch is running on
If I do what exactly what you said I get:
Elasticsearch\Common\Exceptions\InvalidArgumentException: Hosts parameter must be an array of strings, or an array of Connection hashes.
in /srv/www/vendor/elasticsearch/elasticsearch/src/Elasticsearch/ClientBuilder.php:623
so I change it to:
$this->client = Elasticsearch\ClientBuilder::create()->setHosts(['127.0.0.1:9200'])->build();
and then I'm getting no error and website still doesn't work.
Oops!
Looks like we ran into a little issue. Please try again later.
Can I email you credentials to potrainer where you could login and connect to bash on the instance? You have full right to refuse if you don't want to spend your time on it of course.
Just save the Docker file for your image and send it to me here or in a gist so I can take a look.
But, that error is a good step in the right direction. I just made a change to the www-php/index.php file so if you change displayErrorDetails to true in www-php/settings.php you will see the error.
0Ok, now I'm getting a meaning full error and I think I can go somewhere from here, you can keep the dockerfile and improve it if you want, I was going to make it public on git na dockerhub anyway
#0 /srv/www/lib/rb.php(683): RedBeanPHP\Driver\RPDO->connect()
#1 /srv/www/lib/rb.php(881): RedBeanPHP\Driver\RPDO->runQuery('show tables', Array)
#2 /srv/www/lib/rb.php(902): RedBeanPHP\Driver\RPDO->GetAll('show tables', Array)
#3 /srv/www/lib/rb.php(3448): RedBeanPHP\Driver\RPDO->GetCol('show tables', Array)
#4 /srv/www/lib/rb.php(5636): RedBeanPHP\Adapter\DBAdapter->getCol('show tables')
I had missing dependencies on ubuntu 16.04 it should be apt-get install php7.0-mysqli and mariadb-client not php7.0-mysql and
Glad to hear you got it resolved! I will add these to the list
Cheers for help, I made it work out of box in docker instance, pull image and start it, done. Will share it in a few days.
Awesome. Glad to hear!
Some suggestions:
To anyone who wants to run this as docker container
What are the out of date dependencies for scraper? They should be able to be upgraded.
I removed some of the domain specific stuff from settings.php
➜ scraper git:(master) npm install
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
Ah, those are included by another package. I will have to trace it down. Thanks
Hi,
I'm trying to build a complete docker image with scraper and website. I got scraper working correctly, it download all metadata and ES works correctly too, but when I try to connect to www-php
browser -> nginx-proxy -> docker -> nginx
it fails to set hosts variable, the error I'm getting isThe website just shows:
nginx in docker uses nginx.conf file you provided in the repo, my proxy config in main nginx is:
Any idea what might be wrong with that config?