Can we use Flink REST API with Flink "Application" Deployment mode? - apache-flink

I have first stated a job with Flink "Application" mode and then tried to use Flink REST API to upload a jar on that cluster. Upload jar API returns 404 Not Found error. is it true that Flink REST API only works with session mode and it is not supported with Application/Per Job modes
{
"errors": [
"Not found: /jars/upload"
]
}

Related

The frontend(ecs fargate) fails to send a normal request to the backend(fargate) through load balancer in private subnet

I'm building aws cloud with Terraform. There is a problem that is not solved, so I leave a question like this.
Currently, the front-end (react) and the back-end (fastapi) are ecs fargate, each creating a cluster on a private subnet separately.
Traffic coming from an Internet gateway is designed to enter the front-end through a load balancer and then, distribute the traffic back to the back-end through a load balancer in a private subnet.
So I applied the domain of the load balancer to the host at the front-end, and the domain of the load balancer was specified in the environment variable of the ecs task at the front end.
but The front-end fails to send a normal request to the back-end. It occurs 405 errors.
Below is the fron-end ecs task definition in terraform.
resource "aws_ecs_task_definition" "react" {
family = "react"
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
cpu = 1024
memory = 4096
execution_role_arn = "${aws_iam_role.ecsTaskExecutionRole.arn}"
task_role_arn = "${aws_iam_role.ecs_execution_role.arn}"
container_definitions = <<DEFINITION
[
{
"image": "<image pulled from ecs>",
"cpu": 1024,
"memory": 4096,
"name": "react",
"networkMode": "awsvpc",
"essential": true,
"portMappings": [
{
"containerPort": 80,
"hostPort": 80
}
],
"environment": [
{
"name": "REACT_APP_HOST",
"value": ${jsonencode(local.domain)}
}
]
}
]
DEFINITION
}
local.domain is specified like this.
locals {
domain = "${var.var_http}${aws_lb.fastapi.dns_name}"
}
and I tried..
When I connect the domain of the load balancer to the local front-end, I have confirmed that it works normally.
When setting up the domain of react, I thought react might not have read the domain of the load balancer, so I installed env-cmd as npm in the docker file I uploaded with react in ecr, and I installed scripts as "build": "env-cmd -f.I tried to modify to env react-scripts build", but an error occurred in the docker file.
thank you for reading!
React is a web browser javascript framework. React runs in the browser. Your front-end Fargate server isn't doing anything but serving up static files to web browsers. The code is running in each user's web browser. The API requests to the back end are not coming from the front-end Fargate server, they are coming from each user's laptop/desktop computer. In order for that code, running in people's web browsers, to access your back-end API, the API has to be available publicly on the Internet.

Getting Failed to load resource: the server responded with a status of 404 (Not Found) when pushing Angular app to cloud foundry

I am able to access the client server in Angular 5 from localhost:4200 with Cross-Origin concept but when I am deploying the app using ng build to Pivotal Cloud Foundry, getting error Failed to load resource: the server responded with a status of 404 (Not Found).
Not able to figure out the exact issue.
I am using package.config.json as -
{
"/api": {
"target": "https://benifit.cfapps.io/api",
"pathRewrite": {
"^/api": ""
},
"changeOrigin": true
}
}
Also, I am using cf push -b staticfile_buildpack portal-app for pushing my app to PCF. Please suggest where and what I am missing
You are referring to the proxy config file from angular-cli dev server. This file is only used for local development, to avoid cross-origin requests. You cannot use this proxy, after the app is deployed.
So in your case the Angular app will directly query your backend underneath the following path /api. So you have to ensure the api is available at the same host (in cloud foundry). When the api is only available under benifit.cfapps.io/api, you have to change the base path for your HTTP queries in the app and also take care to enable cross-origin requests on the api side.

403 when deploying to app engine using service account

I am having an issue deploying a Node project to Google App Engine when using a service account. I am getting a 403 error.
{
"error": {
"code": 403,
"message": "Operation not allowed",
"status": "PERMISSION_DENIED",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ResourceInfo",
"resourceType": "gae.api",
"description": "The \"appengine.applications.get\" permission is required."
}
]
}
}
I have given my service account the App Engine Admin and Storage Object Admin roles. I am using the downloaded JSON key file to deploy.
I am then running these two terminal commands:
gcloud auth activate-service-account --key-file appEngineAuth.json
gcloud --quiet --verbosity=debug app deploy app.yaml --promote --log-http
This is my app.yaml file:
runtime: nodejs
env: flex
If I run gcloud auth list I see my service account user selected. I am able to deploy if I do gcloud init and then go through the process of using my Google account but I can't do that from my CI server.
I have deleted and recreated my service account a couple of times and made absolutely certain I am using the correct key file. I even tried giving my service account the Owner role but that didn't work.
This turned out to be an app engine bug. Support took about a week to fix the issue. As a temporary work around I had to create a new application and use it. This bug only affected one of my six applications.
Google case #: Case 15238823

How to call Google Cloud Endpoints RPC API on localhost?

