How do deploy a play application on google cloud - google-cloud-platform

This is my first time deploying an application. I have some idea about it but I am not sure if it is correct. How do I go about deploying a play application on google cloud?
1) I have created a package using dist command. I have the zip file now on my local pc. https://www.playframework.com/documentation/2.5.x/Deploying
2) Do I first need to create a compute resource on gcp? What configuration shall I use for the vm? My app is still in test phase so there are no external users at the moment
3) I suppose play uses netty web server. So do I need to install netty on the compute resource? I have looked online a bit but can't find a resource on how to deploy an application on netty.

deploy an application on netty
Netty is not a web server/application server, but an IO framework which can be used to build web servers or any high-performant IO applications.
If you really want to use netty, you need to write an HTTP server yourself, or just use an HTTP framework built on netty.
If you want to build an application using netty, have a look at the examples on https://github.com/netty/netty/tree/4.1/example/src/main/java/io/netty/example/
Deploying a container to the Cloud using Google Cloud Platform and Kubernetes Engine
Kubernetes is a way of orchestrating containers in the Cloud, enabling you to do things like auto-scale, fast deploys and manage running versions of containers. You simply create a container and upload it to a container repository. In this example I used Google’s Container Registry, it’s really simple to use and works brilliantly with their Kubernetes implementation.
follow this tutorial might help you with this
https://medium.com/beyond/deploying-a-container-to-the-cloud-using-google-cloud-platform-and-kubernetes-engine-10d8ee3aba86

Related

What is the differnce between a Cloud Foundry and A Web Server

So being an SAP consultant , I am trying to understand the SAP cloud foundry .
As per understanding till now , Cloud Foundry is a runtime engine provider (on the cloud ) .
There are many Cloud Foundry like SUSE , IBM , SAP Cloud Foundry .
Doubt:-
I develop an application for Android ,
I deploy the application in a Web Server ,
Now everybody can download it from Google Play and use it .
I deploy the same application in one of the Cloud Foundry .
Now everybody can download it from Google Play and use it .
Is there any difference between a Cloud Foundry and A Web Server ? Or both are same
EDIT :- Question Clarification
What is the difference between products like SUSE , IBM , SAP Cloud Foundry and Cloud services like AWS , Google Cloud , AZURE
So being an SAP consultant , I am trying to understand the SAP cloud foundry .
I can't talk to anything specific that SAP is doing, but to be called Cloud Foundry you need to be certified which tests compatibility and interoperability (and prohibits lock-in). SAP is certified so there's a base set of functionalty that is common with it and any other provider. I'll only be referencing that here.
There are many Cloud Foundry like SUSE , IBM , SAP Cloud Foundry .
Correct, just a minor terminology note. Each vendor with a certified Cloud Foundry offering is called a provider. Cloud Foundry is the service, the company offering it is the provider.
Oh, you can also run your own, if you or your company prefers that route.
Doubt:- I develop an application for Android , I deploy the application in a Web Server , Now everybody can download it from Google Play and use it .
I deploy the same application in one of the Cloud Foundry . Now everybody can download it from Google Play and use it .
Is there any difference between a Cloud Foundry and A Web Server ? Or both are same
Let's say that you have an Android app. It talks to some services.
For example:
Android Phones 1..X (possibly millions) talking to Servers 1..Y (hopefully not millions).
Each Android phone runs a client, the client talks to the server to perform work
The server provides some functionality, like storing data or performing expensive calculations you wouldn't/can't do on the phone
There's no difference when it comes to the Android app. You're building that. It's running on someone's phone. It's talking over HTTP (or some other protocol) to a service. It's installed through the Play Store (not from your servers).
The main difference is with the services to which your Android app communicates. Specifically, between how you deploy your app on a server/VM directly or on Cloud Foundry and the amount of work required to do so.
For a server you might:
need to request hardware or request a VM from IT, if you're lucky you can provision this on-demand
you need to install an OS, if you're doing this right you have a tool to install this for you, but that tool might need some configuration/tuning
you need to install any software required to run your app (JVM, Dotnet, Python, etc...), including servers like Nginx, Tomcat, Apache Web Server, etc...
you need to configure software and servers (again if you're doing it right you have a tool that helps you manage this, which may require some configuration)
then you build your app (or perhaps take bits from a CI server)
last you set up your app to run, including some sort of watcher/service management software to make sure that when your app crashes it is automatically restarted
There could be more (network/firewall/service work) or less (like if you deploy to a public cloud IaaS) tasks here depending on what it takes to deploy an app in your environment.
This also doesn't touch on the fact that you need to maintain all this. Ensure that you're updating software and the OS in a timely fashion.
For Cloud Foundry:
You do a cf push which takes your code and automatically adds and configures the software needed to run your app (through buildpacks).
Your app is then run on Cloud Foundry.
You're back to writing code.
Other benefits:
It's watched automatically, so if it crashes it restarts. No intervention required.
Logs are captured and made easily available to you, the developer
Network access & TLS are already set up and managed by your provider.
There's a catalog of on-demand and easy to consume services available to your app.
Software is automatically updated whenever you push code.
You can scale up/down easily with load, no new servers to provision and set up.
There's even an autoscaler to automatically scale up/down based on provided rules to save resources/money.
tl;dr - it is an easy button for developers. You just write code and push. All the other stuff you don't want to worry about is done for you.

What is the best way to host Apache Camel in AWS?

As we move our workloads to AWS I am looking for an ETL tool which is widely used and has the appropriate connectors - Apache Camel appears to fit the bill. However, I am struggling to find information on how Camel can be deployed in AWS - the obvious one is on an EC2 instance, but we would like to avoid the setup and maintenance required by Virtual Machines. I don't see anyone offering it as a managed service, so the option I'd like to explore is running it as a container in ECS, as we will have numerous other containers running.
Containers don't seem to be an installation option on the Apache Camel website - perhaps it is just too limiting for a tool whose purpose is to connect to everything else?
Is it acceptable and practical to run Camel in a container, and where could I find more information about it?
Apache Camel appears to fit the bill.
Indeed the Apache Camel is a great integration framework. And that's the point. It is a framework, not a product. So there are multiple ways to run the Camel flows. As a web app, as a standalone app, as a part if our own code. Camel itself is pretty agnostic to the way you run the flows and that's why you don't have very specific way enforced in the web site.
If you want an out of box product, which can generate containerized deployments with Apache Camel, you could have a look at Apache ServiceMix, Apache Karaf or it's supported RedHat Fuse.
Is it acceptable and practical to run Camel in a container, and where could I find more information about it?
It is perfectly fine.
Question: Can you (are you able) to create a docker container with your (any other) application?. Based on the question this skill is lacking and I really suggest to learn it.
You may check folowing post https://medium.com/#wkrzywiec/how-to-put-your-java-application-into-docker-container-5e0a02acdd6b
FROM java:8-jdk-alpine
COPY ./target/myapp.jar /usr/app/myapp.jar
WORKDIR /usr/app
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "myapp.jar"]
Let's assume you can run your ETL tasks as a standalone application, then just run it in the container as any other standalone application.
it we would like to avoid the setup and maintenance required by Virtual Machines
Question: how do you distribute your camel tasks? I mean - what is result of your build? A war file? A standalone app?
To build a web app you could see https://www.baeldung.com/spring-apache-camel-tutorial
The most convenient way to deploy a war file in AWS is AWS Beanstalk service.
If you build a standalone application (or use servicemix) and you can build a container, then indeed ECS or Fargate seem as natural options.

