{"id":13510879,"url":"https://github.com/Avature/lxd-image-server","last_synced_at":"2025-03-30T17:31:37.451Z","repository":{"id":50665621,"uuid":"180595187","full_name":"Avature/lxd-image-server","owner":"Avature","description":"Creates, manages and mirrors a simplestreams lxd image server on top of nginx.","archived":false,"fork":false,"pushed_at":"2021-12-01T09:36:20.000Z","size":69,"stargazers_count":60,"open_issues_count":2,"forks_count":13,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-11-01T11:35:42.433Z","etag":null,"topics":["lxd","lxd-image","server"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Avature.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}},"created_at":"2019-04-10T14:07:06.000Z","updated_at":"2024-10-17T09:28:32.000Z","dependencies_parsed_at":"2022-09-22T17:21:28.514Z","dependency_job_id":null,"html_url":"https://github.com/Avature/lxd-image-server","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avature%2Flxd-image-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avature%2Flxd-image-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avature%2Flxd-image-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Avature%2Flxd-image-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Avature","download_url":"https://codeload.github.com/Avature/lxd-image-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246355418,"owners_count":20763993,"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":["lxd","lxd-image","server"],"created_at":"2024-08-01T02:01:57.796Z","updated_at":"2025-03-30T17:31:37.436Z","avatar_url":"https://github.com/Avature.png","language":"Python","funding_links":[],"categories":["Python","server"],"sub_categories":[],"readme":"Lxd-image-server\n================\n[![Build Status](https://travis-ci.org/Avature/lxd-image-server.svg?branch=master)](https://travis-ci.org/Avature/lxd-image-server)\n\nCreates and manages a simplestreams lxd image server on top of nginx.\nIf installed as a debian package, a new service is created and it monitors\nif there are any changes in the image directory and updates json files.\n\nRequirements\n------------\n\n* Python: Version 3.5.2 or higher.\n\n* Nginx\n\n* OpenSSL\n\nBuilding the debian package\n---------------------------\n\n### Building the package ###\n\nTo build lxd-image-server, first, install the build dependecies:\n\n```bash\n# debhelper \u003e= 9\n# dh-virtualenv \u003e= 9\napt-get install debhelper dh-exec python3 python-dev dh-virtualenv\n```\n\nThen build the package:\n\n```bash\ndpkg-buildpackage -us -uc -b\n```\n\n### Building the package in a Docker container ###\n\nTo build lxd-image-server itself in a Docker container, call docker build:\n\n```bash\ndocker build --tag lxd-image-server-builder .\n```\n\nThis will build the DEB package for Ubuntu Bionic by default. Add e.g.\n--build-arg distro=ubuntu:xenial to build for Ubuntu Xenial.\n\nThe resulting files must be copied out of the build container, using these\ncommands:\n\n```bash\nmkdir -p dist \u0026\u0026 docker run --rm lxd-image-server-builder tar -C /dpkg -c . | tar -C dist -xv\n```\n\nInstallation\n------------\n\n### From debian package (recommended) ###\n\nThe debian package will automatically copy the source files, create the user lxdadm\nto upload the files and setup the nginx server with its configuration (included a\nself signed ssl certificate).\n\n* **Install from repository**:\n\n```sh\napt-get install lxd-image-server\n```\n\n* **Install using dpkg**:\n\n```sh\ndpkg -i lxd-image-server_0.0.1~xenial_all.deb\n```\n\nAfter the installation of the package, a rsa key has to be generated at\n/home/lxdadm/.ssh to control the upload of images:\n\n```sh\nssh-keygen\nGenerating public/private rsa key pair.\nEnter file in which to save the key (/root/.ssh/id_rsa): # use /home/lxdadm/.ssh/id_rsa\n...\n```\n\nThe generated id_rsa key will be used to upload files to the server.\n\n### From source code ###\n\nClone the repository and run:\n\n```sh\npython setup.py install\n```\n\nThe subcommand init generates all the default directories, ssl keys and links nginx\nconfiguration (when using default configuration it is recommended to use debian installation)\n\nUsage\n-----\n\nLxd-image-server is not just a new remote for your lxd, it also allows you to\ndistribute your images to different mirrors. Clients will update new images to\nthe master server and the master will mirror the image on the mirrors defined\non the configuration file.\n\nThe following picture describes, the master server which replicates images to\nother two servers. Clients can get images from any of them but they can only\nupload new images to the master.\n\n\n![usage](/doc/images/lxd-usage.svg \"lxc usage\")\n\nThe configuration file would be:\n\n```yaml\n[mirrors]\n  [mirror1]\n  user = \"lxdadm\"\n  remote = \"mirror1.xxxxxxx.com\"\n  key_path = \"/etc/lxd-image-server/lxdhub.key\"\n  [mirror2]\n  user = \"lxdadm\"\n  remote = \"mirror2.xxxxxxx.com\"\n  key_path = \"/etc/lxd-image-server/lxdhub.key\"\n```\n\nThe installed service on the master will automatically monitor the image\ndirectory and update all the required metadata. No further commands are needed.\n\nThis is the structure the simplestreams server needs to have.\n\n```\n- /var/www                                         # document root\n        `- simplestreams\n           |- images                               # images folder\n           |  `- iats                              # environment\n           |     `- xenial                         # release\n           |        `- amd64                       # architecture\n           |           `- default                  # box type\n           |              `- 20180716_12:00        # version 1\n           |                 |- lxd.tar.xz         # index and templates\n           |                 `- rootfs.squashfs    # rootfs of container\n           `- streams\n              `- v1\n                 |- index.json                     # index of products\n                 `- images.json                    # info with versions of products\n```\n\nThe command `lxd-image-server` can be used to manage the server manually:\n\n```sh\nUsage: lxd-image-server [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --verbose        Sets log level to debug\n  --help           Show this message and exit.\n\nCommands:\n  init\n  update\n  watch\n\nDefault paths:\n    - Index files: /var/www/simplestreams/streams/v1\n    - Image dirs: /var/www/simplestreams/images\n```\n\n### Logging configuration\n\nThe logging via configuration. The default configuration is defined\n[here](lxd_image_server/default_config.toml).\n\n### Subcommands ###\n\n#### init ####\n\nInit creates default configuration needed for the server. See Installation\nsection for more info.\n\n#### Update ####\n\nUpdate recreates all the metadata from scratch, and recalculate the\nsha256 info for all the images. This option is only intended as a safeguard or in case\nthe service is not running.\n\n#### Watch ####\n\nWatch will start the monitoring of the directory. It is intended to be\nused only if the service is not running.\n\nHow to use my new server?\n-------------------------\n\n### How to add server as lxd remote ###\n\nOnce your own image server is running, you can add it as new remote on lxc:\n\n```bash\nlxc remote add \u003cname\u003e \u003curl\u003e --protocol=simplestreams\n```\n\nRemember add the certificate:\n\n```bash\nopenssl s_client -showcerts -connect \u003curl\u003e:443 \u003c/dev/null 2\u003e/dev/null | openssl x509 -outform PEM \u003e my-lxd-image-server.cert\ncp my-lxc-image-server.cert /user/local/share/ca-certificates\nupdate-ca-certificates\nsystemctl restart lxd\n```\n\nAlso, you can use https://letsencrypt.org/ and makes easier use your server.\n\n### Publish a new image ###\n\nNow, any client can create a image container and publish it on the master server. [Here]9https://ubuntu.com/blog/publishing-lxd-images):\n\n```bash\nlxc launch lxc:ubuntu/bionic/amd64 n1\nlxc exec n1 -- apt-get -y install vim\nlxc stop n1\nlxc publish --public n1 --alias=bionic-vim\nlxc image copy bionic-vim \u003curl\u003e\n```\n\nNow, you can use your image in a new container\n\n```bash\nlxc launch bionic-vim ntest\nlxc exec ntest -- vim -c \"smile\"\n```\n\nFor more information [Here](https://ubuntu.com/blog/publishing-lxd-images).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAvature%2Flxd-image-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAvature%2Flxd-image-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAvature%2Flxd-image-server/lists"}