cloudapi: Listen on /run/cloudapi/api.socket

Add a local socket for communicating with the cloudapi. It is started by
osbuild-composer.socket and is located at /run/cloudapi/api.socket

cloudapi requests can be passed to it using curl like this:

curl -k --unix-socket /run/cloudapi/api.socket --header 'Content-Type: application/json' \
--data request.json http://localhost/api/image-builder-composer/v2/compose

A simple request.json looks like this:

{
  "distribution": "fedora-38",
  "image_request":
    {
      "architecture": "x86_64",
      "image_type": "guest-image",
      "upload_options": {},
      "repositories": [
          {
            "name": "fedora",
            "metalink": "https://mirrors.fedoraproject.org/metalink?repo=fedora-38&arch=x86_64",
            "check_gpg": false
          },
          {
            "name": "updates",
            "metalink": "https://mirrors.fedoraproject.org/metalink?repo=updates-released-f38&arch=x86_64",
            "check_gpg": false
          }
      ]
    }
}
This commit is contained in:
Brian C. Lane 2023-07-13 08:19:27 -07:00 committed by Sanne Raymaekers
parent 6735e74897
commit ea05f400e6
2 changed files with 9 additions and 2 deletions

View file

@ -3,6 +3,7 @@ Description=OSBuild Composer Weldr API socket
[Socket]
ListenStream=/run/weldr/api.socket
ListenStream=/run/cloudapi/api.socket
SocketGroup=weldr
SocketMode=660