{"id":21085433,"url":"https://github.com/magec/nomad-packfile","last_synced_at":"2026-03-07T17:09:12.000Z","repository":{"id":248652585,"uuid":"827816449","full_name":"magec/nomad-packfile","owner":"magec","description":"Deploy nomad-packs","archived":false,"fork":false,"pushed_at":"2025-02-12T16:30:26.000Z","size":24842,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T22:08:46.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-12T12:43:51.000Z","updated_at":"2025-02-12T16:29:16.000Z","dependencies_parsed_at":"2024-07-16T09:49:28.623Z","dependency_job_id":"1cf90de3-489c-43e1-95b2-e9d1ed3448ef","html_url":"https://github.com/magec/nomad-packfile","commit_stats":null,"previous_names":["magec/nomad-packfile"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/magec/nomad-packfile","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magec%2Fnomad-packfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magec%2Fnomad-packfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magec%2Fnomad-packfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magec%2Fnomad-packfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magec","download_url":"https://codeload.github.com/magec/nomad-packfile/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magec%2Fnomad-packfile/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264502387,"owners_count":23618587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T20:33:14.153Z","updated_at":"2025-10-25T15:43:17.076Z","avatar_url":"https://github.com/magec.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nomad-Packfile\nDeclaratively deploy nomad packs to different clusters.\n\n## Introduction\n\n[Nomad Pack](https://github.com/hashicorp/nomad-pack) is a a templating and\npackaging tool used with [HashiCorp Nomad](https://www.nomadproject.io/).\n\nIt is used to deploy applications to Nomad using templates, this way\npackages can be reused and parametrized.\n\n## Why another tool on top of that?\nEven though packages are declarative by themselves, their *instantaions* are not.\n\nThis is because `nomad-pack` permits you to set up variables when running, etc. Moreover,\nyou cannot define a set of packages to be deployed to the same or different environments.\n\nThis is where `nomad-packfile` comes into place, it can be used to:\n\n- Declare different environments with different global configurations.\n- Declare several releases with their values set (optionally you can still use ENV_VARS).\n\nIt is strongly inspired by [Helmfile](https://github.com/helmfile/helmfile).\n\n## Installation\n\nDownload the binary from [release](https://github.com/magec/nomad-packfile/releases) and \nput it in your PATH.\n\n## Configuration\n\nThe tool reads a `packfile.yaml` file in the current directory (or the one specified with `-f`),\nand synchronize the desired state with the Nomad cluster(s).\n\nHere is an example of a `packfile.yaml`:\n\n```yaml\n---\nenvironments:\n  staging:\n    nomad-addr: https://staging.nomad.cluster\n    nomad-token: \"{{ .Env.STAGING_NOMAD_TOKEN }}\"\n  production:\n    nomad-addr: https://production.nomad.cluster\n    nomad-token: \"{{ .Env.PRODUCTION_NOMAD_TOKEN }}\"\n\nregistries:\n  - name: myorg\n    url: github.com/myorg/nomad-packs\n\nreleases:\n  - name: application\n    pack: myorg/some_application\n    vars:\n      image_tag: \"{{ .Env.IMAGE_TAG }}\"\n    var-files:\n      - nomad/common.hcl\n      - \"nomad/{{ .Environment.Name }}.hcl\"\n```\n\nIn this example, we have two environments, `staging` and `production`, and a release `application`. Nomad\npack will be deployed to both clusters with the configuration specified in the `vars` and `var-files` sections.\nNote that you can use templates in the `vars` and `var-files` sections.\n\n### Environments\n\nThe `environments` section is used to define the different environments where the packs will be deployed. It\ncan be any number of them. Once you have an environment defined, everytime you execute `nomad-packfile` the desired state\nwill be the the product of releases and environments. Note that the resulting configuration for each release, will be the\nenvironment configuration merged with the release one.\n\nThis means that for the example, you end up with these two releases to be deployed:\n\n```yaml\n...\n  - name: application\n    pack: myorg/some_application\n    nomad-addr: https://staging.nomad.cluster        # Inherited from Environment config\n    nomad-token: \"{{ .Env.STAGING_NOMAD_TOKEN }}\"    # Inherited from Environment config\n    vars:\n      image_tag: \"{{ .Env.IMAGE_TAG }}\"\n    var-files:\n      - nomad/common.hcl\n      - nomad/staging.hcl                            # Template resolved to environment name.\n  - name: application\n    pack: myorg/some_application\n    nomad-addr: https://production.nomad.cluster     # Inherited from Environment config\n    nomad-token: \"{{ .Env.PRODUCTION_NOMAD_TOKEN }}\" # Inherited from Environment config\n    vars:\n      image_tag: \"{{ .Env.IMAGE_TAG }}\"\n    var-files:\n      - nomad/common.hcl\n      - nomad/production.hcl\"                        # Template resolved to environment name.\n...\n```\n\nThis means that in this example, you will deploy the application to\nboth `staging` and `production` environments. You can filter out the environments by using the `--environment` flag.\n\n### Registries\nThe `registries` section is used to define the registries where the packs are stored. You can define as many registries as you want.\nThey will be referenced in releases when you declare the name of the pack to see (see bellow).\n\nRegistries can have:\n\n- **name**: The name of the registry, it will be used in releases to reference this registry. It will also be used when fetching the registries.\n- **url**: Url of the registry (see `nomad-pack registry add --help` for more information).\n- **Ref**: Specific git ref of the registry or pack to be added. Supports tags,\n        SHA, and latest. If no ref is specified, defaults to latest. Running\n        \"nomad registry add\" multiple times for the same ref is idempotent,\n        however running \"nomad-pack registry add\" without specifying a\n        ref, or when specifying @latest, is destructive, and will overwrite\n        current @latest in the global cache. Using ref with a file path is not\n        supported.\n- **Target**: A specific pack within the registry to be added.\n\n### Releases\nThis is where you define the releases themselves. It will reference the pack and also permits declaring variable files and variables. Note\nthat you can use templates inside these values.\n\nReleases can have:\n\n- **name**: The name of the release.\n- **pack**: The reference of the pack in the form of. By default it will treat it as a path, if you want to reference a registry, you need to use\n            `registry://registry_name/pack`.\n- **var-files**: An array of varfiles to be added to command invocation. If files are not found it will show a warning and skip it.\n- **vars**: An array of vars to be added to `nomad-pack` command invocation.\n- **environments**: This permits filtering out environments in case you don't want a given release to be deployed to every environment.\n- **nomad-addr**: Nomad addr to be used to deploy. This is usually set in the environment configuration.\n- **nomad-token**: Nomad Token to be used to deploy. This is usually set in the environment configuration using an templating and an env var.\n\n#### Templating\nAs mentioned, you can use templating in (`nomad-addr`, `nomad-token`, `var-files` and `vars`). This way, you can customize the configuration\nbased environment variables or the name of the environment (as shown in the example you can reference the Environment using `Environment.Name`).\nThis allows a more clean setup and less repetition.\n\n## Usage\n```bash\nDeclare the desired state of your packs and let nomad-packfile synchronize it with your Nomad cluster.\n\nUsage:\n  nomad-packfile [command]\n\nAvailable Commands:\n  completion  Generate the autocompletion script for the specified shell\n  help        Help about any command\n  plan        Execute a nomad-plan for every pack in the desired state\n  render      Execute a nomad-render for every pack in the desired state\n  run         Execute a nomad-run for every pack in the desired state\n\nFlags:\n      --environment string         Specify the environment name.\n  -f, --file string                Load config from file or directory (default \"packfile.yaml\")\n  -h, --help                       help for nomad-packfile\n      --log-level string           Log Level. (default \"fatal\")\n      --nomad-pack-binary string   Path to the nomad-pack binary. (default \"nomad-pack\")\n      --release string             Specify the release (this filters out any release apart from the specified one).\n\nUse \"nomad-packfile [command] --help\" for more information about a command.\n```\n\n`nomad-packfile` currently allows three commands:\n\n- **plan**: This will execute a `nomad-pack plan` for every release in the desired state.\n- **render**: This will execute a `nomad-pack render` for every release in the desired state.\n- **run**: This will execute a `nomad-pack run` for every release in the desired state.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagec%2Fnomad-packfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagec%2Fnomad-packfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagec%2Fnomad-packfile/lists"}