Laravel Forge meilisearch integrating - production.ERROR: cURL error 7: Failed to connect to 146.190.87.214 port 7700: Connection refused - laravel

I am getting this error when I try to integrate meilisearch on laravel forge.
I have 2 servers, one for the app and the other one is for the meilisearch.
on laravel forge, on networking tab, I have ticked "can connect to" also.
production.ERROR: cURL error 7: Failed to connect to 146.190.87.214 port 7700: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://146.190.87.214:7700//indexes/songs/search {"exception":"[object] (MeiliSearch\Exceptions\CommunicationException(code: 0): cURL error 7: Failed to connect to 146.190.87.214 port 7700: Connection refused
this is my .env
SCOUT_DRIVER=meilisearch
SCOUT_QUEUE=true
MEILISEARCH_HOST=http://146.190.87.214:7700/
MEILISEARCH_KEY=****
Can anyone help me please?
I tried this like someone has suggested already, but it is not working and few other things.
sudo su
echo "deb [trusted=yes] https://apt.fury.io/meilisearch/ /" > /etc/apt/sources.list.d/fury.list
apt update
apt install meilisearch-http=0.20.0 -V
meilisearch
and
php artisan storage:link
php artisan passport:install

Related

Can't connect to external API using Laravel Sail

The project was working fine, suddenly I couldn't connection to Stripe nor Mailtrap APIs.
Stripe error
Could not connect to Stripe (https://api.stripe.com/v1/setup_intents). Please check your internet connection and try again. If this problem persists, you should check Stripe's service status at https://twitter.com/stripestatus, or let us know at support#stripe.com. (Network error [errno 6]: Could not resolve host: api.stripe.com)
Mailtrap error
Connection could not be established with host "smtp.mailtrap.io:587": stream_socket_client(): php_network_getaddresses: getaddrinfo for smtp.mailtrap.io failed: Temporary failure in name resolution
I tried to delete the containers and build them again with --no-cache
sail down -v
sail build --no-cache
But I got an error running apt-get commands because it can't reach to the endpoint.

phpmyadmin cannot log in to the MySQL server in laravel valet

I tried to install a phpmyadmin in laravel valet. after i run
brew install phpmyadmin I run valet link and visit the phpmyadmin in the browser by typing phpmyadmin.test
I assume that the default username and password would be 'root' and blank
but when i try to login i encounter this error
screenshot: https://prnt.sc/lva5yu
mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
If you want to use MySQL 8.0 and not get the "caching_sha2_password plugin" error, then check out a couple blog posts I wrote on how to setup MySQL 8.0 in Docker with persistent data, as well as a post on how to run your MySQL 8.0 container with mysql_native_password.
In short, you can create a local "my.cnf" config file:
$ sudo nano /usr/local/opt/mysql/config/my.cnf
Add the necessary config statement to it:
[mysqld]
default-authentication-plugin=mysql_native_password
And then include that file as a volume bind in your "docker run" statement:
$ docker run --restart always --name mysql8.0 -v/usr/local/opt/mysql/8.0:/var/lib/mysql -v /usr/local/opt/mysql/config:/etc/mysql/conf.d -p 3306:3306 -d -e MYSQL_ROOT_PASSWORD=your_password mysql:8.0
You can read more detail on these steps here:
https://medium.com/#crmcmullen/how-to-run-mysql-in-a-docker-container-on-macos-with-persistent-local-data-58b89aec496a
https://medium.com/#crmcmullen/how-to-run-mysql-8-0-with-native-password-authentication-502de5bac661

Laravel Dusk Testing has an error on the server Curl error thrown for http POST to /session with params

I would like to ask me to try the following instructions on Plesk Server:
php artisan dusk
The following error will occur:
1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"binary" :".\/vendor\/laravel\/dusk\/bin\/chromedriver-linux","args":["--disable-gpu","--headless","--no-sandbox"," --verbose","--window-size=1024,768"]}}}
Failed connect to localhost:9515; Connection refused
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:292
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:126
/var/www/vhosts/fanswoo.com/fanswoo-framework/tests/DuskTestCase.php:43
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:192
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/framework/src/Illuminate/Support/helpers.php:754
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php: 193
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:93
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:64
/var/www/vhosts/fanswoo.com/fanswoo-framework/tests/Browser/ExampleTest.php:22
I suspected that the Chrome Driver could not be executed, so I used the following command to detect:
./vendor/laravel/dusk/bin/chromedriver-linux
The return is as follows:
Starting ChromeDriver 2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d) on port 9515
Only local connections are allowed.
Indicates that ChromeDriver can be opened normally.
The code can also be detected on the local computer. Only when the dusk command is executed in Plesk Server will the error occur. May I ask what God should I continue to do or what to modify? Thank you!
The server specifications are as follows:
CentOS 7.5
PHP 7.1
DB SQLite3
Laravel Version 5.7
ChromeDriver Version 69
If you able to start chromedriver successfully, now try to access the below url with respective port.
http://localhost:{port}/status
For e.g., in above message, the server started on port 9515. Access the url in browser, http://localhost:9515/status
You should get above message indicating server is accessible with hostname as localhost
If your are not able access, then fix the specific issue

Cant connect to google cloud SQL from Compute Engine Instance

I have a Laravel application running on Google Compute Engine instance. I have configured it to connect to a Cloud SQL database Instance, when I SSH to the VM and run php artisan migrate everything runs smoothly. But when I open the application in a browser I get this Error SQLSTATE[HY000] [2002] Permission denied I cant figure out what is going wrong here, I have tried cloud sql proxy but still the application cant establish a DB connection when accessed from a browser. Can anyone figure out the cause of this weird behavior.
I solved this by enabling httpd_can_network_connect_db flag in selinux by running this command.
sudo setsebool -P httpd_can_network_connect_db=1
I also faced another issue with SELinux with redis and solved it by running this command.
sudo semanage port -m -t http_port_t -p tcp 6379

Deploying Laravel to Elastic Beanstalk - DB Connection Refused

I've been developing Laravel app and deploying regularly to an Elastic Beanstalk instance without issue, but suddenly, and without warning, deployments have begun to fail.
Obviously I immediately wondered what I might have changed in the code to cause this, but I haven't made any changes to the core configuration. I rolled back to an earlier commit just to make sure it wasn't my code, and I got the same error.
It's failing after I run eb deploy and running the .ebextensions configs.
Here's the error message from the logs:
[2018-01-08T10:50:34.672Z] INFO [9457] : Running 4 of 5 actions: EbExtensionPostBuild...
[2018-01-08T10:50:35.523Z] ERROR [9457] : Command execution failed: Activity failed. (ElasticBeanstalk::ActivityFatalError) caused by:
In Connection.php line 664:
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = custom and table_name
= migrations)
In Connector.php line 67:
SQLSTATE[HY000] [2002] Connection refused
(ElasticBeanstalk::ExternalInvocationError)
The DB connection credentials are absolutely correct (and haven't changed either).
The command that it's attempting when it fails is simply:
php artisan migrate --force
I've tried connecting over SSH to the server, and I can manually run the same command without issue.
I just can't understand why the deployment is suddenly having its connection refused. Could it be something to do with the AWS security configuration? Could it expire or something? :-/
It turns out the issue was caused by local settings becoming cached and then deployed to the server in: bootstrap/cache/config.php.
Clearing the cache with php artisan config:clear deleted the file and solved the problem.

Resources