Can I use EventMachine in cloud foundry? - eventmachine

When I start a program which uses EventMachine, the vmc start does not return whether it succeed or not. It seems just time out.
But,I do see "the server started" in my log file. So I am wondering what is proper way to use EventMachine in cloud foundry?

Eventmachine does work in Cloud Foundry, it's a dependency on thin which if included in a project can be used to serve Rack / Rails apps.

Related

How to connect the back end and the front end and use the Discovery API in IBM cloud app services?

I am very new to using APIs so please excuse me. I am currently using a Python-Django App service from IBM cloud app services and the IBM Watson Discovery resouce. I have followed all the steps given here:
https://console.bluemix.net/docs/apps/tutorials/tutorial_web.html#before-you-begin
I have a machine that has docker and so the app got built successfully. However I am lost as to how I am supposed to get the front end ( which I am writing in bootstrap, javascript ) to connect to the backend and link the API.
EDIT
For example : I want my app to accept documents, feed them in Discovery, extract the keywords and sentiments and display them in the UI. How do I know what to access from the server side code and what to link where in the UI.
It is a very broad question but its a compulsory project I need to do and I am clueless. Pleaassee Help !
Before you try to integrate an API, you will need to be familiar with Python and Django. If that is not the case, then you really need to go through a series of tutorials.
Then before deploying to the cloud, you will be better off running your Django app locally on your laptop. Use pip to install the watson-developer-cloud pypi module and use the API documentation to build the python code in your Django application - https://www.ibm.com/watson/developercloud/discovery/api/v1/python.html?python#query
If none of this makes sense, then you need to brush up on your knowledge of Python, Pip, and Django.
When you have the app running on your machine, then you will be ready to package it up into either a docker image or cloud foundry container and deploy to the cloud.

Swisscom Cloud DB Backup fails

We are using a MariaDB and a MongoDB (single instance) service in the Swisscom App Cloud.
If i try to create a backup with the backup button, it starts to create one, but fails after a few minutes.
Also, if i try to delete the failed entry, the deletion fails as well.
The interface provides no further information about the reason.
This happens for MariaDB as well as for MongoDB.
What could be a possible reason and how am I able to debug this error? Where can I get further information about the error?
screenshot of Portal:
Simon here from the App Cloud Team.
There was an issue in the backend which we fixed this morning, so your backups should now work again.
Sorry for the inconvenience.
I developed a CF CLI plugin for DB backups (MariaDB) in Cloud Foundry, called "cf-mariadb-backup-plugin", that also works in the Swisscom App Cloud. Check it out here, and give it a star. ;-)
If you use such plugin it presents the error message catch directly from the Cloud Foundry API. This might provide you, at least, better reasons on why such actions are failing.

Google App Engine Deploy Only Jar File

I am beginner for Google App Engine.
I have simple java application with a class in which there is main method which executes some threads.
Actually, it's Java application which is used to execute some back-end activities.
On my Linux server, i have created a cron job which executes this class at some specific time interval.
Now, I want to move this application to Google App Engine.
I did search about that and what i find is i have to convert this java application to web application to deploy on GAE.
Please guide me how i can deploy JAR to GAE.
Thanks
Yes, your java application needs to be a web application. That is, you'd need to have a WEB-INFO directory within your jar, with the correct xml files (i.e. web.xml and appengine-web.xml).
Please, start by following one of the tutorials here:
https://cloud.google.com/appengine/docs/java/gettingstarted/introduction
You also mentioned that you use threads in your application. I believe that on App Engine you cannot just create threads, and instead you need to rely on the provided threads api:
https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/ThreadManager
Thus, some of your code will need to be changed to use such an api.
Finally ! i figured out the solution without using Google App Engine and just using Google Compute Engine.
I created a JAR and put it into my home folder using SFTP.
After that i created a cron file at /etc/cron.d/myfile as below
*/10 * * * * myusername java -jar /home/myusername/myjar.jar
Then i reload the crontab
sudo service cron reload
That's it ! Thanks for your input and interest !
If you mean just a simple JAR with a main method, that won't work. Your application has to be a web service that responds to requests.
Check this link to create an app using JAR file:
APP-ENGINE
You cannot deploy a single jar file to App Engine. You can deploy an application.
This tutorial explains how to create an App Engine project in Java:
https://cloud.google.com/appengine/docs/java/gettingstarted/introduction
Yes, you can only deploy web applications to Google App Engine, so you may have to convert your class into a Servlet class if you want to deploy it to App engine.
You can use the Servlet's url if you are looking to execute it as a cron job, so you can configure this url in a file cron.xml by specifying the frequency and time when cron job should be executed before deploying.
You can use the link below which will guide you through the steps :
http://www.vogella.com/tutorials/GoogleAppEngineJava/article.html
Google's documentation on Cron Job :
https://cloud.google.com/appengine/docs/java/config/cron
You can not however use threads when working with App Engine.

