I want to place a server program written in Java on the cloud. It would accept TCP socket connections from clients (clients are android phones using 3G), do some computations, save stuff to a MySQL database (also on EC2), and send stuff back to the clients over the TCP connections. It may even be necessary to create several instances of the server (i.e. a process group).
Is this easy to do? I think I can make a AMI, but I'm not sure how to upload Java files, compile and run them, and create a MySQL database etc
Any help would be much appreciated.
Take a look at using Amazon Elastic Beanstalk. Beanstalk is Amazon's PaaS offering and it will alleviate a lot of the system administration burden. Here's a quick description from their docs:
AWS Elastic Beanstalk is an even
easier way for you to quickly deploy
and manage applications in the AWS
cloud. You simply upload your
application, and Elastic Beanstalk
automatically handles the deployment
details of capacity provisioning, load
balancing, auto-scaling, and
application health monitoring.
Also, if you're interested in using MySQL then you should look at Amazon RDS. Again, this will alleviate the system administration burden for your database tier. Here's a quick description from their docs:
Amazon Relational Database Service
(Amazon RDS) is a web service that
makes it easy to set up, operate, and
scale a relational database in the
cloud. It provides cost-efficient and
resizable capacity while managing
time-consuming database administration
tasks, freeing you up to focus on your
applications and business.
Is this easy to do? I think I can make
a AMI, ...
I think the answer depends on how comfortable you are with system administration in general. Creating a AMI to run in EC2 is really pretty much the same as creating a physical server or a VM image. You'll need to install an operating system, and then install tools, libraries and programs you need (like mysql, the jdk, ssh, etc).
You can save yourself a little work by using one of Amazon's pre-built AMI's http://aws.amazon.com/amis/. But, ultimately, you'll be responsible for all system administration of the server. If you've never built a server from the ground up, you have a pretty big learning curve ahead of you. It's not insurmountable, but just be warned that the devil is in the details; there's a ton of stuff you'll need to learn ;-)
... but I'm not sure how to upload Java
files, compile and run them, ...
Once the server is setup and running in EC2, compiling them and running java files is just the same as compiling and running on your local. Normally, you probably want to compile and package your java app into a jar or war and then transfer that up to your EC2 server. If you install linux os on your EC2 server, you can use scp or a FTP client to transfer your files over sftp to move the files from your local up to the server. Once the latest files are up on your server, you can ssh to the server and start your app.
... and create a MySQL database etc ...
Installing mysql is going to be specific to the OS you choose to install on your server. For example, you can install mysql easily on Ubuntu with a command like:
sudo aptitude install mysql
Again, there will be more system-admin-type stuff to learn here specific to mysql databases.
So, it's definitely doable. An experienced sys admin could build a AMI instance pretty easily/quickly. If this is your first experience with system administration, I'd suggest finding an old Desktop you have lying around and try installing Ubuntu and all the required libraries and tools you need (mysql, jdk, ssh, etc..). Get your java program working on the old desktop and then it should be pretty easy to create an AMI from that. Then you can run your custom AMI on EC2 and will be set up.
If you don't have a spare desktop lying around, you can use one of the Virtual Machine products like VMWare Player or Sun's VirtualBox and build a server instance on one of those.
If you want to avoid the hassle of managing the entire install of the Operating system, you might want to look at services like slicehost and/or linode instead of EC2. They give you ssh access to a pre-installed server. And it's as easy as clicking a button to install programs like mysql, etc.
Hope this answer is relevant and helpful, good luck.
- Dave
If you can use Tomcat as your server - you might want to try Amazon Web Services Elastic Beanstalk It will greatly simplify your task by providing an easy instance of Tomcat to deploy.
EDIT: AWS has a full section on how to develop using Java here: http://aws.amazon.com/java/
How comfortable are you with remote administering a server and solving problems most people have never heard of? That's what you're talking about.
You'll create your EC2 instance, log into it and configure it like you would any other server you're working with. You can download JDKs to it, dbs etc. You might consider using a tool like Chef to help you. You'll use ftp and scp to copy files to the server.
You're probably going to want your Java server on one box and have it talk to a separate db server since you say you may want multiple servers.
Once the server is working the way you like it you can create an image of it to use to launch multiple instances, then configure a load balancer to point at your servers.
If you can create a MySql db on your local box you can create it in the cloud. If not?....
Running Applications needs app. s/w to run them.
Apps such as Cyber Duck helps to upload files via SFTP.
I am successful in doing the same problem addressed.. Trust me, YOU CAN DO IT. All u need is interfaces for server services such as MySQL (use WorkBench to connect using key pair), terminal access (using PUTTY/SSH via MAC) and well you are good to go
I think to get started is to use a a whole unit packed into one archive.
Think of it as you have your Java files compiled, a embedded http server say tomcat. Now all of this packed in a jar ready to be deployed on Amazon's EC2. Use this link for more on embedded servers and relevant code.
As far as database is concerned, you can use Amazon's RDS. You can configure mysql on RDS and obtain a link to it for connection. Amazon RDS would help you to get started with database.
Now that you have everything ready to start and work with application. Now is the time to deploy on Amazon AMI
Perform Following steps to deploy you app on Amazon EC2:
Create a server instance on Amazon EC2 refer EC2 getting started.
Receive Private key file i.e. .pem(receive from Step 1), this file would help you to login to your server instance and perform SFTP.
Use Putty or similar SSH client to login to your EC2 server instance created on Step-1 using .pem file and server's public DNS, refer Accessing Instance for SSH login.
Transfer the archived files packed into jar to server using SFTP client, WinnSCP being one such client, refer SFTP for more on it.
Run application. Note in case of jar file you can simply fire java -jar TomcatApp.jar.
If everything is configured properly you would be to access the app using EC2 instance's public DNS or public IP, which would be of the form:
http://<public_dns_address>:<port number>/servlet
Hope it helps you to get started and provide you an overall view.
Related
I'm working on a Project which aims to develop an app for a bloomberg anywhere subscriber. We have a Framework available, which we usually use to write our apps. These run ususally on a cloud as webapplications.
As apps using bloombergs open API can only run on the same machine as the subscriber is logged in biometrically, due to data acess restrictions and prohibition to distribute the data further, we plan to run our framework locally on the clients machine as a desktop application, in order to use the tools we are familiar with.
the back-end, which would use the bloomberg open api to get the data from the local interface provided by the local bloomberg-software, runs on a tomcat-server. the frontend is a javascript client, accessing the back end via API-calls locally.
My Questions are:
As bloomberg data-access is very restrictive, i'm wondering whether the bloomberg-interface accepts calls which come from a server software (like tomcat), even when running on the same machine an not used to distribute the data further?
Would set-up: framework running on a second machine (linux, its easyer to run there), calls Bloomberg Port on first machine via private local network, data not leaving second machine, be possible 1. technically and 2. legally?
Does anybody know that? Any advice highly appreciated, many thanks in advance!
I have a server running on app-engine. I am working on version 2 of my server, which serves as the backend for a mobile app. How do I a dev and a staging server so that I can test before replacing the production server? Does anyone know of a tutorial somewhere that addresses exactly this issue? It would be nice if I could set things up the way Google Play sets up android publication: I can publish to Alpha; then move the apk to Beta; and then to production. I will take what I can get at this point, but that structure would be nice.
You can use versions for this purpose. This way you can talk to myApp.appspot.com for a "production" version, to beta.myApp.appspot.com for a beta version, etc.
EDIT:
All versions run in different instances, but they all talk to the same datastore. It is a good option to test changes that do not break your data model - i.e. a beta version does not make changes in the datastore that break the production version.
If you want to test it in a local environment before pushing it to app engine. I would recommend have a separate box/server and deploy your code there and run the application on that server. Run application as web application in debug mode so you can see errors or problems that occurs. Connect your phone via Wi-Fi to your LAN and make sure the port you are using such as 8080 is open in your hub/firewall.
This way your server's services can send data and receive data without actually deploying on app engine.
This link might be useful:
https://developers.google.com/appengine/docs/java/tools/devserver
I implement using http://www.streamhead.com/google-appengine-staging-server/. It's better than versioning. But thanks everyone for helping.
I am learning Java and am trying to do some experiments with networking Java programs.
I have a program made in 2 parts with a client and a server and it works in local testing but the program actually has usefulness for me and a friend of mine and I want to put the server online so both of us can connect to it and use it.
Where/How can I put the program online and have it running so that the client programs can connect to the ServerSocket with an ip address? (Preferably free)
If you dont want to pay server hosting then I would open a virtual server on my computer, then playaround with modem and forward related port to server ip. I would use a port more than 40000. Then just send your ip and port your friend or update application.
If you really want the application to go live within 5 mins, try Jelastic. If you have built a WAR file, simply sign up with their server,choose a provider closest to your geo location, configure Tomcat and you can upload the WAR file through their fantastic web console. Otherwise if you have some source control system(SVN,GIT etc), you just connect and build it with their Maven console and you can be ready. I used it for my start up(Cloudlabz) and really found it exciting.
Surya
You could also consider the cheapest Rackspace Cloud Server. You'll get a full fledged Linux server (distribution of your choice) for about USD 11/month. I've done that now and then myself to try things out.
Just install Java on it and you're good to go.
http://www.rackspace.com/cloud/cloud_hosting_products/servers/pricing/
http://ideone.com/
is that what you want for this?
This is a free web app for you to run your program online....so you can just paste your code and run it.
On the cloud you could use two different services in order to host your Java application.
IaaS (Infrastructure as a Service). Where you can just rent a specific infrastructure on the cloud and you could install and configure all the services that you need.
PaaS (Platform as a Service). In this case, you still enjoy the infrastructure on the cloud + the service Aaren full pre-configured. It means that you can deploy your application without installing or configuring anything. You just need to deploy your application. You have an example about how it works here. Also, you usually can test your Java apps on the cloud without paying.
You should host the server in Heroku ,they offer a free hosting with limits , I have an app there
I'm writing a Java app that performs various SVN actions (commit, copy, etc) from a remote machine. I access SVN from my Java app using the SVNKit API.
I also need to perform some administration actions, such as creating users and repositories. These actions are not available via the SVNKit API, or even the SVN command-line interface. Normally these would be performed directly on the SVN server, using svnadmin or a GUI equivalent.
(It is possible with SVNKit to create a local repository, but I need to create a repository on a remote machine)
So it seems my options are:
Programatically connect from java
app to svn server using SSH or
similar, then use Runtime.exec()
to run svnadmin
Deploy a web application (like this one) on machine running svn server, then connect to it from java app using HTTP
Map a drive from java app machine to svn server machine (both are windows machines), then run svnadmin from the former, supplying the path to the latter as an argument
Is there any other way to perform these admin tasks from a remote machine?
Since svnadmin does not itself work remotely (as stated explicitly in its documentation), your problem is no different from running any other local application from a remote computer.
BTW, your option 3 is not advisable:
Do not create a Berkeley DB repository
on a network share—it cannot exist on
a remote filesystem such as NFS, AFS,
or Windows SMB. Berkeley DB requires
that the underlying filesystem
implement strict POSIX locking
semantics, and more importantly, the
ability to map files directly into
process memory. Almost no network
filesystems provide these features. If
you attempt to use Berkeley DB on a
network share, the results are
unpredictable—you may see mysterious
errors right away, or it may be months
before you discover that your
repository database is subtly
corrupted.
I've got the following problem.
A client is looking for better latency to access a forex trading java web app (.jnlp) that is stored on a third party server. I can provide him access to one of our servers (running linux) that is geographicaly closer to the trading portal (rather than connecting directly to the trading server, less latency, which is critical to the client).
I'm trying to find a way to 'export' the web app interface (basically a simple window) back to the client without having to export the full desktop (using vnc, x export, etc). The client is new to linux and a 'one-click' solution would be the best.
Client is running Windows based OS, Server that will export him the java web app is running linux (debian).
What would be the best mix of technologies to get started ?
I think what you actually need is not better latancy to the jnlp app itself (it is propably insignificant really how long the app needs to start up).
You want lower latancy for the communication between the app and the trading server. Which means the machine on which the app runs, needs a broad/fast connection to the trading server.
This means any remote desktop application might be a solution to your problem.
(TeamViewer for example allows you to only share a single application (and not the whole desktop). Runs on linux using wine, but I'm not aware of all the compatibility issues.)