What is Codify?
Codify is a configuration as code tool that lets you define installations, packages and applications in an easy to read json file. Codify takes care of the hard part of downloading, installing and configuring them.
How does it work
Components:
-
CLI: The CLI is the interface that the user interacts with. The Codify CLI reads configuration files (codify.json files), downloads and manages plugins, generates diffs and orchestrates the process.
-
Plugins: The Codify CLI relies on plugins to perform operations on the operating system. Plugins allow Codify to be extensible and any operation / installation can be supported as long as there is a plugin written for it. Plugins interact with the operating system using shell commands just as a user would do. By default, Codify ships with a core plugin maintained by the Codify team that handles common installations such as: homebrew, NodeJS, Python, and more. Additional packages can be found on the Codify registry here.
-
codify.json: The desired configuration that Codify should plan. The Codify CLI reads the
codify.json
file, initializes the required plugins, plans the changes needed to meet the desired config incodify.json
and then applies the changes.
Workflow
This is a common workflow when working with Codify.
-
Write configs: Write the desired config for your dev environment. See here for rules and the syntax for writing
codify.json
files. Instead of writing your own configs, there are also pre-written that be found on the recipes page. For a list of available resources that can be provisioned using Codify see the codify registry. -
Plan: Use
codify plan
orcodify apply
in the same directory as thecodify.json
file in order for the CLI to pick up the file. Bothcodify plan
andcodify apply
will generate a plan. A plan is a list of changes (a change set) that Codify will need to make in order for the desired config to be reached. -
Apply: When using
codify apply
, the user will also be asked if they want to continue applying the plan. After answeringyes
, the CLI will apply the operations that were listed in the plan.
Usage Scenarios
Setting up a new computer
- home
DirectoryDownloads/
- …
DirectoryDocuments/
- …
DirectoryDesktop/
- …
DirectoryPublic/
- …
- codify.json
Codify is great at setting up new systems from scratch. It automates the process of downloading
and installing packages and setting up the configurations so that developers don’t need to waste
their time looking through company wikis, reading documentation or debugging strange
errors. Teams can maintain a central codify.json
file or a new codify.json
file can be quickly generated using the command codify import
.
Project Integration
- my-project-repo
Directorydist/
- …
Directorypublic/
- …
Directorysrc/
- …
- .gitignore
- codify.json
- package.json
- package-lock.json
- tsconfig.json
Codify can also be directly integrated into project repositories. Simply commit a codify.json
file into the project. By maintaining a codify.json
file inside a project, the required packages
and dependencies are kept together with the project.