ask-cli deploy lambda takes long time - alexa

Whenever I try to run ask deploy lambda for the python lambda, it first attach and zip all the libraries and then updates the lambda scripts, which takes a long time. Is there any way to limit it to only updating the .py files that changed?
Thanks,

as far as I know there is no "changeset" concept from Lambda service to only provide the changed part of the code. Hence ask-cli might be able to do that.
CLI can deploy smartly when it's related to the changes in AWS service using cloudformation, like it only deploys changes for the modified service. With this idea, CLI does support localHash comparison to avoid unnecessary deployments, if there is no change to your code at all locally. However, it has to be the entire source code plus its build for Lambda code uploading. This means as long as you change the code, the re-build time and the upload time are kinda a must have.
Btw, how long usually do you need to wait for this code upload process?

Related

Connect to particular API based on environment

I have an AngularJS application that talks to a NodeJS backend. I have recently just hard-coded in the API address in my front-end as there has only been one environment (i.e. my development environment has been the same as my production environment).
However, as the project has expanded, I now have three environments: development, staging and production.
My development and staging environments talk to the same API (let's say dev.fooapi.com), but my production environment should be talking to a different API (let's say prod.fooapi.com).
My question is: what are some 'elegant' (I put this in quotes because who is to say what is elegant and what isn't) ways of achieving this in my application? I currently have a string placeholder in my source files that looks like 'API_PLACEHOLDER' and a Grunt task that performs a string replace anywhere in my codebase where it matches that string. Obviously this isn't ideal because the files where these placeholders are substituted are source controlled, and I don't really want to do a string replace and then accidentally commit some code that has hard coded developer API addresses because that will break in production.
Extra information: I do make use of Grunt in my application, I deploy to Windows (can't be changed, unfortunately), I use Git for source control and I do builds/deployment using Bamboo.
More than happy to answer any other questions about my issue.
Note: I need to substitute config values not only for my front end but also the back end (i.e. when I start my node server I want the port that it starts on to be configurable.
Thanks!
I'm using gulp-ng-config which allows dynamically generated angular constants to be added to my application based off the node environment variable.
In the docs from link above is an example of supply a different api url to front end app, I'm sure there is a grunt version, in fact grunt-ng-config looks like the equivalent. The values config option takes a function where you can return something based on the node environment variable

Run system tests against deployed app with Nancy.Testing

I've successfully set up some tests that run complete use cases against our code base using nancy.testing.
Now I'd like to use the same tests for what we call release tests: We deploy the complete application to a staging server and run the system tests against it. We already use that approach successfully with a WCF application.
Is there an easy way to make this work? I've noticed that Browser and BrowserResponse do not use any abstractions, so I cannot replace them with a SystemTestBrowser or similar.
I could of course abstract the whole nancy.testing package away, but I thought I ask here first if someone knows a simpler approach.
Nancy.Testing does not use any network communication at all. If you can think of a nice abstract then please let us know and we can talk and see if it's something we'd like to get into the package!

What file is always loaded with starting app engine instance?

I want to define some globals and load some modules (i.e. valid version of django) before any code is executed in app engine.
Is it any file in app engine where I can define startup code/configuration?
I think about Python language but other languages suggestion is also welcome.
Have a look at this doc. https://developers.google.com/appengine/docs/python/tools/appengineconfig appengine_config.py is loaded before any of your code.
In addition to what the docs say, you can pretty much do anything. Manipulate sys.path, import, monkey patch stuff.
For Python 2.7, if you want to load a specific version of Django, call that version out in app.yaml as noted here Django is one of the many supported third-party libraries.
An other way might be to use warmup requests. This is run on the request made in order to initialize a new server. It could be useful if you have a lot of thing to do and don't want the first request on a new server to stall... On the other hand, warmup requests can be sent even without finally using the new instance, so if you do have a lot of things to do you might end up using more instance hours. Check the documentation for more info.

using unit tests to keep index.yaml updated

So far the only way I have been able to keep index.yaml updated when I make code changes is to either hit the urls via browser or using TransparentProxy and the application is being served through dev_appserver.
This sucks.
Is there a way to bootstrap the appengine environment in the unit test runner so that what ever process is used to update the index.yaml can be run without incurring the overhead of the single threaded dev_appserver.
The difference is significant. My testsuite(80% coverage) runs at 2 minutes but does not update index.yaml, if I run the same suite using TransparentProxy to forward request to port 8080, the index.yaml does get updated but it takes about 4 hours. Again, this sucks.
You can use my Nose plugin for this, called nose-gae-index. It uses the internal IndexYamlUpdater class from the SDK, so it is definitely better than proxying requests.
Despite this improvement, there is definitely no need to have it enabled all the time. I use it before deployment and to inspect changes to index configuration caused by new commits.
Remember not to use queries that require indexes in the tests themselves, or they will be added to the configuration file as well!

How do I get closure compiler configured to run on Google App Engine Java

I suspect I need to add an Ant task somewhere, but where?
I'm not sure you'll be able to do that... App Engine has a whitelist for the classes that you are allowed to use, and I assume the Closure Compiler would most probably be useful in your case if you can send its output to files, which won't be allowed.
What you probably want to do is have your own local development environment where you develop using the Google Closure Compiler and then deploy the resulting output to your App Engine cloud service.
Or, if you really intent to call the compiler on the fly on AppEngine, do do some JavaScript meta-programming or something along these lines, then you'll probably facing some fun debugging and tweaking to get it to work. I would assume you could hook yourself onto the compiler to get the intended output in-memory instead of outputting to a file, and then inject it into your served content.
But no Ant file will magically do this for you, and even "run" the closure compiler for you on AppEngine. I think you are a bit confused as to what these technologies are and imply.

Resources