Hello, I’m creating architecture where I have one main REST API and few microservices that are doing “hard work” behind the scenes.
On my local environment everything works perfectly, but when I try to set up same architecture on digitalocean apps I get Error: connect ECONNREFUSED
My app spec looks like this:
services:
- build_command: npm run build
environment_slug: node-js
gitlab:
branch: develop
deploy_on_push: true
repo: html-pdf/html-pdf-api
http_port: 8080
instance_count: 1
instance_size_slug: basic-xxs
name: dev-html-pdf-api
routes:
- path: /
run_command: npm run start:prod
source_dir: /
- dockerfile_path: Dockerfile
gitlab:
branch: develop
deploy_on_push: true
repo: html-pdf/html-pdf-microservice
http_port: 8080
instance_count: 1
instance_size_slug: basic-xxs
internal_ports:
- 3000
name: dev-html-pdf-microservice
routes:
- path: /microservice
run_command: npm run start:prod
source_dir: /
so as you can see I’ve enabled 3000 internal port.
About the code, microservice is set up to listen on localhost:3000, and the main api is connecting to it using options:
options: {
host: 'dev-html-pdf-microservice',
port: 3000,
}
Unfortunately I get Error: connect ECONNREFUSED 10.245.138.142:3000. I’ve tried many other options with different options on api and microservice but same result.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Hello, thanks for trying DigitalOcean App Platform. Services running on app platform must bind to and expose the HTTP port on the network interface 0.0.0.0
rather than localhost
interface. This is true for both the internal dev-html-pdf-microservice
service and the external dev-html-pdf-api
service. The connection to the internal private service looks correct, so hopefully this is just the service binding issue.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.