gcloud, python 3, app.yaml in local environement doesn't - google-app-engine

For GAE, in python 3.7, using flask, gcloud on windows 10.
Trying to put in place a service-worker, I spend 2 days not being able to load the service-worker.js file.
On localhost if the file is in the root folder, the file in inaccessible, but if I move the file to the static folder, first I have an error because the index.html is on the root but not the service worker file, and second the mine type of the sevrice worker file is text/html.
I figure I need to change the app.yaml file to specify the mine type but it doesn't seem to have any effect. After erasing everything in the app.yaml, I realize that it is not affecting the localhost. I deployed the project and it works on the gae sever.
I would like to be able to test the service-worker locally.
I am missing something?
Loading successfully on GAE:
But 404 on localhost:
You can notice the same problem with the manifest file situated in the root folder.
Thanks.

As the install process stipulate, dev_appserver doesn't work on windows with python 3.
The solution was to install a linux subsystem for windows : https://learn.microsoft.com/en-us/windows/wsl/install-win10
I use the Ubuntu app from the windows store, and follow the installation for installing the gcloud component on linux inside the ubuntu terminal:
https://https://learn.microsoft.com/en-us/windows/wsl/install-win10cloud.google.com/sdk/docs/#deb
Inside the Ubuntu terminal it is possible to access the windows file : the C drive would be /mnt/c.
Getting back to my work folder, it is possible to start the web-app using the dev_appserver command.
Using a navigator from windows we have access to the web-app as normal using localhost:8080.
The development can still be done using an IDE in windows, running the server in Ubuntu.

Related

How to copy an exe file to App Engine (flex) with Go runtime?

My Go application needs to use a stand-alone executable, which I would like to copy it along with 'gcloud app deploy' command during deployment to GAE flex environment.
I have tried keeping the exe in the folder where other go files are located during deploy, but this doesn't seem to take the exe to the GAE flex
I tried using these 2 lines in Dockerfile and changed the "runtime: custom" in app.yaml, but that didn't fix either, as I am missing few more things it seems.
FROM gcr.io/google-appengine/golang
ADD test.exe /usr/local/bin/
Can anyone suggest, without/with Dockerfile, how can I copy the test.exe and also build the go application on a GAE flex environment?
EDIT:
I realize I should install the package (Debian package) on the GAE machine itself, and make it available for the App Engine app.
Any pointers on how to prepare the Dockerfile so that the Debian package is installed with all its dependencies and is also accessible to the app that I am deploying to App Engine?
You can copy a file using the command COPY.
However, it will not work, since the VM running the GAE flex instance uses Linux as seen in StackOverflow.
I also found this related thread, it may be helpful for you.
EDIT
Other options you have to deploy your application, which is in need of a windows executable file, is to create a VM instance with Windows and deploy your application there. Or you could find an alternative for that stand-alone executable for Linux, perhaps?

how to run sencha web application without compiling

