In this final part of the Guestbook tutorial, you learn how to deploy your application, including generating the Cloud Datastore indexes required for deployment.
This page is part of a multi-page tutorial. To start from the beginning and see instructions for setting up, go to Creating a Guestbook.
When you test and exercise your app on the development server, the development
server automatically creates any Cloud Datastore indexes required to
run in production.
These indexes are generated in
and are automatically uploaded when you deploy your app.
To generate indexes so you can deploy your app:
Using the development server, exercise all of the queries supported by the app.
Open the file
guestbook/target/guestbook-1.0-SNAPSHOT/WEB-INF/appengine-generated/datastore-indexes-auto.xmlin an editor and make sure that it contains the following:
<datastore-indexes autoGenerate="true"> <datastore-index kind="Greeting" ancestor="true" source="manual"> <property name="date" direction="desc"/> </datastore-index> </datastore-indexes>
Typically, you have to change
For complete information about indexes, see Datastore Indexes.
Deploying your app
To deploy your app to App Engine:
Change to the
appengine-java-guestbook-multiphase-master/finaldirectory, and invoke Maven:
The first time you upload, you are prompted to supply login information and are led through the login process in the browser. Follow the prompts. You might need to copy the success code from the browser into the command line at the end of the login process. This information is retained so you don't need to repeat this process.
Wait for the upload to complete. When the upload succeeds, you see a message similar to this one:
... 98% Uploading index definitions. Update for module default completed successfully. Success. Cleaning up temporary files for module default...
To run the application, browse to the following URL:
[PROJECT-ID]with your project ID.
Troubleshooting deployment failures
Your update attempt might fail with a message similar to this one:
404 Not Found This application does not exist (app_id=u'your-app-ID').
This error will occur if you have multiple Google accounts and are using the wrong account to perform the update.
To solve this issue:
Change directories to
Locate a file named
.appcfg_oauth2_tokens_java, and rename it.
Try updating again. You will be prompted to authorize the upload again.
That's it! You have completed this code walkthrough.
You might want to check out the following features:
- Authenticating users with Google Accounts or OAuth
- Reading and writing logs, which shows how to write application logs and how to interpret the system logs
- Using Task queues, which shows how to use task queues to do background work to be run after the request