Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yeoman to use google app engine server

I setup Yeoman 1.0 beta to handle my js/css tasks. Everything works fine that, if I run grunt server, it starts up a static server and connects a browser session to port 9000 (livereload). js/css concat, minification are also working.

Now, is there a way I can make it to connect to a google app engine development server (instead of starting a static server). The server is running at port 8080 on localhost, and I want grunt to reload the webpage upon css/js files under watch. These files would be served by GAE server.

I see a section rolling your own at grunt-contrib-connect documentation, but not sure it means an external server. As far as I see, these are the relavent configuration from Gruntfile.js

connect: {
      livereload: {
        options: {
          port: 8080, //*** was 9001 originally ** 
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, '.tmp'),
              mountFolder(connect, yeomanConfig.app)
            ];
          }
        }
      },

When I change the port number to 8080, and try to start, obviously it gives error.

Fatal error: Port 8080 is already in use by another process.

so, I don't want to start a new server, but connect through GAE server already running.

Thanks.

like image 263
bsr Avatar asked Feb 21 '13 23:02

bsr


People also ask

Which programming environment is used for Google App Engine?

js, Java, Ruby, C#, Go, Python, or PHP. A fully managed environment lets you focus on code while App Engine manages infrastructure concerns. Use Cloud Monitoring and Cloud Logging to monitor the health and performance of your app and Cloud Debugger and Error Reporting to diagnose and fix bugs quickly.

What is the AWS equivalent of Google App Engine?

The AWS Elastic Beanstalk platform is used to deploy applications. It is designed for web applications. Initially, Elastic Beanstalk used Apache Tomcat as the J2EE runtime environment. Google App Engine is a similar framework for web applications.


2 Answers

In order to use GAE server instead of nodejs server, we need to do the following.
* Compile your less/coffeescript, concat[, minify], copy your code to the location where the app engine code resides.
* Create a task in grunt.js to spawn a shell command to run app engine.

This is the example, that I used as reference. https://github.com/cowboy/grunt/tree/master/tasks

Following grunt.js file may help!

module.exports = function(grunt) {
    grunt.initConfig({
    ....
    });

    grunt.registerTask('appengine-update', 'Upload to App Engine.', function() {
        var spawn = require('child_process').spawn;
        var PIPE = {stdio: 'inherit'};
        var done = this.async();

        spawn('appcfg.py', ['update', 'build/task-manager-angular'], PIPE).on('exit', function(status) {
            done(status === 0);
        });
   });
   grunt.registerTask('clean', 'Clean the whole build directory.', function() {
        require('child_process').exec('rm -rdf build', this.async());
   });

   grunt.registerTask('run', 'Run app server.', function() {
       var spawn = require('child_process').spawn;
       var PIPE = {stdio: 'inherit'};
       var done = this.async();
       spawn('dev_appserver.py', ['.'], PIPE).on('exit', function(status) {
          done(status === 0);
       });
    });
});

//....
//Other settings
//....

grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-coffeelint');
grunt.registerTask('build', 'coffee less concat');
grunt.registerTask('deploy', 'coffee less concat build appengine-update');
grunt.registerTask('default', 'coffee less');
};
like image 107
Arshad Ansari Avatar answered Oct 17 '22 05:10

Arshad Ansari


Found this Google App Engine management plugin for Grunt

like image 25
Ron Harlev Avatar answered Oct 17 '22 05:10

Ron Harlev