So I want to run two socket.io Server / Laravel Echo Server on one physical server. On this server there is a Virtual Host for Production and another one for testing purposes. Now they both need a connection to a Websocket running on the same server.
Is this possible without broadcasting Events to the wrong instance? Or should I run a second instance of the Laravel Echo Server on another port an let both Environments connect on different Socket.io servers?
Is there a common approach?
Related
I have a Laravel app running locally using ./vendor/bin/sail up. I also have a trivial NodeJS server (running locally as well) that waits 60 seconds on each request and returns dummy data. The Laravel app makes a request to the Node app and becomes unresponsive to client requests until the 60 seconds are up.
Is this a limitation of the Laravel dev server? Is there a setting I'm missing?
Answering my own question.
Laravel uses php artisan serve underneath sail, which in turn uses the built-in server, which by default "runs only one single-threaded process."
However, "You can configure the built-in webserver to fork multiple workers in order to test code that requires multiple concurrent requests to the built-in webserver. Set the PHP_CLI_SERVER_WORKERS environment variable to the number of desired workers before starting the server. This is not supported on Windows."
Adding PHP_CLI_SERVER_WORKERS=5 to my .env file fixed the issue.
Follow the official doc I have buit a simple graphql server, and use express to serve it locally (for development), I also build a web app which uses Apollo-Client to get the data from the server.
Now I want to deploy my Apollo-Server to another computer which is on the same LAN, you can consider it as the "PROD".
I saw on the official site it recommends using Heroku, but I don't need any cloud platforms. What are the steps to serve my Apollo-Serve on a local machine? (because it's internal use only, I also want to turn on the graphql playground)
Assuming that:
You have your GraphQL server running at localhost:4000 (or any other port)
You have enabled the playground (it's enabled by default)
Your machine allows inbound network connections (at least from your LAN)
Then this is just a matter of figuring out what your machine's local network name or IP address is.
Let's say your local network name is wtf.local - then you should be able to connect to your server from another machine by going to the url http://wtf.local:4000
Or if you know your local IP, say 192.168.0.22, then try http://192.168.0.22:4000
Good day everyone, I have a Laravel application that is supposed to connect to a remote MYSQL database in production, and to ease deployment I am using docker. I have setup a GitHub actions workflow that is triggered when I push to master branch, the workflow essentially runs a couple of tests and then builds my app into an image and then pushes to docker hub.
To avoid database connection issues when composer dump-autoload is run during the build process, I allowed connection from any host (changed bind-address to 0.0.0.0 in mysql config) and also setup the mysql user to connect from any host. This seems to do the trick but my concern is obviously exposing my database service to the entire world. Fortunately its possible to setup my own dedicated server for Github actions, which means I can easily restrict my db service to that host. Would that be the Ideal solution or there is way to run the workflow without needing to connect to a database?.
Try to connect to remote database using an SSH Tunnel
ssh -N -L 3336:127.0.0.1:3306 [USER]#[REMOTE_SERVER_IP]
With this you do not need to publish MySQL to the world and could bind it to 127.0.0.1 on Remote host.
I am connecting to an external Mongo DB that only accepts certain IPs. I have a Meteor instance running on Heroku, and I have a Quotaguard static URL that I am trying to route Meteor through so I can connect to the Mongo server from that IP. Currently I have two environment variables on Heroku:
HTTP_PROXY=http://user:password#1.2.3.4:5678
HTTPS_PROXY=http://user:password#1.2.3.4:5678
However, when I check the logs, the application was not connecting to the database from my proxy IP. It was connecting as if there were no proxy. Is there an extra step I must take on Heroku?
I've to design a solution that permits to read real-time data generated by local sensors through a remotely-hosted web application.
The design is still work in progress: the sensors' data could be handled by a windows application/service installed on the client machine, or by some external hardware (like a raspberry) located on the same network of the client machine.
Now, I'm very new to WebSockets, but they seems exactly what I need for providing real-time data via browser.
My question is: can a remote web application open a WebSocket to a server that is located on the same local network which the client belongs to?
Is solution B possible? How can I achieve that?
For example, I'd like the server to be located on the client localhost. Sensors would send data to the local windows service, and the web application would show them by opening a WebSocket to localhost (client localhost, not server localhost!).
Well, I did some testing and the answer is yes, it is possible.
Test setup:
A web page hosted on a remote server, with a WebSocket client which connects to 'localhost'.
WebSocket server running on my pc.
It worked.