The following command will upload the whole project to Google App Engine:
appcfg.py -R update C:/Users/user/Desktop/myproject/
However, I just made corrections locally to a single file of the project called index.php and would like to update the server version without uploading the whole project, which is large.
I have tried:
appcfg.py update C:/Users/user/Desktop/myproject/index.php
(notice I removed -R and also added the file name at the end) But this prints:
Usage: appcfg.py [options] update appcfg.py: error:
Directory does not contain an index.yaml configuration file.
any idea?
My inexperience with google app engine made me post this question, but I got the answer on my own after a little while.
Hahahaha I just discovered something I did not know before. After making changes to the index.php file and finally decided to redeploy the whole thing. This time it took less than a minute to redeploy it to the server (the first time it took over 10).
It seems that the local appgine scans for local changes and submits just that instead of the whole project!
Therefore re-running:
appcfg.py -R update C:/Users/user/Desktop/myproject/
will update the files that were changed only.
i believe you can't. its all or nothing.
Related
I just stumbled on the following issue in App Engine Standard with a Python 2.7 enviroment
So I deployed to my test environment yesterday and today I had the idea of updating one of my applications. I do my normal "gcloud deploy ... " and it says updating 3 files ... While I actually changed a bunch of files. Basically my deploy command says the files are not changed.
After some searching around I found that files are being uploaded to a staging area and checked with a hash. Is it safe to actually clear this staging area, or does the gcloud command have some secret force option to actually force the files to be renewed.
The gcloud command has not given any errors what so ever, nor was it aborted at some point of deployment or something. So I have no errors, but my files aren't uploaded at all. I also tried modifying alot of files, and nothing changed
I never use the promote option for these rare cases that a deploy might fail
So anyone encountered this before, or has a solution to this issue ?
I also was encountering this and the only solution I could find was to deploy to a new bucket. To do this:
go to https://console.cloud.google.com/storage/browser and create a new bucket
redeploy using gcloud app deploy --bucket gs://your-new-bucket. (Change your-new-bucket to the actual bucket name)
This uploaded all the files again and created a new version in App Engine.
You can Go to https://console.cloud.google.com/storage/browser and delete your application bucket, on the next deploy it will be recreated. Additionally you can use the parameter --verbosity=info to check which files are being uploaded.
I've started to have a problem today.
Everytime I run appcfg.py update . it updates 441 project files.
Even if I just modified 1 it will upload 442.
running appcfg.py update . twice will upload 441 files every time.
This is obviusly a problem because instead uploading a couple of files it is uploading a lot of them and taking a lot of time.
This is what I have tried:
Updated app engine launcher to it latest version
Rebooted
removed all files from the folder, download them again from git
nothing seems to work.
I even left only app.yaml and index.php and it uploaded both files every time, even if I do not change anything.
Ideas? thanks
This is expected behavior. Uploading the files are always fast for me.
it is fixed now.
At the moment of this answer, google seems to have fixed the issue.
Just tried to deploy and it only uploaded the modified files.
I cannot get my server code to update. I'm running a PHP instance on GAE and no matter what I do, the files won't update. In the source code view, I can see the files have updated, but when I attempt to access the updated file, I'm still viewing the old version. I've also attempted disconnecting my Bitbucket repo and using the appcfg.py update project-name command, but the files aren't refreshing when I attempt to access them. I'm not sure what to do to force the changes to take place.
My app.yaml contains the following code
- url: /(.+\.php)$
script: \1
secure: always
So the files should be getting read, right?
I was able to figure out what went wrong. I downloaded my code using appcfg.py download_app -A <your_app_id> -V <your_app_version> <output-dir> and noticed that I was downloading the old versions of the files (and wasn't downloading the new files). Turns out using source control within GAE will upload new code, but won't deploy it. I attempted to use appcfg.py update project-name one more time, but it didn't work. Turns out I didn't disconnect my Bitbucket account (could have sworn that I did...). Once disconnected, I was able to update the project using appcfg.py update project-name. While I was figuring this out, I reached out to Google support and received this message:
To use the feature of push to deploy you need to spin-up the Jenkins
Instance on GCE (Google Compute Engine) and then it will take the
updated code and execute it in the environment. Go through [1] for how
to enable the Jenkins instance and its configuration according to
different run time.
In your issue, you just mirrored the code from Bit Bucket to Cloud
Repository, as it is just doing the version control for the
application not executing the application. So basically you have have
the option of using Jenkins instance as I described above to test the
different version of the code or using the appcfg.py update command
from your local repository.
I haven't attempted to install and use Jenkins since I fixed it after disconnecting my Bitbucket account), but it may help others who have run into this problem.
appcfg.py --oauth2 update ./ works but want to replace it with git push and deploy. After succesfull push, appengine gives me errors that my .go files are not compiled.
Is it possible for appengine to compile the files when using a git repo? If not do I need to place the compiled files in another directory?
This is a known issue. Please star it.
For now, all you can do is keep using appcfg.py. If it is cumbersome to do the OAuth authorisation all the time (or you have multiple accounts), consider storing your refresh token and then doing:
appcfg.py update . --oauth2 --oauth2_refresh_token=`cat .token`
I've accidentally added a new filter to my GAE application. The status of the index is 'serving' now - however I don't need that index at all and I'd like to remove. How can I do that?
It is documented here:
Deleting Unused Indexes
When you change or remove an index
from index.yaml, the original index is
not deleted from App Engine
automatically. This gives you the
opportunity to leave an older version
of the app running while new indexes
are being built, or to revert to the
older version immediately if a problem
is discovered with a newer version.
When you are sure that old indexes are
no longer needed, you can delete them
from App Engine using the following
command:
appcfg.py vacuum_indexes myapp/
This command deletes all indexes for the app that are not mentioned in the local version of index.yaml.
For GAE / Java, the documentation includes this information:
Deleting Unused Indexes
...
When you are sure that old indexes are no longer needed, you can
delete them from App Engine using the vacuum_indexes action:
./appengine-java-sdk/bin/appcfg.sh vacuum_indexes myapp/war
This command deletes all indexes for the app that are not mentioned in
the local versions of datastore-indexes.xml and
generated/datastore-indexes-auto.xml.
As of Feb 2019 it's now:
gcloud datastore indexes cleanup index.yaml
In Windows Google AppEngine Java, we have to use appcfg.cmd command to delete unused indexes of deployed application.
Syntax :
appengine-java-sdk-path\bin\appcfg.cmd vacuum_indexes project-root-path\poject-name\war\
For gae-java, as JochenJung mentioned, the "vacuum_indexes" tool will work, but you'll have to emulate a python project in the following way:
Note that the vacuum tool seems only to work when pointed at *.appspot.com, not the local dev. environment.
create app.yaml for your app and put this in your /myapp/ root directory, minimally:
application: myproj
version: 4
runtime: python
api_version: 1
where "version" is your app's version, "myproj" the GAE name of your project.
create an index.yaml and put it in the same root dir. Instead of laboriously putting into that file the index information for indices you want to keep, it turns out that the tool is going to give you a yes/no confirmation for each and every index it deletes, so it is simpler just to indicate that ALL indices should be dropped, and use the confirmation to preserve the ones you want to keep.
indexes:
# AUTOGENERATED
Then run the command as shown above,
/appcfg.py vacuum_indexes /path/to/myproj/
If you're using maven mvn appengine:vacuum_indexes. No need to mvn appengine:update, the command updates the remote server.
A full list of maven commands here.
On Windows using Java, this command worked for me:
appcfg.cmd vacuum_indexes C:\Users\Name\AndroidStudioProjects\Project\backend\src\main\webapp\
Note: Make sure you have a datastore-indexes.xml in the webapp folder (these indexes will be spared).
With the current version of gcloud, you can simply do:
gcloud datastore cleanup-indexes index.yaml
which is more intuitive than calling appcfg.cmd [...].
gcloud datastore cleanup-indexes /path/to/file/index.yaml
this command no longer works.
gcloud datastore indexes cleanup /path/to/index.yaml
this is the new command.
you should run them in google cloud console. normally you can upload the index.yaml file using file upload feature in google cloud console. your file goes to a directly called _admin you can cd to there and call,
gcloud datastore indexes cleanup index.yaml
Tip
if you are using datastore in a java project, you have datastore-indexes.xml instead of index.yaml. You might have some trouble finding the index.yaml file if you don't know where to look.
you can simply find the path of the index.yaml file by looking at the deploy console in your IDE.