Using cloud functions vs cloud run as webhook for dialogflow

I don't know much about web development and cloud computing. From what I've read when using Cloud functions as the webhook service for dialogflow, you are limited to write code in just 1 source file. I would like to create a real complex dialogflow agent, so It would be handy to have an organized code structure to make the development easier.
I've recently discovered Cloud run which seems like it can also handle webhook requests and makes it possible to develop a complex code structure.
I don't want to use Cloud Run just because it is inconvenient to write everything in one file, but on the other hand it would be strange to have a cloud function with a single file with thousands of lines of code.
Is it possible to have multiple files in a single cloud function?
Is cloud run suitable for my problem? (create a complex dialogflow agent)
Is it possible to have multiple files in a single cloud function?
Yes. When you deploy to Google Cloud Functions you create a bundle with all your source files or have it pull from a source repository.
But Dialogflow only allows index.js and package.json in the Built-In Editor
For simplicity, the built-in code editor only allows you to edit those two files. But the built-in editor is mostly just meant for basic testing. If you're doing serious coding, you probably already have an environment you prefer to use to code and deploy that code.
Is Cloud Run suitable?
Certainly. The biggest thing Cloud Run will get you is complete control over your runtime environment, since you're specifying the details of that environment in addition to the code.
The biggest downside, however, is that you also have to determine details of that environment. Cloud Funcitons provide an HTTPS server without you having to worry about those details, as long as the rest of the environment is suitable.
What other options do I have?
Anywhere you want! Dialogflow only requires that your webhook
Be at a public address (ie - one that Google can resolve and reach)
Runs an HTTPS server at that address with a non-self-signed certificate
During testing, it is common to run it on your own machine via a tunnel such as ngrok, but this isn't a good idea in production. If you're already familiar with running an HTTPS server in another environment, and you wish to continue using that environment, you should be fine.

How to configure: WS-AT Narayana standalone?

I want to use Narayana - WS-Transaction in a standalone springboot app that calls two different Webservics in a single transaction. One of those internally uses db resource for insert/update.
Is standalone-WSAT-possible with narayana? If yes :
How do I configure UserTransaction, PlatformTransactionManger etc in Springboot java config?
How to add those two WebServiceTemplate (s) as "WS-AT transactional resources"?
The example here does not show those beans: https://github.com/jbosstm/quickstart/tree/master/spring/stock-market-with-narayana-spring-boot/src/main
Unfortunately there is no Narayana Spring Boot WS-AT quickstart that would show you how to utilize the technology. WS-AT is the best integrated in WildFly application server. You can find the Narayana quickstarts containing examples of running it at https://github.com/jbosstm/quickstart/tree/master/XTS. If you consider using Spring Boot then in general it should be possible but you need to configure all the integration on your own. That's not prepared and/or maintained by the Narayana team. You can get inspiration at quickstarts of itegrating Narayana with Spring Boot at https://github.com/jbosstm/quickstart/tree/master/spring. If you want to check how the integration to WildFly is done then a good starting point could be https://github.com/wildfly/wildfly/blob/master/xts/src/main/java/org/jboss/as/xts/XTSSubsystemAdd.java.

VSTS - cannot deploy to an on premise web server

I am new to VSTS build and deploy and I am struggling with it.
I have a solution that contains a Web Core API and a ASP.Net web project.
I have done my build and now I want to deploy the build to an on premise web server.
When I look at my artifacts, everything looks OK;
So when I set up a deploy definition I start with an empty environment and I add a task. It looks to me that given I want to move the artifacts to an on premise web server I should be using the Windows Machine File Copy task. But when I do I find that I do not have access to the drop folder. How do I fix this (and have I selected the correct task?).
You're using the hosted agent. The hosted agent can't deploy to an on-prem server -- it has no network route.
You can either use Deployment Groups (the agent is installed on your target machine and talks directly to VSTS), or you can install your own on-prem build/release server, then push the bits to the target machine using the Windows Machine File Copy task.