CF : ERR Failed to make TCP connection to port 8080: connection refused - cloud-foundry

So, I have recently started using CF and am using the same to publish a nodejs app to my cf space.
As suggested in the CF wiki, I have used the nodejs_buildpack to
build my app so that can be run via CF PaaS.
Although I don't need this if I push my own cached
node_modules dependency folder in the CF Space , please correct me if I am wrong ?
Following screenshots represent the output of cf push ,
Output of : CF logs STARS --recent
manifest.yml
---
applications:
- name: STARS
buildpack: nodejs_buildpack
memory: 256m
disk_quota: 512MB
instances: 1
command: npm run build
I don't understand why 8080 fails as this works like charm on my machine. i.e. localhost:8080
I do set the express in the following way though,
app.set('port', process.env.PORT || 8080);
// set up listening
app.listen(port, function (err) {
if (err) {
console.log(err)
} else {
opn('http://localhost:' + app.get('port'))
}
})
--Update--
As suggested by #K.AJ in the answer below I have tried to increase the memory limit in my manifest from 256 to 512 and you know what it started working. :)
But its a little strange that the allocation 179.4M in memory and 206.1M on disk is present. Looks like the addition of these two is considered in the deployment process.
My updated configuration is ,

app.set('port', process.env.PORT || 8080);
In the above statement, the port is 8080, only when running locally.
On cloud platforms like PCF, you have no control on which port an app will be running.
If you look closely to the error message, your app is crashing due to out of memory error. The 256MB memory is not enough for it. Try setting it to 1GB first, get it working and then optimize it.
Assuming, you have successfully deployed your app, run cf apps. It should list you the deployed apps along with the route.
Copy the route url for your app and run it in browser. You should be able to see your app, provided your app instance is healthy and in running state.
Please go through documentation on PCF
https://docs.pivotal.io
https://docs.pivotal.io/pivotalcf/2-3/devguide/index.html
https://docs.pivotal.io/pivotalcf/2-3/devguide/index.html#deploy

Related

Dev Proxy from webpack dev server to flask backend connection refused

I've been working on a react app and I wanted to get hot re-loading going so I set up a webpack dev server. It's working great. It runs on localhost:8080 and the hot re-loading works perfectly.
Great, now I just need to set up a proxy to route requests from 8080 to my flask server running on 5000 right?
Cool so I added a proxy field to my webpack.config.js
27 devServer: {
28 static: './static/dist',
29 proxy: {
30 '/': 'http://localhost:5000',
31 secure:false,
32 }
33 },
But when I re-run npm run start
"start": "webpack serve --open --mode=development"
I get all of these connection refused errors. My flask is up and running fine and I can query the api routes directly and have data be returned.
[webpack-dev-server] [HPM] Error occurred while proxying request localhost:8080/all_users to http://localhost:5000/ [ECONNREFUSED] (https://nodejs.org/api/errors.html#errors_common_system_errors)
I followed the URL and the only advice there was that this error usually occurs when the external system is down. Since mine isn't, I'm pretty confused.
Any help would be greatly appreciated.
I have no idea why but changing 'http://localhost:5000' to 'http://127.0.0.1:5000' solved my problem.
If anyone knows I'd still be curious why this fixed it. I can go to 'http://localhost:5000' in my browser and query my backend just fine.

deploy nuxtjs application to GCP, but it gives server error?

I'm new to GCP (google cloud platform) I'm facing this problem, Backend dev created an Apache server on gcp, and then I cloned my repo on the server through VM, build it and then deployed it after following countless tutorials.. but while deploying it gives
Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable.
when i go to the generated link which is https://vetution.oa.r.appspot.com/ it gives server error, I've searched a lot but I failed.
Have I done something wrong or the app.yaml file should have different configurations.
anyway here it is
runtime: nodejs12
instance_class: F2
handlers:
- url: /_nuxt
static_dir: .nuxt/dist/client
secure: always
- url: /(.*\.(gif|png|jpg|ico|txt))$
static_files: static/\1
upload: static/.*\.(gif|png|jpg|ico|txt)$
secure: always
- url: /.*
script: auto
secure: always
env_variables:
HOST: '0.0.0.0'
NODE_ENV: 'production'
And It gives me this error on deploying now
please, Help me I'm very frustrated.
The error states that, your app failed to start because it's not listening to a port as you may not have configure it to your app. This topic is answered on this Stackoverflow thread.
You mentioned that you followed countless tutorials, it is possible that you are using Cloud Run and App Engine interchangeably, which are 2 separate serverless products. Please evaluate on your end which platform is right for your app and use case.
Currently, there is not much debugging info to your question but either way, make sure that you configure your app's port to listen to incoming request/s, it can be port 8080 or can be any of your choice. Also, check your GCP logs, backend issues and server errors can be seen and monitored by simply looking at the logs for App Engine or Cloud Run.
Check Cloud Run configuring the container ports, for port configuration.

