{"id":15664758,"url":"https://github.com/apricote/hcloud-upload-image","last_synced_at":"2025-04-19T13:08:33.116Z","repository":{"id":238203826,"uuid":"793730572","full_name":"apricote/hcloud-upload-image","owner":"apricote","description":"Quickly upload any raw disk images into your Hetzner Cloud projects!","archived":false,"fork":false,"pushed_at":"2025-03-25T22:32:53.000Z","size":131,"stargazers_count":53,"open_issues_count":12,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T07:06:23.740Z","etag":null,"topics":["cli","go","golang","hcloud","hcloud-snapshot","hetzner","hetzner-cloud"],"latest_commit_sha":null,"homepage":"","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/apricote.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-04-29T19:00:31.000Z","updated_at":"2025-03-25T06:38:06.000Z","dependencies_parsed_at":"2024-05-19T16:31:17.021Z","dependency_job_id":"3e1c3756-b529-4241-bb96-551d87d4d4a9","html_url":"https://github.com/apricote/hcloud-upload-image","commit_stats":{"total_commits":49,"total_committers":2,"mean_commits":24.5,"dds":"0.26530612244897955","last_synced_commit":"6d8d2a02dfb4a6811113db75391f820c49179942"},"previous_names":["apricote/hcloud-upload-image"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apricote%2Fhcloud-upload-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apricote%2Fhcloud-upload-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apricote%2Fhcloud-upload-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apricote%2Fhcloud-upload-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apricote","download_url":"https://codeload.github.com/apricote/hcloud-upload-image/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246156419,"owners_count":20732397,"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":["cli","go","golang","hcloud","hcloud-snapshot","hetzner","hetzner-cloud"],"created_at":"2024-10-03T13:44:05.157Z","updated_at":"2025-03-30T21:32:04.057Z","avatar_url":"https://github.com/apricote.png","language":"Go","funding_links":[],"categories":["Tools"],"sub_categories":["Rust"],"readme":"# `hcloud-upload-image`\n\nQuickly upload any raw disk images into your [Hetzner Cloud](https://hetzner.com/cloud) projects!\n\n## About\n\nThe [Hetzner Cloud API](https://docs.hetzner.cloud/) does not support uploading disk images directly, and it only\nprovides a limited set of default images. The only option for custom disk images that users have is by taking a\n\"snapshot\" of an existing servers root disk. These can then be used to create new servers.\n\nTo create a completely custom disk image, users have to follow these steps:\n\n1. Create server with the correct server type\n2. Enable rescue system for the server\n3. Boot the server\n4. Download the disk image from within the rescue system\n5. Write disk image to servers root disk\n6. Shut down the server\n7. Take a snapshot of the servers root disk\n8. Delete the server\n\nThis is an annoyingly long process. Many users have automated this with [Packer](https://www.packer.io/) \u0026\n[`packer-plugin-hcloud`](https://github.com/hetznercloud/packer-plugin-hcloud/) before, but Packer offers a lot of\nadditional complexity to wrap your head around.\n\nThis repository provides a simple CLI tool \u0026 Go library to do the above.\n\n## Getting Started\n\n### CLI\n\n#### Binary\n\nWe provide pre-built `deb`, `rpm` and `apk` packages. Alternatively we also provide the binaries directly.\n\nCheck out the [GitHub release artifacts](https://github.com/apricote/hcloud-upload-image/releases/latest) for all of these files and archives.\n\n##### Arch Linux\n\nYou can get [`hcloud-upload-image-bin`](https://aur.archlinux.org/packages/hcloud-upload-image-bin) from the AUR.\n\nUse your preferred wrapper to install:\n\n```shell\nyay -S hcloud-upload-image-bin\n```\n\n#### `go install`\n\nIf you already have a recent Go toolchain installed, you can build \u0026 install the binary from source:\n\n```shell\ngo install github.com/apricote/hcloud-upload-image@latest\n```\n\n#### Usage\n\n```shell\nexport HCLOUD_TOKEN=\"\u003cyour token\u003e\"\nhcloud-upload-image upload \\\n  --image-url \"https://example.com/disk-image-x86.raw.bz2\" \\\n  --architecture x86 \\\n  --compression bz2\n```\n\nTo learn more, you can use the embedded help output or check out the [CLI help pages in this repository](docs/cli/hcloud-upload-image.md).:\n\n```shell\nhcloud-upload-image --help\nhcloud-upload-image upload --help\nhcloud-upload-image cleanup --help\n```\n\n### Go Library\n\nThe functionality to upload images is also exposed in the library `hcloudimages`! Check out the [reference documentation](https://pkg.go.dev/github.com/apricote/hcloud-upload-image/hcloudimages) for more details.\n\n#### Install\n\n```shell\ngo get github.com/apricote/hcloud-upload-image/hcloudimages\n```\n\n#### Usages\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net/url\"\n\n\t\"github.com/hetznercloud/hcloud-go/v2/hcloud\"\n\n\t\"github.com/apricote/hcloud-upload-image/hcloudimages\"\n)\n\nfunc main() {\n\tclient := hcloudimages.NewClient(\n\t\thcloud.NewClient(hcloud.WithToken(\"\u003cyour token\u003e\")),\n\t)\n\n\timageURL, err := url.Parse(\"https://example.com/disk-image-x86.raw.bz2\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\timage, err := client.Upload(context.TODO(), hcloudimages.UploadOptions{\n\t\tImageURL:         imageURL,\n\t\tImageCompression: hcloudimages.CompressionBZ2,\n\t\tArchitecture:     hcloud.ArchitectureX86,\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"Uploaded Image: %d\", image.ID)\n}\n```\n\n## Contributing\n\nIf you have any questions, feedback or ideas, feel free to open an issue or pull request.\n\n## License\n\nThis project is licensed under the MIT license, unless the file explicitly specifies another license.\n\n## Support Disclaimer\n\nThis is not an official Hetzner Cloud product in any way and Hetzner Cloud does not provide support for this.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapricote%2Fhcloud-upload-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapricote%2Fhcloud-upload-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapricote%2Fhcloud-upload-image/lists"}