Network management (ports)
Each resource that is in form of a container, can have network ports opened. It enables communication within context namespace and can allow traffic via ingress, from the internet.
By default, all database templates have their ports ingress
disabled.
warning
Modifying a port requires full restart of the application. All ephemeral state is going to be lost!
Understanding ports
Common Ports:
- 80: Web traffic (HTTP)
- 443: Secure web traffic (HTTPS)
- 5432: PostgreSQL database
- 3306: MySQL database
- 8888: default port for the
custom
app
Adding ports
# Add a new port to an existing application
response = resource.resource_add_port(
name="my-app",
port_name="web",
new_port=8080,
ingress=True # Allow external access
)
Updating ports
# Change an existing port
response = resource.resource_update_port(
name="my-app",
port_name="web",
new_port=8081,
ingress=True
)
Deleting ports
# Remove a port
response = resource.resource_delete_port(
name="my-app",
port_name="old-port"
)
Listing ports
# Get all ports for an application
ports = resource.resource_list_ports("my-app")
if ports['code'] == 200:
for port in ports['details']:
print(f"Port {port['name']}: {port['port']}")