How to copy an exe file to App Engine (flex) with Go runtime? - google-app-engine

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?

Related

GAE: No longer able to update my Gaelyk project due to appcfg losing support

Recently tried to update my Gaelyk project (yes, it's old, but it works well and I still use it), but Google App Engine will no longer accept the update. The error message returned is "Deployments using appcfg are no longer supported. See https://cloud.google.com/appengine/docs/deprecations". The thing is, I never used appcfg to deploy my application; I used Gaelyk and Gradle. But obviously Gaelyk must have used appcfg under the covers.
I did download the replacement Google Cloud SDK, but this new tool is not similar at all to how Gaelyk and Gradle worked. Is there anything I can do to get Gaelyk to work anymore? Or is Gaelyk just dead and I need to rewrite my application (like in Node.js or something instead of Groovy).
This will be hard, however I will try to help you as possible. I think you may try to migrate it somehow to app.yaml configuration of GAE.
I am not sure what plugins are used in the project. From Gaelyk temple project I can see that it's using appengine-geb which, according to the documentation, behind the scenes, is using gradle-appengine-plugin (there is wrong link on this doc, but proper is bellow).
On the github of gradle-appengine-plugin I have found following.
There is a note:
NOTE: All App Engine users are encouraged to transition to the new
gradle plugin for their projects.
And in FAQ part there is following information:
How do I deploy with gcloud?
If you're using gcloud to deploy your application, the newest version of app deploy > doesn't support war
directories, you will need to provide it with an app.yaml OR you can
use the appengineStage task to create a directory that is deployable
in /build/staged-app
$ ./gradlew appengineStage
$ gcloud app deploy build/staged-app/app.yaml --project [app id]
--version [some version]
NOTES:
You must explicitly define all config files your want to upload
(cron.yaml, etc)
This does not work with EAR formatted projects.
I think the best option will be to migrate to new appenine plugin or if not possible try to implement is with gcloud app deploy command crating the config files manually (at least app.yaml). And for this migration I can provide you this document.
I hope you will manage somehow...
I can confirm that Serge's answer on the Gaelyk Groups site works; the same procedure that he figured out also worked for me. To summarize:
Run gradlew appengineRun as run previously with Gaelyk.
Copy all jar files inside the build\exploded-app\WEB-INF\lib folder into a \src\main\webapp\web-inf\lib folder (for me the new lib folder did not exist previously).
To deploy, use the new required gcloud tool, and instead of running gradlew appengineUpdate (which fails now), instead run
gcloud app deploy appengine-web.xml where that XML file can be found in your webapp/WEB-INF directory. I navigated to that directory to run the gcloud command, but you can use a relative path there if your working directory is elsewhere. (There are a number of optional flags associated with the gcloud app deploy command, but I didn't need any of them.)
Serge needed to use these instructions to convert datastore-indexes.xml to index.yaml and run gcloud app deploy index.yaml, however, I didn't need to do this because I had no datastores.

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

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.

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.

Which version of Eclipse works with PHP Google App Engine?

I've search in vain for about a month now and I can't get my PHP application pushed to Google App Engine, for the PHP platform. I've got the Java version set up nicely on my computer. I followed the instructions for GAE PHP here: https://developers.google.com/appengine/docs/php/gettingstarted/introduction
..but it's really confusing because it essentially tells me to install Eclipse made for PHP which is Luna, but the only versions of Eclipse that GAE supports is Kepler, Juno and Indigo (https://developers.google.com/eclipse/docs/getting_started), so I'm super confused.
I don't think you can install two different GAE plugins on a standard version of Eclipse (which is what I use for the Java GAE plugin).
I also tried (in vain, but it was worth a shot) to upload my app using my Java plugin/setup and obviously this was a terrible idea because all it does is just print the php script/code to the browser.
Any thoughts, brothas/sistas?
I have figured out how to push php files to GAE. There are essentially 3 ways.
Use appcfg.py. Run following command:
--appcfg.py update helloworld/, where helloworld is replaced by the name of the folder containing your project files. Make sure the path is relative to appcfg.py directory or an absolute path.
--Enter your Google username and password at the prompts.
**2. Use the App Engine Launcher, probably found in C:\Program Files (x86)\Google\google_appengine\launcher. Executable is called GoogleAppEngineLauncher.exe. Simply select the project in Launcher and click Deploy.
**3. Use Git. Create a local repository on your machine. Add a repo to your Github account, and follow these instructions: https://developers.google.com/appengine/docs/push-to-deploy#creating_a_cloud_project
**4. Use PhPStorm. Download PHPStorm for free for 30 days, or buy a student version/whatever version you quality for here: . Then follow these instructions: http://confluence.jetbrains.com/display/PhpStorm/Getting+Started+with+PhpStorm+as+Google+App+Engine+PHP+IDE. The only thing I haven't figured out is #5 - where to find the php-cgi.exe file. I can't provide a path for a file I don't have.
** denotes super easy and I have used successfully.
The Google Plugin for Eclipse is only for Java applications. For PHP applications, you'll want to use the Python/PHP SDK and either the command-line tools or the Launcher UI app for running the development server. You can still use Eclipse for editing your PHP source files.
RE #5 - "I can't provide a path for a file I don't have".
That was also my problem.
They are fond of pointing out that the SDK directory should contain dev_appserver.py and ‘google’ and ‘php’ packages but you don't find those in a simple search cause they are invisible. You have to muck through the installation directory.

Google App Engine: portable SDK or way of uploading?

I've used Google App Engine, and as far as I know the only way to update my application files on Google's servers is to use the App Engine SDK. And as far as I know the App Engine SDK is a Mac or Windows package, which is not portable (requires installation on the local machine).
I need a portable version, or another way to update my application files on Google's servers using a Mac. I found this https://code.google.com/p/appengine-portable/ which purports to offer portable versions for Windows, but not Mac.
Is there a way for me to use the App Engine SDK on Mac without installing?
Is there any alternative way for me to update my application files on Google's servers?
This is not where you looking for, but have a look at this post: http://googleappengine.blogspot.nl/2012/07/develop-in-cloud-with-exos-cloud-ide.html
I am only talking about the Python SDK here. You haven't said which .
Just use the linux SDK, and run that on Mac or Windows. I haven't used mac. But I do appengine development on Windows and Linux and have never used the Launcher. Just follow the directions for unix on windows. (Well change your file paths and slashes ;-)
The python SDK and dev server is all pure python.
The Windows and OS X packages are just the the SDK and the GUI launcher. As far as I know the SDK is pure Python and portable. Either use the SDK that comes with installer or download the SDK alone.
The linux version on the documentation download page contains only the SDK, or get it on the Google App Engine googlecode project (it will be called google_appengine_x.x.x.zip):
https://code.google.com/p/googleappengine/downloads/list
Simply download the SKD, extract it somewhere (on my Mac, I link it to /usr/local/google_appengine because some script like nosegae expects it there, but it's not necessary). The SDK doesn't need to be installed, doesn't need to be in path. You can run appcfg.py from the SDK directory or using the absolute path.
Below is the Makefile I am using to run and upload an app (with make serve and make upload):
PYTHON=$(shell pwd)/venv/bin/python
GAE=/usr/local/google_appengine
APPSERVER=${GAE}/dev_appserver.py
APPCFG=${GAE}/appcfg.py
PORT=8080
SRC=./src
.PHONY: serve upload test
serve:
open "http://localhost:${PORT}"
${PYTHON} ${APPSERVER} --port=${PORT} ${SRC}
upload:
${PYTHON} ${APPCFG} --oauth2 update ${BUILD}
test:
cd ${SRC}; ${PYTHON} runtest.py

Resources