Google App Engine: How to perform a remote deploy to dev app server? - google-app-engine

I am in the process of setting up a "QA environment" for my GAE app. This QA environment will simply be a small server on my home network with a dedicated IP address. I'm writing an Ant script to check the project out of my SVN repo, build it on my build server, and then deploy it "remotely" (across my home LAN) to the QA app server.
With Tomcat, I would just scp the web archive to the machine's webapps/ directory, and since it can be configured to hot-deploy, that is all I usually need for a QA deploy.
But I'm new to GAE, and so I'm not seeing how I can achieve such a remote deployment via Ant. The best I can think of (although somewhat convoluted) would be:
Checkout and build the WAR on the buildserver, like I normally would
scp the WAR to a staging directory, somewhere on the QA machine; say 192.168.1.55:/opt/gae/staging
Have a lightweight RESTful web service running on that machine (maybe hosted by Tomcat or Jetty) listening for a client to hit a certain API, say http://192.168.1.55:8080/GaeRemoteApi/deploy; when the request handler gets a request for this URL, it kicks off a shell command to copy the WAR into the correct directory and then execute appcfg.sh -upload to actually deploy the WAR to my QA app server
I'm pretty sure I could get this working within a day or two, but was wondering if the GAE ships with an easier (baked in) solution; or if a fresh set of eyes can think of something even simpler. Thanks in advance!

I think you should just keep it simple:
Since you are on Ubuntu, you can write a shell script that will:
ssh to the remote server
stop the current gae dev appserver
rename the existing war directory
scp the new deployment to the QA server war directory
ssh to the QA server and start the gae dev appserver
You can call a shell script from ant using: http://sumedha.blogspot.com.au/2008/06/how-to-call-shell-script-from-ant.html
To stop the dev appserver:
killall -e ./appengine-java-sdk/bin/dev_appserver.sh
To run the dev appserver:
nohup ./appengine-java-sdk/bin/dev_appserver.sh you/war/directory &

Run the development server?
https://developers.google.com/appengine/docs/java/tools/devserver

Related

How to see console.logs of a running nodeJs application on ubuntu 18 EC2 instance?

I am new to the node world. I created a node js rest API. When I run npm start in my local machine or in the terminal for the first time, I can see console.log() in my terminal. Now, I am running the same application on an AWS Ec2 instance with Ubuntu as os. I run npm start and serve my app on port 80. I do this via ssh and after running my server I close the ssh connection. But when I reconnect via ssh, I want to see those console.log() messages in my terminal for some purpose.
I completely understand that logging messages in the terminal is not a good idea and there can be so many alternatives. Just want to know how to access the same terminal window/result as we see when I start my application.
if you are using pm2, you can try "pm2 logs"
So Nodemon won't work well in a production server or in any instance where you need to have the app going by itself.
Nodemon is a dev tool to enable you to restart your server during development. In a "real" vps you need to place the process in the background or it will be automatically killed when the connection times out.
Check out this YT series for a correct deploy architecture in an NGINX server with the use of pm2 and NGINX on a Red Hat server, I've personally used it more than once:
https://www.youtube.com/playlist?list=PLQlWzK5tU-gDyxC1JTpyC2avvJlt3hrIh

Tosca and Jenkins

Does anybody work with Tosca and Jenkins?
I have problems to run my batch script from Jenkins. It does not open browser, but job is finished successfully. Batch script runs normally when I try to run in on Windows, without Jenkins.
Anybody has an experience using these two tools together?
In order to use Tosca CI with Jenkins you need to:
Configure your Jenkins build project
Add an additional build step (Execute Windows batch command)
Call ToscaCIClient.exe/ToscaCIClient.jar with parameters
e.g. "PathToTosca\ToscaCI\Client\ToscaCIClient.exe" -t junit -r PathToResults\result.xml
Further information can be found here: https://support.tricentis.com/community/article.do?number=KB0012411
The issue your facing is because your running Jenkins as windows service, in this case headless execution happens technically your script is executed for other user account.
Solution
Instead of installing Jenkins host it on Apache Tomcat server
Download Jenkins war file
Copy it inside webapps folder of Tomcat
Run startup.bat
Refer-
https://www.tutorialspoint.com/jenkins/jenkins_tomcat_setup.htm
I had faced the same issue.
I am guessing your slave machine running the test has jenkins services installed as services.
Uninstall the service. (.jenkins/jenkins-slave.exe uninstall)
Use the .jnlp or slave.jar to connect the machine as a slave.
Your test should run fine after that.
If it does just create a batch file to connect the machine as slave whenever it is logged in.
I tried that. But in any case, Jenkins does not open the browser, so Tests from Execution List and I do not know why.
We use Tosca 10.

Google App Engine - Can't download localhost datastore for uploading to production server?

I have a set of data that I would like to use for production but I can't seem to get appcfg.py to download the localhost datastore. I have localhost:8080/_ah/remote_api on in app.yaml then, in the SDK shell, i ran
appcfg.py download_data --filename=local.db --url=http://localhost:8080/_ah/remote_api -A [MYAPPID]
I get this error message:
You must be logged in as an administrator to access this.
I can't find a way to authenticate my google account as the admin. any advice?
This is a general issue of remote_api admin authentication to the local development server, you may want to star it: https://code.google.com/p/googleappengine/issues/detail?id=12445. Several workaround suggestions in there (YMMV according to other posts)
The most recent one (2 days old) looks promising:
Workaround for appcfg.py upload_data to local dev server,
"Refreshing due to a 401" issue. Tested using Java dev server 1.9.42:
Log into the local dev server Development Console in a browser.
Open your browser's dev tools and pull the value for the dev_appserver_login cookie.
Edit lib/oauth2client/oauth2client/client.py in the app.
Find "def new_request" function. Before line self.apply(headers) in this function, add:
headers['Cookie'] = 'dev_appserver_login=your-cookie-value-here';
Run the upload_data command.
There's also this recipe, successful at the time, but it might be a bit old now:
appcfg.py shows You must be logged in as an administrator

Can run Angular app from local computer but not from local server

I can start and run my Angular app fine from my local computer. But I have never run it on a server before.
I have tried uploading it to the server. On the server I type the following to start it:
http-server
Then I visit http://serverip:8080/. Instead of seeing my app I see:
Index of /
(-rw-rw-r--) 847B app.js
(-rw-rw-r--) 748B index.htm
Node.js v0.10.25/ ecstatic server running # 195.189.182.160:8080
What is missing in my configuration?
ecstatic is a static file server. It's not set up to be a web server by default, even though it can work that way. When you do run it as a web server, certain standard options in most web servers - like treating a request for /path/ as a request for /path/index.htm - are disabled by default.
You need to enable opts.autoIndex. The package readme tells you how to do that. In your case, it means editing http-server or the .js file that it fires off; it's hard to say from what you have posted.

How to deploy an application on cluster using appscale?

I'm trying to run a GoogleAppEngine Application on my laptop using AppScale. I was following the instructions in this link , and all goes just fine until the deployment part.
appscale deploy ~/path-to-your-app
I dont know what path i have to put. The directory that contain my application is on my desktop. so i did
vagrant#precise64:~$ appscale deploy /Users/Mac/Desktop/MyApp
/Users/Mac/Desktop/MyApp is not a tar.gz file, a zip file, or a directory. Please try uploading either a tar.gz file, a zip file, or a directory.
But the virtual machine doesn't have access to it.
You must scp the application to the machine where the AppScale tools are located. Optionally there is a web interface to upload applications from the AppScale dashboard.

Resources