Shopify CLI - How to start a local server without ngrok? - shopify-app

My organization blocks ngrok, so every time I run the Shopify serve command, it fails with a connection error.
So is there any way to just start the Shopify local server? that way I can use cloudfared to tunnel the local server to a subdomain.

When I search on google I found no answer to this question.
I had success running the server without the ngrok.
Here are my steps:
Prepare a cloud server, install Nginx.
config domain settings, and forward the request to your local port.
If you are using a router, only router has a public IP, so you need to forward the request to your pc. You could config it in the router.
then you need to update .env file, update host value
Go partner.shopify.com, app settings. put your URL to the whitelist.
use npm run dev to start your project.
I also set HTTPS in nginx. Due to ngrok server is far away from my location. so after using this way. the starting time is much faster.

Start the server by
npm run dev
instead of,
shopify app serve

Related

How to connect a Laravel Sail instance with an SSH tunnel?

I have a Laravel app which needs to connect to a secure external API with very strict access requirements. There is a handler hosted on AWS which has a bunch of signed certificates etc. The only way to connect to that API is via that specific server due to those requirements.
Now, to test things on my local machine, I do the following:
SSH to the server using the -D flag to set up a SOCKS proxy.
Use this socks to http package to convert the proxy.
Set up Postman's proxy settings to use that http proxy.
That all works fine and I can complete the requests as expected.
However, I'd like to be able to use the proxy in my local Laravel environment too, for which I use Sail.
The problem is that I'm unsure of how to get the container to interact with the proxy. Using the method above in my local machine, I can cURL the required endpoint just fine, but if I try to do it via the container itself, it refuses to connect.
Any help would be appreciated!

Fetch data from gatServerProps of NextJs app when another api server is also running in localhost

According NextJs Documentations:
You should not use fetch() to call an API route in getServerSideProps. Instead, directly import the logic used inside your API route. You may need to slightly refactor your code for this approach.
Fetching from an external API is fine!
So we cannot use NextJs built-in APIs in getStaticProps or getServerSidePropsbut when I'm going to use another API service that is based on Laravel Framework as the back server and fetch it by Axios on the getServerSideProps function, I get Error: connect ECONNREFUSED 127.0.0.1:8080 error.
It should also be noted that everything is fine if the API server is addressed out of our development machine. In Other words, It will face when it's the development environment and both Laravel backend server and NextJs front-end server locate at localhost.
Could you help me out finding a solution for this problem?
When using localhost or 127.0.0.1 inside a docker container, that points to that docker container only, not the host computer.
There are two pretty easy solutions.
Create a docker network, add both containers to that, and use container name instead of ip (https://www.tutorialworks.com/container-networking/)
Use host networking for this container: https://docs.docker.com/network/host/
Edit: Added a link for a tutorial on how to create and use docker networks
So, as #tperamaki's answer already mentions: "When using localhost or 127.0.0.1 inside a docker container, that points to that docker container only, not the host computer."
You can use the ip of your machine in your local network. By example, 196.168.0.10:8080 instead 127.0.0.1:8080.
But you also can connect to the special DNS name host.docker.internal which resolves to the internal IP address used by the host.
In your case just add the port where the othe container is listening:
http://host.docker.internal:8080
In this section of the documentation Networking features in Docker Desktop for Mac, they explain how to connect from a container to a service on the host. Note that a mac is mentioned there, but I tried it on a linux distro and it also works (also in this other answer it is mentioned that it works for windows).

Problem deploying nginx on heroku in front of server on Go

I want to deploy to heroku nginx as a reverse proxy in front of my Go application.
I made a config file for nginx, but its samples presented here https://github.com/heroku/heroku-buildpack-nginx do not give an understanding of which port to specify in the proxy_pass directive to redirect to my application. These examples use unix socket listening instead of http.
upstream app_server {
server unix: /tmp/nginx.socket fail_timeout = 0;
}
But my application is running over http.
In addition, heroku uses random ports, which the application must retrieve from the PORT environment variable. However, now I have set this variable in the config for nginx. What port should my application run on now? If you specify your own port, this will not work, since heroku will say that the port is already busy.
I am completely discouraged by the difficulty of deploying a simple environment for my heroku application. None of the heroku instructions give a comprehensive understanding of how this can be done.
Please guide me on the right path.
P.S. For a couple of days of searching for an answer, I found only a lot of questions similar to mine and not a single answer.
Update.
I did as in this post Springboot application with nginx as proxy deploy on Heroku
But the author did not explain what she set in the APP_PORT variable. I set it to 3001 and got the same thing as here:
Nginx and Heroku. Serving Static Files

How to deploy a laravel application that will be accessed over a LAN on a windows server?

I am tasked to develop a laravel project for our company. I have to deploy it within the company's network only. It is my first time to do it and haven't find any good source of instruction so far. I hope you can help me with this. I am using XAMPP for this one. And the machine runs on a Windows Server 2016.
Laravel applications are easy to install on IIS. You can use the url_rewrite extension to import the rules from the .htaccess file. Other than that it is really no different than deploying to any other server.
You can also use your company's local DNS to point to the server if you wish to access it via https://my-app.company.com.
May sure you all are one in common network
sudo php artisan serve --host 0.0.0.0 --port 81 (you can change the port if you want)
Other people will be able to access with you'r IP address http://your-pc-id-address:81

linking laravel and node app with subdomain

i currently have a running la ravel project,recently i did receive an order to make a web app for client so i made it using MEAN(mongodb,Express,Angular and Node). Unfortunately when i finished the web application the client asked for a demonstration on-line,due to huge difference in location(between me and the client) using my local development environment to showcase the working sample is not an option.i was inquiring if i could link a url from the laravel application to the node app without having to buy a domain
You can create a tunnel to your local environment by using ngrok
Follow this steps:
Download ngrok and unzip ngrok
Open a cmd / terminal and navigate to ngrok location
Type the following command:
ngrok http {your_localhost_server_port_number}
It will create the tunnel but we need to point a virtual host to it so edit your local virtual host and add an alias / server name like following:
NOTE: if you only have one app running on your local server this step is optional
*.ngrok.io
Now restart your local server to load our new configuration
Now you are able to see your localhost site online by using the ngrok provided url.
Enjoy!

Resources