{"id":25707710,"url":"https://github.com/jhsware/nix-infra-test-machine","last_synced_at":"2025-02-25T08:38:38.897Z","repository":{"id":272946624,"uuid":"918262879","full_name":"jhsware/nix-infra-test-machine","owner":"jhsware","description":"Provision nix-infra standalone machines","archived":false,"fork":false,"pushed_at":"2025-01-24T23:24:29.000Z","size":96883,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T23:25:41.838Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Nix","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/jhsware.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}},"created_at":"2025-01-17T15:19:27.000Z","updated_at":"2025-01-24T23:24:32.000Z","dependencies_parsed_at":"2025-01-17T16:43:53.211Z","dependency_job_id":"f22a325c-da10-42d5-90ec-059e55c44dff","html_url":"https://github.com/jhsware/nix-infra-test-machine","commit_stats":null,"previous_names":["jhsware/nix-infra-test-machine"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhsware%2Fnix-infra-test-machine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhsware%2Fnix-infra-test-machine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhsware%2Fnix-infra-test-machine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhsware%2Fnix-infra-test-machine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhsware","download_url":"https://codeload.github.com/jhsware/nix-infra-test-machine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240634518,"owners_count":19832882,"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":"2025-02-25T08:38:37.401Z","updated_at":"2025-02-25T08:38:38.884Z","avatar_url":"https://github.com/jhsware.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nix-infra-test-machine\nThis is a standalone setup for testing nix-infra. It is intended to allow you to try out nix-infra with minimal configuration. All you need is a Hetzner account and some super basic configuration.\n\nYou are recommended to install Nix on your machine and work in a nix-shell. If you don't know how to install Nix, try the [Determinate Systems Nix installer](https://github.com/DeterminateSystems/nix-installer), it has uninstall support and automatic garbage collection.\n\n1. Download [nix-infra](https://github.com/jhsware/nix-infra/releases) and install it\n\n## Option 1: Run a fully automated test script\n\n2. Run [this script](https://github.com/jhsware/nix-infra-test-machine/blob/main/scripts/get-test.sh) in the terminal to download test scripts:\n\n```sh\nsh \u003c(curl -L https://raw.githubusercontent.com/jhsware/nix-infra-test-machine/refs/heads/main/scripts/get-test.sh)\n```\n3. Get an API-key for an empty Hetzner Cloud project\n\n4. Edit the .env in the created folder\n\n5. Run the test script\n\n```sh\nnix-shell\ntest-nix-infra-machine/test-nix-infra-machine.sh --env=nix-infra-machine/.env\n```\n\nOnce you have set up .env properly, the downloaded script will provision, configure and deploy your fleet. It will then run some tests to check that it is working properly and finish by tearing down the fleet.\n\n## Option 2: Create your custom config\n\n2. Clone [this repos](https://github.com/jhsware/nix-infra-test-machine):\n\n```sh\ngit clone git@github.com:jhsware/nix-infra-test-machine.git [my-new-repo]\n```\n\n3. Get an API-key for an empty Hetzner Cloud project\n\n4. Edit the .env in the created folder\n\n3. Get an API-key for an empty Hetzner Cloud project\n\n4. Edit the .env in the created folder\n\n```sh\ncp .env.in .env\nnano .env\n```\n\n5. Initialise the repo\n\n```sh\nnix-shell\nscripts/cli init --env=.env\n```\n\n6. Work with your fleet\n\n```sh\nscripts/cli create --env=.env node001\nscripts/cli ssh --env=.env node001\nscripts/cli cmd --env=.env --target=node001 ls -alh\nscripts/cli destroy --env=.env --target=node001\nscripts/cli update --env=.env node001\n```\n\nTo create custom configurationsm add them to the `nodes/` sub-directory and then run the `create`or `update` command above. The custom configuration is optional, if you want to create a fleet of equivalent machines you can add configuration files to `node_types/` and edit the cli script to allow you to select which type to use.\n\n## Test Script Options\n\nTo build without immediately tearing down the cluster:\n\n```sh\ntest-nix-infra-machine.sh --no-teardown --env=nix-infra-machine/.env\n```\n\nUseful commands to explore the running test cluster (check the bash script for more):\n\n```sh\ntest-nix-infra-machine.sh cmd --target=node001 \"uptime\" --env=nix-infra-machine/.env\ntest-nix-infra-machine.sh ssh node001 --env=nix-infra-machine/.env\n```\n\nTo tear down the cluster:\n\n```sh\ntest-nix-infra-machine.sh teardown --env=nix-infra-machine/.env\n```\n\n## Deploying an Application\nEach node has it's own configuration in the `nodes/` folder.\n\nIn this configuration you can configure what apps to run on that node and how you want them to be configured.\n\nThe actual deployment is done using the `deploy-apps` command and specifying the target nodes you want to update. All app configurations or the node will be affected.\n\n### Secrets\nTo securely provide secrets to your application, store them using the CLI `secrets` command or as an output from a CLI `action`command using the option `--store-as-secret=[name]`.\n\nThe secret will be encrypted in your local cluster configuration directory. When deploying an application, the CLI will pass any required secrets to the target and store it as a systemd credential. Systemd credentials are automatically encrypted/decrypted on demand.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhsware%2Fnix-infra-test-machine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhsware%2Fnix-infra-test-machine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhsware%2Fnix-infra-test-machine/lists"}