Add TCP/UDP port mapping support

- Add app_ports table for storing port mappings per app
- Add Port model with CRUD operations
- Add handlers for adding/deleting port mappings
- Add ports section to app detail template
- Update Docker client to configure port bindings when creating containers
- Support both TCP and UDP protocols
This commit is contained in:
2025-12-30 12:11:57 +07:00
parent 4ece7431af
commit bc275f7b9c
9 changed files with 398 additions and 5 deletions

View File

@@ -15,6 +15,8 @@ import (
const requestTimeout = 60 * time.Second
// SetupRoutes configures all HTTP routes.
//
//nolint:funlen // route configuration is inherently long but straightforward
func (s *Server) SetupRoutes() {
s.router = chi.NewRouter()
@@ -79,6 +81,10 @@ func (s *Server) SetupRoutes() {
// Volumes
r.Post("/apps/{id}/volumes", s.handlers.HandleVolumeAdd())
r.Post("/apps/{id}/volumes/{volumeID}/delete", s.handlers.HandleVolumeDelete())
// Ports
r.Post("/apps/{id}/ports", s.handlers.HandlePortAdd())
r.Post("/apps/{id}/ports/{portID}/delete", s.handlers.HandlePortDelete())
})
// Metrics endpoint (optional, with basic auth)