Question

Using DO Apps, how to open TCP port?

Trying to expose a TCP port for a node-red flow for some colleagues. This should be dead simple. The port I’m trying to open is 3333. Port 80 seems to auto-map to the typical http port 1800 and I can access the standard web editor via port 80. I tried this internal_ports you see at the bottom, but that isn’t working:

alerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
features:
- buildpack-stack=ubuntu-22
ingress:
  rules:
  - component:
      name: nodered-node-red
    match:
      path:
        prefix: /
name: scalesim
region: nyc
services:
- http_port: 8080
  image:
    registry: nodered
    registry_type: DOCKER_HUB
    repository: node-red
    tag: latest
  instance_count: 1
  instance_size_slug: basic-xxs
  internal_ports:
  - 3333
  name: nodered-node-red

Can someone advise how I might change this App Spec so that I can test the 3333 TCP port listener in my flow?


Submit an answer


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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
December 15, 2023
Accepted Answer

Hey Will,

I see you’re looking to expose 3333 as TCP port for your Node-RED flow on the DigitalOcean App Platform. Based on the current capabilities of the App Platform, there are a few key points to consider:

  1. The http_port field in your app specification determines the internal port that your service’s run command listens on. This is typically geared towards HTTP traffic. If you don’t set a PORT environment variable, the App Platform automatically uses the value of http_port.

  2. The internal_ports array you mentioned is intended for internal traffic within your application. These ports are used for communication between services within your app and are not exposed externally. Ports defined in internal_ports field can accommodate any TCP-based traffic.

  3. For routing external HTTP traffic to your service, you’ll use the ingress rules in your app spec. This is where you define how HTTP requests are directed to your service components. However, this is specifically for HTTP/HTTPS traffic and not for arbitrary TCP ports.

Given these constraints, if your application requires a direct exposure of a TCP connection on port 3333 that can’t be adapted to HTTP/WebSockets, you might find the App Platform limiting for this specific use case. In this scenario, a DigitalOcean Droplet could be a better fit. Droplets provide more flexibility in terms of network configurations, allowing direct management of TCP ports.

Hope that this helps!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.