Automatic deployment in GAE from subversion trunk - java

My team is developing a Java application which is to be deployed on Google App Engine(GAE). Currently we use the eclipse-plugin to build and deploy the code in GAE.
However, I would like to automate(by using cron or svn-post-commit hook) this process so that the source code in subversion trunk is automatically deployed in GAE before each scrum meeting. I hope this would eventually reduce the load on our programmers and help them to focus more on the application logic.
Please let me know if this is possible with Java+GAE+Subversion
thanks in advance

It is possible. This is what I did with my project. I should also note that this question is similar with another stackoverflow question in Possible to integrate Google AppEngine and Google Code for continuous integration? and it provides several good answer that you could use.
That being said, my personal approach is to set up ant build for the eclipse project, and use Jenkins to automatically update the code from Subversion and build them up using the ant build.
You could then add a target using appcfg and macro provided by google to upload your built project to Google App Engine. More details of using Ant on Google App Engine could be seen in here.
A bonus point of using continuous integration tools such as Jenkins is that you could add automated unit testing using JUnit or your personal testing flavor. It will save your team lots of headaches in the long run.

I used python for GAE and there is a appcfg.py script with which one can deploy the code with one command as -
python appcfg.py update
This makes me think that for Java as well there must be some script from Google to deploy applications. If there is one, then what you are trying to do must be a simple command which be used a cron job.

Your team should use a Continuous Integration tool, e.g. Jenkins. This will solve your next problems too, which you may not thought over: it can be configured to run unit and integration tests before deployment. It has many options for version control system integration.

Related

Selenium Java + TestNG integration with TFS

I have my selenium code in Java with TestNg framework (used Eclipse as code editor), but now I need to integrate it in TFS. I am very new to TFS but I have seen many ppl told it is possible so if somebody can help me with exact steps from starting it would be really helpful. If some hidden tips and tricks also , any body can suggest for smooth integration please do so. Thanks in advance for your time!!
The first thing is setting up your environment, both local and build server. You'd better to make they are some as each other, which could significantly reduce build issue/error.
For your local develop environment, please use Visual Studio Team Explorer Everywhere for Eclipse (VSTS and TFS) which is a plug-in for Eclipse that enables you to work with Team Foundation Server (TFS) and Visual Studio Team Services (VSTS) using both Team Foundation Version Control (TFVC) and Git version control systems.
Since you are new to TFS, suggest you first go through the build and deploy pipeline of JAVA projects with TFS. -- Working with Visual Studio Team Services (VSTS) and Java
About Selenium and test, please take a look at below tutorials:
Testing Java applications with VSTS
Selenium Java Integration with Team Foundation Server
Get started with Selenium testing in a CD pipeline

Automated testing tool for java post development

I have an existing java application which is developed in Netbeans this is my first major development project so i didn't think about the use of log4j & junit in first place(A good lesson learnt). since now i am at the end of the project i miss these two . is there is any tool or jar which can create automated testing & logging with minimum effort ? I guess Adding log4j is easy but what about junit ?
There is nothing to say that you cannot use Junit after you have created a project. It means that you are not making use of test driven development, but there is no reason why that is an issue once you have already created your project.
I would recommend the netbeans tutorial on exactly how to do that:
https://netbeans.org/kb/docs/java/junit-intro.html

Running a JAR file with cron on server?

