check:infra

Table of contents

  1. Introduction
  2. What it reads
  3. Keeping one stack per product
  4. Reference

Introduction

check:infra checks the Docker declarations of your selected product and its features, without starting a container. Run it when ports clash or a service will not start.

splent check:infra
  Infrastructure check

  Ports
  [OK] No port conflicts (4 ports declared)
  [OK] No conflicts with running containers

  Services
  [OK] No service name collisions (4 services)
  [OK] No container name collisions (0 named containers)

  Isolation
  [OK] 3 feature stack(s) isolate per product

  Networks
  [OK] Network 'splent_network' exists

  Build contexts
  [OK] my_first_app/web: Dockerfile found

  Health checks
  [OK] 2 service(s) with health checks

  Volumes
  [WARN] Volume 'redis_data' declared by multiple features: cache, sessions_in_cache

  All passed with 1 warning(s) (8 checks OK).

Any failure exits 1. Warnings alone do not. splent doctor runs it in its Environment section.


What it reads

It reads the compose files of the product and of each declared feature for the current SPLENT_ENV, through docker compose config with the product’s merged .env. So it checks the ports and names Docker would use.

A file Compose cannot read fails under Compose files, with Compose’s own error. When none can be read, the other sections print Not checked, no compose file could be read.


Keeping one stack per product

Each feature that brings containers gets one stack per product. The Isolation section checks each feature’s compose file as written, against rules that pass with one product and break the day a second product of the line runs beside it. Each finding prints its fix.

Finding Level
container_name is set, which Compose does not prefix Fail
A host port written literally instead of ${<FEATURE>_HOST_PORT}, such as ${INDEXER_HOST_PORT} for splent_feature_indexer@v1.2.3 Fail
A port variable that does not end in _HOST_PORT, so product:env does not offset it Warn
A port variable with no default in docker/.env.example, or no such file Fail
A writable bind mount to a host path, or a named volume missing from the top-level volumes: Warn
An external network pinned to one name instead of ${SPLENT_NETWORK:-splent_network} Fail

Reference

Section Finding Level
Ports Two services declare the same host port Fail
Ports A declared port held by a running container of another stack Warn
Services Two features define a service with the same name Warn
Services Two features use the same container_name Fail
Networks An external: true network does not exist. It prints the docker network create command Fail
Build contexts A service’s build: points to a Dockerfile that does not exist Fail
Health checks A service waits for another with condition: service_healthy, and that one has no healthcheck Fail
Volumes Two features declare the same named volume Warn

The containers of your product and its feature stacks never conflict with its own ports, so a product that is up passes. product:derive checks ports with the same rule.

When Docker cannot answer, the running-container and network checks warn Could not query docker for ... with Docker’s error, and no network is reported missing.

It needs a selected product (SPLENT_APP). See check:docker for Docker itself.


Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es