Infrastructure as Code
You can use the Nullstone UI to configure your applications and infrastructure, but there are times when you want to configure in code. Placing configuration in code allows you to automate configuration, track infrastructure changes in version control, and share configuration with your team.
Pipeline and Workflow
Having configuration in code allows you to correlate infrastructure changes with code changes. As an example, lets say you are adding a new feature that requires the use of new infrastructure. In the same commit or PR, you can add both the configuration to the IaC (infrastructure as code) file and the code for the new feature. As the PR is opened, a preview environment is created and launched. Because the configuration is in the IaC file, the preview environment will be configured with the new infrastructure. You can test the new feature in the preview environment and ensure it works as expected.
IaC Files
There are two types of Nullstone IaC files that are placed in .nullstone/
directory of your repository.
.nullstone/config.yml
- Used as a primary source of configuration- Overrides file - Used to override configuration per environment from
nullstone/config.yml
or from the Nullstone UI.
An overrides file is either named previews.yml
(for all preview environments) or <env-name>.yml
(for a specific environment override). Nullstone GitOps runs a synchronization per environment so the effective config will be a merge of config.yml
and the env-specific overrides file. If you change a previews.yml
in a pull request, it will only affect the preview environment(s) that are synced on that branch.
The format of the IaC file is similar to a docker-compose file. An example is shown below.
version: "0.1"
apps:
acme-api:
vars:
num_tasks: 1
cpu: 256
memory: 512
environment:
DATABASE_URL: "{{ POSTGRES_URL }}"
ANOTHER_VAR: abc123
Auto-complete/validation in editor
Nullstone supports auto-completion and validation in your editor.
We publish a JSON schema (it applies to YAML as well) to schemastore.org.
The following editors are supported:
- Android Studio
- CLion
- Emacs via eglot
- IntelliJ IDEA
- JSONBuddy
- Neovim via SchemaStore.nvim
- PhpStorm
- PyCharm
- ReSharper
- Rider
- RubyMine
- SublimeText via LSP-json,LSP-yaml
- Visual Studio
- Visual Studio Code (YAML,TOML,JSON)
- Visual Studio for Mac
- WebStorm
If you want to download the JSON schema file directly, you can find it on our open-source repository nullstone-io/iac.