Skip to content

Goss: VPS validation after deploy

Linux · Configuration checks
Not studied

Added 2026-10-11. The example is for Linux with systemd, Nginx on the host and the site on 127.0.0.1:18080.

Problem

The deploy command finished without errors, but Nginx is off, the site file is gone, or the container answers with another application's page.

Solution

Goss is "a YAML based serverspec alternative tool for validating a server's configuration" — "quick and easy server validation". Describe the expected host state in goss.yaml and run the checks after every change. A file generated automatically with goss add must be reviewed against the requirements: a snapshot of the current state can lock in an existing mistake.

Example

Goss is installed on the host; check the Nginx config path and adjust it if needed. Add the HTTPS check once the certificate is issued.

service:
  nginx:
    enabled: true
    running: true
file:
  /etc/nginx/sites-enabled/devops-kb.is-a.dev:
    exists: true
addr:
  tcp://127.0.0.1:18080:
    reachable: true
    timeout: 1000
http:
  http://127.0.0.1:18080/:
    status: 200
    timeout: 3000
    body: ['devops-kb']
  https://devops-kb.is-a.dev/:
    status: 200
    timeout: 5000
    allow-insecure: false
    body: ['devops-kb']
goss --gossfile goss.yaml validate --format documentation

A non-zero exit code must stop the remaining release steps. The presence of a file doesn't check Nginx syntax: nginx -t is still needed before a reload. A successful connection to 18080 doesn't prove the port is closed from outside; that's a separate requirement for Docker port publishing and a network check.

When to use

After config changes, image updates or recreating the VPS. A check from the same host is complemented by external monitoring.

Source

How to apply it yourself

  1. Pin the Goss version and write 5–10 requirements for one server.
  2. Get a passing report after a deploy.
  3. In a copy of the test file, deliberately change the expected page text and make sure the check fails.
  4. Store the report with the release; once it's part of the deploy process, mark it "Studied".