I'm new to Google App Engine, and have a node.js application that I'm deploying from a GitHub repo. Currently I seem to have to manually enter a number of steps to preview the app, and when I attempt to deploy it with 'gcloud app deploy', the server only throws a 500 error. What I'd like to have happen is have 'gcloud app deploy' actually work. Presumably that means that whether or not I'm logged into Google Cloud Services, going to lucidnodes-dev.appspot.com actually runs the app.
After two days of playing around with dockerfiles, I'm crying uncle. I need help.
The manual steps I'm running are, from inside the Google Cloud Shell:
cd LucidNodes // Enter the directory where the app files live
node index.js
This returns:
LucidNodes listening on port 3000
As is expected, and I can see the app running when I run Web Preview on port 3000.
Here is my server code:
server.js file:
const express = require('express');
const path = require('path');
const url = require('url');
var init = function( app, prt ){
app.listen( prt, () => console.log('LucidNodes listening on port ' , prt ));
};
exports.init = init;
and index.js file:
const server = require('./server');
const fs = require('fs');
const express = require('express');
const path = require('path');
const serveStatic = require('serve-static');
const serveIndex = require('serve-index');
const staticPaths = require('./defineStaticPaths');
const htmlMethods = require('./js/htmlMethods'); // import custom methods for handling HTML
const app = express();
const routes = require('./routes');
staticPaths.defineStaticPaths( app );
app.use( routes );
server.init( app, 8080 );
Note that I've changed the port on the local and GitHub instances of the app to 8080. I'm not sure if changing the port number would solve the 500 error problem when deploying and running the app, but I also couldn't get the app instance on GAE to update from the GitHub repo, hence the app is still running on port 3000 on GAE, and hence also the digression to dockerfiles, which so far has been yet another learning curve mess, but one thing at a time I suppose.
So... what I'm trying to do is get the app to actually deploy and run when I call up the lucidnodes-dev.appspot.com. How to do that?
Thanks for the help.