Hello I am new to Sencha. I have created a test application using sencha cmd. When I have to run it i have to compile it. Is there any way so that I can run the application without compiling and without starting web server.
You can access your uncompiled application, but you always have to use a web server to access your application, because there are problems with AJAX without a web server.
What I did to get this working:
I installed a local web server as a service (in my case it's IIS, but Apache or any other should work as well)
My local web server root directory points to my git repo directory.
In that git repo, I have the myapp-dev directory containing the uncompiled ExtJS application, the myapp directory, and the bin directory containing my backend API.
The app.json file in myapp-dev tells Cmd to compile into the myapp directory:
"output": {
"base": "../myapp",
"appCache": {
"enable": false
}
},
That way, the relative paths to the server API are the same for both the uncompiled and the compiled version, e.g. ../api/GetSettings points to the same path for both versions.
I can now open localhost/myapp-dev/index.html in the browser and get the uncompiled version, or I can open localhost/myapp/index.html in the browser and get the compiled version.
You can just place your app files in a directory inside a server root, then open the index.html directly.
While it is desirable to compile it for production (to get a better performance), it is certainly not necessary if you just want to have your app in "development" mode all the time.

How to set up my Ubuntu nodeJS server, and upload my angularJS WebSites

Does somebody know how to set up propertly websites based on angular (auto generated with yeoman) on ubuntu server?
Here is the thing, I have a project developed in angular, I generated it with yeoman (the basic example, on yeoman codelab). I can run it and see it working on my computer with "grunt serve", but I have no idea how to upload it to my server for access it from the internet.
On my ubuntu, I have installed apache2, MySQL, PHPMyAdmin, and Node (i guess I do not need apache2 for all this, but I have it anyway).
I connect with putty and the command node works fine, npm works fine too.
I am searching info, but I only found how to run a service on the node (example:node test.js) but this is not the case.
But what I want to do is to upload a website (angular) for access it from the internet...
I uploaded the "app" folder (that has the index.html, styles, controllers, views, etc) of my angular website (generated with yeoman), i uploaded it on my www directory in ubuntu, but when I access angular, or styles doesn´t work.
So, the question is: Does NODE have a "www" directory (like in apache2) where I have to upload my websites (angular websites) for access it from the internet? or I have to run it with some kind of "grunt" or "node" command?
Because i can´t run it with "node index.html", and if i access it from the internet it doesn´t work either, so... what am I doing wrong?
If you have a runnable app on local then follow these steps:
Set it up on git and host on github, bitbucket or any other git hosting and connect your server via ssh and choose/make whatever directory. (Doesnt matter which direcory, I personally prefer /var/www )
Pull that repo in that directory.
Run the app using forever or some process management tool like pm2
PS: grunt is more of a developer tool than production tool. so start your app directly using node wahtever_your_server_file_is.js in forever
Also make sure whatever port you are using to run the app is open on your server.

GoogleAppEngine wordpress complains (Could not create directory) on update and plugin install

I have a problem updating wordpress or installing wordpress plugin in my local version of google app engine. I get the following message.
Downloading install package from
https://downloads.wordpress.org/plugin/event-espresso-decaf.4.8.38.decaf.zip…
Unpacking the package…
Could not create directory.
With the same code base I am able install plugin using MAMP (Macintosh, Apache, MySQL, and PHP). However fails with google Pyton script (dev_appserver.py).
I tried changing the permission of the file system by giving privilege to all user for write. Tried executing as sudo dev_appserver.py .. Followed the advice in other post, No luck.
Whats the problem here?, With MAMP all looks good in my local, but the same code break as I deploy to GAE (​appcfg.py -A APP-ID update app.yaml). Whats the problem here
Cannot write to file on Google App Engine Dev server with PHP?
Staring SDK 1.9.18, dev_appserver disables local file writing by default to better simulate the production environment. You can enable file writing by adding "google_app_engine.disable_readonly_filesystem=1" to your php.ini file.
I also wrote a blog post about running WordPress on App Engine flexible environment at:
https://wp.gaeflex.ninja/2016/03/25/using-wordpress-multisite/
Please give it a try too.

Pycharm Run server error no app.yaml file at '.' for google app engine project

I'm pretty new with Pycharm and since this morning i have tried different configuration to use the Run command with an existing Google app engine project but without success.
I have a pretty clear error :)
google.appengine.tools.devappserver2.errors.AppConfigNotFoundError: no app.yaml file at '.'
Nothing wrong with that because the existing project use a custom file call app_dev.yaml. So it's normal that Pycharm is unable to load the server.
How can i change this behaviour and tell Pycharm to use app_dev.yaml instead of app.yaml?
Is it possible?
Thanks
I input an app.yaml on root directory and reloading my project, this working for me.
While the PY-9714 issue was, indeed, closed without a resolution, the automatic '.' added to the Run configuration has been reconsidered in PY-10675 in light of GAE support for multiple modules/services inside the same application and/or request routing using a dispatch.yaml file.
So in the more recent PyCharm versions it's possible to specify one or more .yaml files as options in the Run configuration. See for an example Pycharm multiple modules Run server
For those still running an older Pycharm version without the fix, a solution using a wrapper script is described in Run App Engine development server with modules in PyCharm

Resources