EDIT I posted an issue on this and it should be fixed in release 1.9.16 of Google AppEngine SDK.
https://code.google.com/p/googleappengine/issues/detail?id=11414
I am developing a service using Google Cloud Endpoints.
Both the REST and the RPC API works great when I deploy it on App Engine. However the strange thing is, when I test the service locally (localhost), the REST calls works fine, but I am having trouble with calls using RPC.
My method signature in the backend is:
#ApiMethod(name = "user.updateprofile", httpMethod = HttpMethod.POST)
public UserProfileDto updateProfile(#Named("sessionToken") String sessionToken, UserProfileDto profile) throws UnauthorizedException { return profile; }
For simplicity I am just returning the UserProfileDto directly.
I have tried to execute the following request locally:
POST http://localhost:4567/_ah/api/rpc?prettyPrint=false
Content-Type: application/json-rpc
Accept: application/json-rpc
{
"method": "mobilebackend.user.updateprofile",
"id": "gtl_1",
"jsonrpc": "2.0",
"params": {
"sessionToken": "12345",
"resource": {
"username": "foo",
"userPrivate": true
}
},
"apiVersion": "v1"
}
When I set a breakpoint in the updateProfile method, I see that the sessionToken is correctly 12345 however the username field is null and the userPrivate field is false even though I specified it as true. The instance of UserProfileDto (profile) is not null.
The problem is that it fails to inject the values into the fields of the DTO when using RPC calls localhost. When I test it on the deployed version it works fine, and when I use REST calls it works both on localhost and when deployed on App Engine.
When I change the url in the above request to target the deployed version of my application on app engine it works just fine. https://<app-name>.appspot.com/_ah/api/rpc?prettyPrint=false
I start the service on localhost using:
mvn appengine:devserver
Do I miss some configuration in order to call the Cloud Endpoints RPC methods localhost? Or is it not supported?
I should notice that I have also tried with the auto-generated iOS client library which is using RPC and it also fails with the same error as the service fails to inject the values into the fields of the DTO object.
I have tested release 1.9.17 of Google AppEngine SDK and can confirm that using objects in RPC POST requests now works fine.

JHipster Atmosphere websocket does not connect

With a newly scaffolded app generated from "yo jhipster" and started with "mvn spring-boot:run" and "grunt server" I am able to load the app and do operations like login, view metrics, see sessions, settings, logs, and audits. However, whenever I view the "User Tracker" page I don't see anything?
I believe this section is supposed to demonstrate Atmosphere websocket / AngularJS integration? Looking at the browser console logs, I see the following:
Websocket failed. Downgrading to Comet and resending atmosphere.js:2866
GET http://0.0.0.0:9000/websocket/activity?X-Atmosphere-tracking-id=0&X-Atmosph…true&X-Cache-Date=0application%2Fjson&X-atmo-protocol=true&_=1393276976964 404 (Not Found)
It appears that a websocket connection is attempted but eventually times out and the fallback long polling doesn't work? I'm using the latest Chrome (also tried on latest versions of Firefox and Safari as well).
Am I missing something simple?
-- Update 1 --
Deploying it as a WAR to Tomcat 7.0.50 shows data back from Atmosphere in the User Tracker page but it continuously loops trying to get a WebSocket connection (HTTP status code 101: switching protocols) so the user data appears and disappears periodically. I saw an error in Chrome like this:
No suspended connection available. Make sure atmosphere.subscribe has been called and request.onOpen invoked before invoking this method
The Tomcat logs show the following:
[WARN] org.atmosphere.cpr.DefaultAnnotationProcessor - Unable to detect annotations. Application may fail to deploy.
-- Update 2 --
Deploying it as a WAR to Jetty 8.1.14.v20131031 (Jetty 9.1.1.v20140108 throws errors) and testing it with Chrome 32.0.1700.107 appears to work for the fallback transport of long-polling. The initial connection to WebSockets, however, fails because Atmosphere for some reason thinks the servlet container is Tomcat? In the server logs, it throws the following issue:
java.lang.ClassCastException: org.eclipse.jetty.server.Request cannot be cast to org.apache.catalina.connector.RequestFacade
at org.atmosphere.container.TomcatWebSocketUtil.doService(TomcatWebSocketUtil.java:141)
at org.atmosphere.container.Tomcat7Servlet30SupportWithWebSocket.service(Tomcat7Servlet30SupportWithWebSocket.java:62)
Thanks again for all your help -- definitely making progress :)
-- Update 3 --
To summarize everything:
Currently "mvn spring-boot:run" and "grunt server" don't work together for Websockets or long-polling
If you deploy the JHipster WAR (mvn package) to Jetty 8.1.14.v20131031 then it works but you need to remove the following dependency from your JHipster pom.xml or else Atmosphere will not provide WebSocket support:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
Argh. False alarm -- I had it running using streaming, not websockets, so WebSockets still has the error from update2
No you're not missing anything :-)
If you use the Java server directly it should work: you need to connect to the application with another browser (or another tab) and you will see working.
However, with "grunt server", there is a bug: the Grunt proxy just does not support Websocket, so it doesn't work... There is one strange thing, thus, it's that the fallback transport does not work.
I'm filling this as a bug.
-- update 1 --
Concerning your update, it looks there's another Atmosphere bug:
http://atmosphere-framework.2306103.n4.nabble.com/Log-warning-that-Atmosphere-is-unable-to-detect-annotations-td4658159.html
It seems that Atmopshere can't find its annotation inside a WAR, can you try the same thing in development mode ("mvn spring-boot:run")? That would means it's an issue with WARs in Tomcat

Resources