Github Actions Cypress local connection issue - laravel

I have a simple GitHub Actions workflow that does the following:
Clones the backend Laravel repo and frontend Vue3 repo
Runs: php artisan serve --host=127.0.0.1 --port=1234 &
Checks the server status using curl: curl -vv http://127.0.0.1:1234 (it returns the correct response from the api)
Runs cypress:
- name: Cypress run
uses: cypress-io/github-action#v5
env:
API_BASE_URL: http://127.0.0.1:1234/
with:
start: npm run dev
wait-on: "http://127.0.0.1:1234/"
The cypress command fails with this error:
http://127.0.0.1:1234/ timed out on retry 91 of 3, elapsed 90245ms, limit 90000ms
Any idea how I can debug this properly?
I have tried to change ports (80, 8080, 1234)
I have tried to change hostname (localhost, 127.0.0.1, 0.0.0.0)
I have tried to wait/sleep before cypress starts.
Basically, the issue is that Cypress is unable to connect to my backend Laravel API that is hosted using PHP artisan serve, locally it works fine.
Thanks!

Related

solana logs failing with: Error: unable to connect to server yet solana-test-validator is running

I am trying to run the solana logs command to see the logs.
But upon running this, it fails and doesn't connect to the localhost server. see below output:
As you will see from the screenshot above, I already have the solana-test-validator running.
But solana logs --url localhost ain't working or is unable to connect to the server
The solution in my case is the url specification,
kindly note that in this case, localhost translates to 127.0.0.1 but still in my case, I still needed to even specify the port:
Thus instead of using localhost, I used:
solana logs --url http://127.0.0.1:8899

Valet 502 Bad Gateway

valet is not working after I updated php from 7.3 to 7.4. I already tried to reinstall valet, php, nginx and dnsmasq but it's still not working.
Now the ngix server is running but I can't acces to my projects. I get the error 502 Bad Gateway for every project url.
The services are running but brew services dont show the correct status.
dnsmasq unknown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
gitlab-runner started user /Users/user/Library/LaunchAgents/homebrew.mxcl.gitlab-runner.plist
mysql#5.7 started user /Users/user/Library/LaunchAgents/homebrew.mxcl.mysql#5.7.plist
nginx unknown root /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
php error root /Library/LaunchDaemons/homebrew.mxcl.php.plist
php#7.4 unknown root /Library/LaunchDaemons/homebrew.mxcl.php#7.4.plist
redis started user /Users/user/Library/LaunchAgents/homebrew.mxcl.redis.plist
Nginx error log
2021/01/27 16:35:21 [crit] 35081#0: *1 connect() to unix:/Users/user/.config/valet/valet.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/Users/user/.config/valet/valet.sock:", host: "devtest.test", referrer: "http://devtest.test/"
I've managed to get mine working again.
I started by doing a full wipe down following the instructions that valet gives when you run valet uninstall which involved removing valet and all associated config, uninstalling php, nginx and dnsmasq via brew and cleaning up all remaining config. I then reinstalled everything, reconfigured my sites in valet and tried to load one up. Still I got the 502 Bad Gateway error.
I eventually tried running valet use php to make sure it was correctly bound to the right php version. Valet claimed that is was but I ran it again with the force flag just in case valet use php --force.
After that I was up and running again. Hopefully this might help you too.
What's strange is that my brew services list output lists dnsmasq, nginx and php as status unknown but they do all seem to be running correctly. I can't work out what's happening there but at least everything seems to be working again now.

Gatsby on EC2 doesn't connect externally

I have a development installation of Gatsby Doc site running on my EC2 server.
When I run the code on my dev machine it works and I can connect my browser to port 8000 and everything is ok..
On my server i check out my github code and
yarn install
npm run start.
Everything builds correctly and Gatsby it listening on port 8000
From my dev machine when I connect using
X.X.X.X:8000 in my browser i receive
Unable to connect
I have opened the port on 8000 in the firewall and I have tested that it works as expected using:
nc -lv 8000
on the server (where gatsby is going to run) and connect using telnet.
on the server i receive
Listening on [0.0.0.0] (family 0, port 8000)
Connection from 84.232.Y.Y 38552 received!
So it works.
When Gatsby is finished starting i see
You can now view gatsbyjs.org in the browser. ⠀ http://localhost:8000/
⠀
when i enter the web address and port i receive
Unable to connect
again. do I need to start Gatsby in another mode?
Kim
I found out.
I just added -H 0.0.0.0 to the start up command and everything works now.

Accessing Dokku App url

I have deployed a sails application with dokku on a amazon ec2 instance. After deployment I randokku run app-name sails console and my sails app is running when I check the sails logs its says its running on localhost:5000.
And dokku app-name url will give me a url example.com but when I try to access example.com in the browser it doesn't work. Isn't the app supposed to run on that url given by dokku? and when I hit that url shouldn't the ngnix proxy to localhost:5000 ?
What am I missing here ?
Your application should be listening on the 0.0.0.0 interface, as otherwise the nginx process outside of the container cannot proxy to it.

Kubernetes proxy connection

I am trying to play around with kubernetes and specifically the REST API. The steps to connect with the cluster API are listed here. However Im stuck in the first step i.e. running kubectl proxy
I try running this:
kubectl --context='vagrant' proxy --port=8080 &
which returns error: couldn't read version from server: Get https://172.17.4.99:443/api: dial tcp 172.17.4.99:443: i/o timeout
What does this mean? How do overcome it connect to the API?
Check that your docker, proxy, kube-apiserver, kube-control-manager services are running without error. Check their status using systemclt status your-service-name. If the service is loaded but not running then restart the service by using systemctl restart your-service-name.

Resources