How to use Eclipse for remote debugging of a Google App Engine (GAE) application

Is there a way to debug (specifically step-through) a Google app engine application that has been deployed to the cloud. The reason I am asking is that there are certain things that either cannot be debugged locally or require work-arounds to test locally (eg. CRON Jobs).
Specifically I want to do this using Eclipse.
Update: as of 2015 it is possible to debug AppEngine Java applications if they run on Managed VMs. Also, the debugger is a web-based hosted debugger - no support yet for your popular IDE. See Cloud Debugger.
No, this can not be done.
One of the reasons why this most probably will never be available is that GAE is a distributed cloud system, where an "application" can have multiple instances running in parallel and there is no guarantee that consequent requests (e.g. a user session) would be served by the same instance. So there would be no way to know to which instance to connect debugger to.
You might want to star this acknowledged bug

Heroku-like services for Scala?

I love Heroku but I would prefer to develop in Scala rather than Ruby on Rails.
Does anyone know of any services like Heroku that work with Scala?
UPDATE: Heroku now officially supports Scala - see answers below for links
As of October 3rd 2011, Heroku officially supports Scala, Akka and sbt.
http://blog.heroku.com/archives/2011/10/3/scala/
Update
Heroku has just announced support for Java.
Update 2
Heroku has just announced support for Scala
Also
Check out Amazon Elastic Beanstalk.
To deploy Java applications using
Elastic Beanstalk, you simply:
Create your application as you
normally would using any editor or IDE
(e.g. Eclipse).
Package your
deployable code into a standard Java
Web Application Archive (WAR file).
Upload your WAR file to Elastic
Beanstalk using the AWS Management
Console, the AWS Toolkit for Eclipse,
the web service APIs, or the Command
Line Tools.
Deploy your application.
Behind the scenes, Elastic Beanstalk
handles the provisioning of a load
balancer and the deployment of your
WAR file to one or more EC2 instances
running the Apache Tomcat application
server.
Within a few minutes you will
be able to access your application at
a customized URL (e.g.
http://myapp.elasticbeanstalk.com/).
Once an application is running,
Elastic Beanstalk provides several
management features such as:
Easily deploy new application versions
to running environments (or rollback
to a previous version).
Access
built-in CloudWatch monitoring metrics
such as average CPU utilization,
request count, and average latency.
Receive e-mail notifications through
Amazon Simple Notification Service
when application health changes or
application servers are added or
removed.
Access Tomcat server log
files without needing to login to the
application servers.
Quickly restart
the application servers on all EC2
instances with a single command.
Another strong contender is Cloud Foundry. One of the nice features of Cloud Foundry is the ability to have a local version of "the cloud" running on your laptop so you can deploy and test offline.
I started working on the exact same thing as what you said a few weeks ago. I use Lift, which is a great framework and has a lot of potential, on top of Linux chroot environment.
I'm done with a demo version, but Linux chroot is not that stable (nor secure), so I'm now switching to FreeBSD jail on Amazon EC2, and hopefully it'll be done soon.
http://lifthub.net/
There are also other Java hosting environment including VMForce mentioned above.
If you are looking for a custom setup which also has the ease of deployment that heroku offers: http://dotcloud.com. They are invite only right now but I was given access in under three days. I am working on a Lift/MongoDB project there and it works well.
Off the top of my head, only VMForce comes to mind, but its not available yet. This will be a Java-oriented service, so that probably means you'll have to spend a wee bit of time figuring out how to package the app.
For more discussion, there was a debate about this in 2008.
I'm not entirely sure if it's really suitable or not, but people have deployed Scala applications to Google App Engine, for example http://mawson.wordpress.com/2009/04/10/first-steps-with-scala-on-google-app-engine/
Actually you can run scala on heroku right now. You don't believe it?
https://github.com/lstoll/heroku-playframework-scala
I'm not sure the tricks lstoll has used are legit but using the
new cedar platform where you can run custom processes and some
ingenious Gemfile hacking he has managed to bootstrap the Java
play platform into a process. Seems to work as he has a live
site running a test page.
Stax cloud service offers preconfigured lift project skeleton. Also, there is a tutorial on how to deploy lift project to appengine.