{"id":17551592,"url":"https://github.com/mati365/nomad-cheap-cluster","last_synced_at":"2025-04-24T02:12:59.279Z","repository":{"id":69538067,"uuid":"556292530","full_name":"Mati365/nomad-cheap-cluster","owner":"Mati365","description":"Cheap Nomad + Vault + Consul + Pulumi + Traefik + Ansible IaC cloud cluster live example","archived":false,"fork":false,"pushed_at":"2022-12-08T11:25:35.000Z","size":255,"stargazers_count":16,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-24T02:12:53.213Z","etag":null,"topics":["ansible","cloud","consul","docker","elasticsearch","hashicorp","hetzner","iac","infrastructure-as-code","linux","nomad","pulumi","traefik","vagrant","vault"],"latest_commit_sha":null,"homepage":"","language":"HCL","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/Mati365.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":"2022-10-23T14:19:37.000Z","updated_at":"2024-12-26T19:27:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"36859adb-ff3b-4e09-9218-32e239928e7e","html_url":"https://github.com/Mati365/nomad-cheap-cluster","commit_stats":null,"previous_names":["mati365/nomad-cheap-cluster"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mati365%2Fnomad-cheap-cluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mati365%2Fnomad-cheap-cluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mati365%2Fnomad-cheap-cluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mati365%2Fnomad-cheap-cluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mati365","download_url":"https://codeload.github.com/Mati365/nomad-cheap-cluster/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250546087,"owners_count":21448260,"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":["ansible","cloud","consul","docker","elasticsearch","hashicorp","hetzner","iac","infrastructure-as-code","linux","nomad","pulumi","traefik","vagrant","vault"],"created_at":"2024-10-21T04:46:49.261Z","updated_at":"2025-04-24T02:12:59.273Z","avatar_url":"https://github.com/Mati365.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cheap-cloud\n\nThis repo is an example of low-cost cloud infrastructure, with the entire cost of maintenance settling around $10 per month. The project uses the \"infrastructure as a code\" methodology for doing deployments and allows you to deploy Node based applications with dynamic staging environments.\n\nDefault preinstalled software:\n\n- Nomad\n- Consul\n- Vault\n- Ansible\n- Vagrant\n- Pulumi\n- Docker\n- Redis\n- ElasticSearch 7.x\n- Postgresql\n- Traefik\n- Node\n- Docker registry\n\nExample application that is connected to this cloud:\n\n\u003chttps://github.com/Mati365/upolujksiazke.pl\u003e\n\ncheck `jobs/` folder with Nomad tasks / services.\n\n## Architecture\n\n```mermaid\ngraph TD\n    subgraph \"Server (192.168.56.10)\"\n        A[Nomad server] -.-\u003e B\n        B[Consul server]\n    end\n\n    B --\u003e C\n    B --\u003e E\n\n    subgraph \"Client 1 (192.168.56.11)\"\n        C[Nomad client] -.-\u003e D\n        D[Consul agent]\n    end\n\n    subgraph \"Client X (192.168.56.X)\"\n        E[Nomad client] -.-\u003e F\n        F[Consul agent]\n    end\n```\n\n## Local testing\n\nGenerate ansible RSA key in `ansible/keys/ansible/` and then:\n\n```bash\n./start-dev.sh --create-vm\n```\n\n## Useful commands\n\n### Nomad\n\nList server members:\n\n```bash\nsudo nomad server members \\\n  -address=https://localhost:4646 \\\n  -ca-path=/var/www/nomad/tls/nomad-ca.pem \\\n  -client-cert=/var/www/nomad/tls/server.pem \\\n  -client-key=/var/www/nomad/tls/server-key.pem \\\n  -token=$(jq -r '.SecretID' /var/www/nomad/server/bootstrap.json)\n```\n\nList node members:\n\n```bash\nsudo nomad node status \\\n  -address=https://localhost:4646 \\\n  -ca-path=/var/www/nomad/tls/nomad-ca.pem \\\n  -client-cert=/var/www/nomad/tls/server.pem \\\n  -client-key=/var/www/nomad/tls/server-key.pem \\\n  -token=$(jq -r '.SecretID' /var/www/nomad/server/bootstrap.json)\n```\n\nPurge job:\n\n```bash\nsudo nomad job stop -purge \\\n  -address=https://localhost:4646 \\\n  -ca-path=/var/www/nomad/tls/nomad-ca.pem \\\n  -client-cert=/var/www/nomad/tls/server.pem \\\n  -client-key=/var/www/nomad/tls/server-key.pem \\\n  -token=$(jq -r '.SecretID' /var/www/nomad/server/bootstrap.json) \\\n  \u003cjob name\u003e\n```\n\nFail deployment:\n\n```bash\nsudo nomad deployment fail \\\n  -address=https://localhost:4646 \\\n  -ca-path=/var/www/nomad/tls/nomad-ca.pem \\\n  -client-cert=/var/www/nomad/tls/server.pem \\\n  -client-key=/var/www/nomad/tls/server-key.pem \\\n  -token=$(jq -r '.SecretID' /var/www/nomad/server/bootstrap.json) \\\n  \u003cdeployment id\u003e\n\n```\n\nTake vault snapshot:\n\n```bash\nVAULT_TOKEN=\u003ctoken\u003e vault operator raft snapshot save -tls-skip-verify ./snapshot.snap\n```\n\n### Consul\n\n```bash\nconsul members -token=$(cat /var/www/consul/tokens/bootstrap.key)\n```\n\n## License\n\nMIT License\n\nCopyright (c) 2022 Mateusz Bagiński\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmati365%2Fnomad-cheap-cluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmati365%2Fnomad-cheap-cluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmati365%2Fnomad-cheap-cluster/lists"}