← All topics

What does infrastructure as code mean?

A replacement server needs the same rules and services as the old one. Infrastructure as code records that setup in files so you can review it and apply it again.

Record the intended environment

Infrastructure as code describes an application’s environment in files, including servers, network rules, and services. A tool reads those definitions and configures the environment accordingly. Git records who changed the definitions and which version is intended for a rebuild.

Consider replacing a test server. If a required network rule is part of the definition, it can be applied again. If someone only added it through a console, it may be missing from the replacement. The files make infrastructure reproducible only to the extent that they capture the actual setup.

Rebuilding services does not restore their data

A definition for a database service does not contain its customer records. Data, uploads, and their restoration need a separate process. Credentials also need deliberate handling: depending on the tool, they are supplied separately or stored in encrypted form, rather than written into the definition as plain text.

Before applying a change, review which resources it will create, modify, or remove. A change to the definition can delete a resource. Reviewing the effects first helps catch that consequence before the change reaches the server.

How MainPath divides configuration ownership

On classic servers, MainPath uses Ansible during the first deployment to set up Docker, Traefik, a firewall, and HTTPS, among other things. The gitops-configuration repository holds the configuration for dev and prod. The architecture documentation explains how these parts fit together.

Each file has an owner. MainPath writes generated.yaml, the pipeline maintains deployed versions in versions.yaml, and your own environment variables belong under additional_env_variables in custom.yaml. Generated files such as .gitlab-ci.yml and env/*.generated.env are overwritten when the configuration changes, so custom changes need to use the supported custom files.

The custom files are unencrypted. Passwords and keys belong in the managed secrets. The environment variables guide explains where generated values, your own settings, and secrets belong.

Thank you for your request

We have received your request and will get back to you as soon as possible.

Would you like to talk to us directly?

Choose a time here for an introductory call with Robin.

Open the calendar in a new tab