I have written a java program which does some calculations then sends an email. I have packaged it as a jar. I need to run this program every week at midnight on Thursday. The chances are my computer is not going to be on all the time so I'll need it to run from some host. My question is - Is there a free hosting place which supports cron and java?
Hmm, I had a look at app engine but got stuck trying to install the Google plugin for eclipse. It brought up an error after clicking to install..
Cannot complete the install because one or more required items could not be found.
Software being installed: Google Web Toolkit SDK 2.4.0 2.4.0.v201208080120-rel-r37 (com.google.gwt.eclipse.sdkbundle.e37.feature.feature.group 2.4.0.v201208080120-rel-r37)
Missing requirement: Google App Engine Plugin 3.1.0.v201208080120-rel-r37 (com.google.appengine.eclipse.core 3.1.0.v201208080120-rel-r37) requires 'bundle org.eclipse.wst.sse.core 0.0.0' but it could not be found
Cannot satisfy dependency:
From: Google Plugin for Eclipse 3.7 3.1.0.v201208080120-rel-r37 (com.google.gdt.eclipse.suite.e37.feature.feature.group 3.1.0.v201208080120-rel-r37)
To: com.google.appengine.eclipse.core [3.1.0.v201208080120-rel-r37]
Cannot satisfy dependency:
From: Google Web Toolkit SDK 2.4.0 2.4.0.v201208080120-rel-r37 (com.google.gwt.eclipse.sdkbundle.e37.feature.feature.group 2.4.0.v201208080120-rel-r37)
To: com.google.gdt.eclipse.suite.e37.feature.feature.group 3.1.0
Check out Google App Engine:
https://developers.google.com/appengine/
It supports Java, and it's free within some quota.
Note that it does not support running desktop applications, but since you wrote your code in Java, it's most likely portable, and you can also take advantage of the App Engine platform services like sending emails. It also has a cron service.
Fire up an Amazon Micro Instance Server. They are free and give you complete control of the machine including setting up cron jobs.
AWS
Check out OpenShift ( https://openshift.redhat.com/app/ ).
The offer a free series of tools for small needs, and the ability to scale up from there.

Java Quickly web applicatoin deployment practices

Currentyl i am working on a Java Web Application something simple JSF + Spring + Hibernate textbook application architecture, but i find my self losting time on uploading my WAR into production every time i have to do it and also in updating MySQL scripts, so
is there any good practice to deployed Java Web Application quickly?
Edit
This is the current Process:
I work on localhost where i quickly
deploy with eclipse
If everything work fines i export a WAR with eclipse
Upload this WAR through FTP into (hosted) production server
Move this into tomcat webapps
Thanks.
Tip. I'm Using eclipse as my IDE and ain't using Maven nor Ant
There are a lot of tools you can use to automate the build and deployment process:
Compile application => deploy to local server => execute unit- and integration tests => upload WAR file to web server if all local tests pass -- this is exactly the kind of functionality that Maven and Ant were invented for!
If you want to get rid of the tedious manual work involved in these tasks, perhaps checking them out once more is not such a bad idea.
Also, there are more advanced Continuous Integration solutions, like Hudson, which help you to better integrate source code management and deployment processes.
But none of those will speed up data delivery.
It seems like your most pressing concern is to find a provider to make your internet connection faster: However you manage your build process, uploading the content to the server will quite probably be the most time-consuming part.
The single most important thing is being able to script the stuff, so you can let the computer automate it.
You may be able to get Netbeans to create build scripts for your eclipse projects so you can just run ant to create your war. If not, keep doing it manually.
Then you need to script the ftp-session. That is easy - many scriptable programs exist (or you can just use a modern Norton Commander clone supporting ftp), so script it.
Then you need to script the MySQL-script changes. This is not easy to suggest, as you did not mention what needs to be done, but you can probably get very far with a Perl script or perhaps a small stand-alone PHP snippet expanding a macro.
THen you need to collect all the steps in a single script you can then easily invoke...
(or you could just figure out how to talk to the Tomcat administrative console which allows you to update WAR files remotely - but that may not be feasible or I would have expected you to do so already)

What are the best methods for deploying java code to production?

Currently we have a Java Restlet API with dependencies controlled via Maven. When we update the API we run maven assembly:assembly which does the unit tests etc and produces a single jar file. We then upload this to the production server and run it using nohup.
Is there a better or more automated way of doing this? Is this where something like Hudson would come in?
Thanks
My experience goes with webapp-deployment. But same should hold true here. Use Maven, Cargo, Nexus (or Artifactory), Hudson and probably, Jira in conjunction of product release.
Automated release process are more reliable because there is no human factor involved that may forget a step.
We also use Liquibase for database versioning. And, if you are dealing with database changes in your application deployment. You'll realize Liquibase boosts so much confidence while running alter scripts.
I would suggest to go through the following resources
Automated Deployment with Maven - going the whole nine yards If you can, literally follow this pattern.
Maven 2 Effective Implementation -- this book really helped us a lot.
There are several Maven plugins to help deployment. The most general of them is Cargo, but there are also app server specific plugins for some concrete servers like JBoss.
Most companies I have worked for (actually, all) have had some sort of custom in-house built deployment system; even if build was done using a standard framework (like Maven in use at my current company).
Part of this is because there are many aspects that tie closely to company-specific infrastructure, capacity management and monitoring systems; and so even though there are open-source systems, there is usually something that needs to be tweaked.
It sounds like you are running your app on its own--it isn't part of any application server. If you aren't using an application server, there are probably some ways to get cargo and maven to deploy it for you, but you may be better off just using some shell scripts to deploy and run the application.
However, as your application grows, you may find a need for an application server like Jetty, JBoss, Glassfish, Tomcat, etc. When this happens, take a look at the cargo plugin for Maven because it will allow you to do something like:
mvn cargo:redeploy
That will package up your application, send it to the server and restart the app. If you want Hudson to do this for you automatically you can add it as a target to build.
Cargo can save you a lot of time when you have to frequently update an application server.

Categories

Resources