Google App Engine - Hosting project and website on same server - google-app-engine

I have a NodeJs App Engine project . I also have an Apache website in another server which hosts the project dashboard. This site is the one using the node API.
I am willing to host both projects on the same server on this Google Cloud project.
Can this be achieved simply by using services in the app.yaml?

I also have an Apache website in another server which hosts the project dashboard.
What does this other server actually do? If it's serving static files, you could easily do this by adding a static_dir handler in your app.yaml
handlers:
# All URLs beginning with /dashboard are treated as paths to
# static files in the web-dashboard/ directory.
- url: /dashboard
static_dir: web-dashboard
If there is actual webserver code running, you could set up and app engine flex with a custom runtime & dockerfile to run apache
https://cloud.google.com/appengine/docs/flexible/custom-runtimes/
But an easier lift would be just rewriting your webserver code to work with one of app engines existing flex runtimes https://cloud.google.com/appengine/docs/flexible/
Once you do that, then you route traffic between the 2 services with dispatch.yaml
https://cloud.google.com/appengine/docs/standard/python/reference/dispatch-yaml

Related

React Github page not working as expected

I have create created a react app for ticket management and for connect with backend i have defined proxy in package.json as shown in the figure. this is finely working in local host. when i publish to github page, it not able to connect to backend and get 404 error since the proxy in package.json is not considering now. So how i define a proxy as like in the packag.json to github page i have hosted
github ripo: https://github.com/pranavmappoli/supportdesk
hosted page: https://pranavmappoli.github.io/supportdesk/
backend URL: https://pranavhelpdesk.herokuapp.com/
how could i resolve this issue other than putting the path in .env file
The webpack proxy is designed to be used as a hack during development.
In production you are supposed to configure CORS on the API or deploy the app to the same origin as it so you don't need a proxy.
An an alternative (not one I'd recommend) you could build a production ready proxy. If you do that then it will need to support CORS and cannot be hosted on Github pages which only support statics files.

Process for React App deployment to Azure Web?

I am currently trying to deploy the default react web app to Azure and I am encountering an issue where though I deploy the contents of my build folder to the azure hosted /site/wwwroot folder I end up on the following page when going to my hosted address: https://[project_name].azurewebsites.net/
Landing Page :
I intend to deploy the default create-react-app react application so that I may have the process down for when I deploy my real site.
The process I have followed is pretty much exactly what is mentioned in this article https://medium.com/#to_pe/deploying-create-react-app-on-microsoft-azure-c0f6686a4321
Create the default React App with create-react-app
Run "npm run build" to get the build folder
Go into the Azure React Portal and create a new Web App ***
FTP / Git deploy the contents of the local build folder into the Azure website's /site/wwwroot/ folder
For overkill I added the below web.config file to handle future routes, but have also tried without this step
In the end my Azure site's contents look like this
Folder contents :
At this point when I try to access the Azure site I get the "Hey, Node developers!" page which implies my code is not deployed. Any thoughts as to why this might be the case?
*** I have a hunch that during the configuring of the Azure Web Api something is not set up correctly perhaps because I select Node 10.14 as my Runtime stack simply because that is the version of Node that I have installed and am using with my local React app.
Thank you folks for your time.
Another approach is to configure Azure Linux Web App Service to run a startup command to serve your React app in "Settings > General settings > Startup Command":
pm2 serve /home/site/wwwroot/ --no-daemon
Remember to change the path to your build path (The path to your index.html file).
If you use react-router and wants to make any direct access on custom routes be handled by index.html you need to add --spa option on the same command.
pm2 serve /home/site/wwwroot/ --no-daemon --spa
Using --spa option pm2 will automatically redirect all queries to the index.html and then react router will do its magic.
You can find more information about it in pm2 documentation: https://pm2.keymetrics.io/docs/usage/pm2-doc-single-page/#serving-spa-redirect-all-to-indexhtml
I've coped with the same problem recently: React router direct links not working on Azure Web App Linux
You have created a Linux App Service - your web.config won't work because there is no IIS.
If you don't select node as the runtime stack, your app will work for the most part because it serves the files like a static web host. However I would suggest to keep the runtime stack as node and add the following file to your deployment in the wwwroot folder:
ecosystem.config.js
module.exports = {
apps: [
{
script: "npx serve -s"
}
]
};
https://burkeknowswords.com/this-is-how-to-easily-deploy-a-static-site-to-azure-96c77f0301ff
There's an extremely simple way to overcome this problem, and although it is not perfect, it works both on AWS, Microsoft Azure, and probably any other hosting:
Just point the error document to: index.html
I found it out here:
https://stackoverflow.com/a/52343542/3231884
Disclaimer: This solution is not perfect and impacts SEO. Google doesn't rank well sites that throw 404s.

Deploy local angularjs application to webserver

Hi all i have completed my webapplication using angularjs, In local iam using tomact server in eclipse and it is working fine, Now i want to deploy my application to webserver what is the process to do it.
For ex : my local url is : http://localhost:8080/Hms/#/
i want to the url as http://www.hms.com
Please help me i am new in angularjs
If your angular web application depends on Tomcat server;
If you haven't own server for web hosting which has http ://www.hms.com, your hosting provider should provide Tomcat feature.
If you have own server for web hosting which has http ://www.hms.com, just copy paste your all files in your project folder e.g. $TOMCAT_PATH/webapps/your-project-root/. And redirect http ://www.hms.com to Tomcat port (default is 8080)
If you are using only AngularJs, it shouldn't depend on Tomcat. You can use angular boilerplate https://github.com/adilkaraoz/ngbp. Github link provides information in details. With ngbp, just copy build folder inside into the your web hosting and at the and you have http //www.hms.com url which include your web files.
You can deploy this project same as how you are deploying other web applications in tomcat. Hope you build a war file and deploy them.
Angularjs is a javascript framework as Jquery. For server it's javascript, which will be served back to the client as other js files.
Please refer how deployments are done tomcat. Just fyr, https://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html
Thanks.

Use SSL with Dart and Managed VM's

I wish to know how I can use a secure connection (https) with Dart and Managed VM's on localhost and when it's deployed.
Thank you.
When an application is deployed using gcloud preview app deploy the default is that the App Engine application will be served on both HTTP and HTTPS. If you have an application on
http://project.appspot.com
you can access it using HTTPS on
https://project.appspot.com
If not accessing the default version the URL are:
http://version.project.appspot.com
and HTTPS on
https://version-dot-project.appspot.com
Note the first . changing to -dot-.
You can specify the following int the app.yaml to only serve the application over HTTPS:
- url: /.*
script: dummy
secure: always
This will also redirect from HTTP to HTTPS, but unfortunately not do the rewrite from . to -dot- if not using the default version.
For local development using gcloud preview app run it is not possible to use HTTPS. The following quote is from the App Engine documentation:
The development web server does not support HTTPS connections. It
ignores the secure parameter, so paths intended for use with HTTPS can
be tested using regular HTTP connections to the development web
server.
See https://github.com/dart-lang/appengine/issues/16 and https://cloud.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Secure_URLs.

Connection between two custom App Engines

How do I connect between two App Engines?
I want to run a custom runtime with nginx for serving my frontend files and an other App Engine serving the backend with nodejs.
In my "one server setup" i use nginx to proxy everything from /api/ to localhost:3000 (my node instance)
I think i could start the Backend, look up the internal ip and proyx to that but i'd guess thats not the right way and it wouldn't allow me to test locally with gcloud app run.

Resources