Why does kompose up yields "connection refused"?

Running docker-compose up on a simple web app works as expected. Running kompose up on the same app while attempting to connect to a Google Cloud cluster doesn't work:
...
INFO We are going to create Kubernetes Deployments, Services and PersistentVolumeClaims for your Dockerized application. If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead.
FATA Error while deploying application: Get http://127.0.0.1:6443/api: dial tcp 127.0.0.1:6443: connect: connection refused
What are possible causes of this problem?
Other posts here on SO do not help, and I can't find any other relevant result on the web.

Cannot reach react application via dns hosted on ec2

I just want to see my development working on an EC2, showing to some friends, and think in deploying it after all of the work is done, but react doesn't cooperate. :/
I did everything I always do.
Started a ubuntu server on EC2
applied a group with 3000/tcp opened in my instance
Installed all dependencies of my app, npm 11.1 and its packages via npm install.
npm started it
and...
Nope.. there is no "and"... just my tears over a bunch of attempts without reaching 3000/tcp via public ip and dns..
I even tested ping on it.. set ICMP echo request and response rules, tested and it worked, but when I try to reach the application by 3000/tcp port, nothing.
Does someone have any idea?
As an image talk more than a thousand words, there it is... My nighmare
PS: a curl on localhost:3000 inside the ec2 works just fine.. while
another curl outside the ec2 returns Connection Refused
Looks like the application is bound to localhost (127.0.0.1). Update your start property to include --host 0.0.0.0
Refer: https://github.com/webpack/webpack-dev-server/issues/147

Installing and Viewing Neo4j on Existing AWS EC2 Instance

I'm trying to install the enterprise edition of neo4j on an existing EC2 (Amazon linux) instance. So far I've
wget "link to enterprise"
untar the file
renamed and moved the folder to NEO4J_HOME
then went into the config files for neo4j.properties to make the following changes:
# Enable shell server so that remote clients can connect via Neo4j shell.
remote_shell_enabled=true
# The network interface IP the shell will listen on (use 0.0.0 for all interfaces)
remote_shell_host=127.0.0.1
# The port the shell will listen on, default is 1337
remote_shell_port=1337
EDITED Christophe Willemsen pointed out that for my original error, I had forgotten to restart the server at that point but I was still unable to access the web server while it was running. So to make it more clear, I've edited the remaining post:
I went to neo4j-server.properties and uncommented:
org.neo4j.server.webserver.address=0.0.0.0
And start the server
NEO4J_HOME/bin/neo4j start
WARNING: Max 1024 open files allowed, minimum of 40 000 recommended. See the Neo4j manual.
Using additional JVM arguments: -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:-OmitStackTraceInFastThrow
Starting Neo4j Server...WARNING: not changing user
process [28557]... waiting for server to be ready..... OK.
http://localhost:7474/ is ready.
checking the status:
NEO4J_HOME/bin/neo4j status
Neo4j Server is running at pid 28557
I can run the shell but the when I go to localhost 7474 I still can not connect
Any help would be appreciative. The only tutorial or help I've found assumed I was starting from scratch with a new instance. If someone could provide some instructions for installing or fix my configuration that would be great.
Thanks!
You have to edit neo4j-server.properties and uncomment the line with:
org.neo4j.server.webserver.address=0.0.0.0
So that the db listens on an external interface not just localhost, and you have to open the port (7474) in your firewall rules.
Make sure to secure access to the db though:
http://neo4j.com/docs/stable/security-server.html