Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application does not update after deployment in App Engine

I have just started with GAE and I have already encountered problems on the way. When I deploy an app, it does not seem to be updating it and when I run it in the browser, it still runs the old version.

My simple code is:

import java.io.IOException;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class AppEngineProjectServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws IOException {
    resp.setContentType("text/html");
    resp.getWriter().println("<p>Hi there</p>");
}

}

I have created a new web application project in Eclipse and I got that code. I have just changed the text from 'Hello World' to 'Hi there' and when I deploy it, it still runs Hello World!

I also try changing versions of the app when deploying and setting the new version to default but nothing seems to work for me. Is there any particular reason why is that happening that I might have overlooked?

like image 508
Adrian L Avatar asked Oct 16 '13 17:10

Adrian L


2 Answers

If you want to see your changes immediately after uploading, change the application's version, then change the default in the admin console.

When you update, App Engine doesn't immediately hunt down and restart all of your instances. Such a thing would be traumatic for the users of large apps with many instances, especially when that app's instances are slow to start up.

like image 123
Dave W. Smith Avatar answered Oct 22 '22 01:10

Dave W. Smith


After a long chat session the OP problem has been solved.

Major points:

  1. Always test your app locally (using the Development Server) before deploying to the cloud
  2. Look out for browser caching issues (use Ctrl+F5 to refresh and discard local cache)
  3. If you want to mitigate the risk of breaking production, change the application version before deploying to the cloud
  4. After the deploy, check your application administrative console on GAE
    1. Under Administration -> Admin Logs check for a new entries like "Deployed a new version"
    2. Under Main -> Versions make sure to visit the recent deployed version Live URI [version].[app-name].appspot.com).
    3. Again, make sure that browser caching is not getting in the way (Ctrl+F5 is your friend)
  5. Also, to avoid runtime exceptions, if you updated your persistence layer in such a way that new indexes needs to be built, check Data -> Datastore Indexes to make sure that no index is still building (this can take hours or even days).
  6. When you are done testing (make sure that the Live URI version is working properly) just make the new version default (under Main -> Versions).
  7. It is advisable to do some A/B testing. GAE has a built in support for Traffic Splitting. Do not jump the gun and promote a new version to default before you are feeling 100% sure that it works as expected (200% actually). While you can always change the default version to a previous one, your users will not be happy if you rollback (trust me... been there, done that).
like image 26
Anthony Accioly Avatar answered Oct 22 '22 00:10

Anthony Accioly