pub enum Network {
Database,
Metrics,
Visualization,
Proxy,
}Expand description
Docker Compose networks used for service isolation
Each network serves a specific security purpose:
Database: Isolates database access to only the trackerMetrics: Allows Prometheus to scrape tracker metricsVisualization: Allows Grafana to query PrometheusProxy: Allows Caddy to reverse proxy to backend services
§Serialization
When serialized, the network outputs its name string (e.g., "metrics_network"),
making it directly usable in Tera templates:
networks:
- {{ network }} # Renders as "metrics_network"Variants§
Database
Network for database access (Tracker ↔ MySQL)
Only the tracker and MySQL are connected to this network,
ensuring database isolation from other services.
Metrics
Network for metrics scraping (Tracker ↔ Prometheus)
Allows Prometheus to scrape metrics from the tracker while keeping Prometheus isolated from other traffic.
Visualization
Network for visualization queries (Prometheus ↔ Grafana)
Allows Grafana to query Prometheus for dashboard data.
Proxy
Network for TLS proxy (Caddy ↔ backend services)
Allows Caddy to reverse proxy to services that need TLS termination (tracker API, Grafana, etc.).
Implementations§
Source§impl Network
impl Network
Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
Returns the network name as used in docker-compose.yml
§Examples
use torrust_tracker_deployer_lib::domain::topology::Network;
assert_eq!(Network::Database.name(), "database_network");
assert_eq!(Network::Metrics.name(), "metrics_network");
assert_eq!(Network::Visualization.name(), "visualization_network");
assert_eq!(Network::Proxy.name(), "proxy_network");Sourcepub fn driver(&self) -> &'static str
pub fn driver(&self) -> &'static str
Returns the network driver
Currently all networks use the bridge driver.
§Examples
use torrust_tracker_deployer_lib::domain::topology::Network;
assert_eq!(Network::Database.driver(), "bridge");Sourcepub fn description(&self) -> &'static str
pub fn description(&self) -> &'static str
Returns a short description of the network’s purpose
This description is rendered as a comment in docker-compose.yml to help system administrators understand each network’s role.
§Examples
use torrust_tracker_deployer_lib::domain::topology::Network;
assert_eq!(Network::Database.description(), "Database isolation: Tracker ↔ MySQL");
assert_eq!(Network::Metrics.description(), "Metrics scraping: Tracker ↔ Prometheus");Trait Implementations§
impl Copy for Network
impl Eq for Network
Source§impl From<Network> for NetworkDefinition
impl From<Network> for NetworkDefinition
Source§impl Serialize for Network
Custom serialization to output the network name string
impl Serialize for Network
Custom serialization to output the network name string
This allows the Network enum to be used directly in Tera templates without needing wrapper types or custom serialization logic.
impl StructuralPartialEq for Network
Auto Trait Implementations§
impl Freeze for Network
impl RefUnwindSafe for Network
impl Send for Network
impl Sync for Network
impl Unpin for Network
impl UnsafeUnpin for Network
impl UnwindSafe for Network
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = !
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.