agentejo / cockpit

Add content management functionality to any site - plug & play / headless / api-first CMS
http://getcockpit.com
MIT License
5.4k stars 524 forks source link

[Feature Proposal] automatic collection/form/webhook initialization #1365

Open beasteers opened 4 years ago

beasteers commented 4 years ago

We should add a directory in /var/www/html/storage that cockpit will read on first boot and will create different content types from json files in the directory.

e.g.

/var/www/html/storage/init/:
    collections/:
        collectionname.json:
            data: fields: []
    webhooks/:
        update-something.json: ...

Why is this useful? When deploying Cockpit in contexts like Docker and Kubernetes, there is an undetermined amount of startup time as well as a requirement to call /install, making the install and scaffolding of a Cockpit instance a bit of a struggle. You basically have to start cockpit and then create another container that will run after and wait for it to start up before sending a bunch of API requests.

This would allow you to just dump these files in a volume and as soon as Cockpit is ready it can add them on its own time.

how should this be done? I think this could be added to the /install logic quite easily. And it could work seamlessly after merging the admin user autoinstall functionality.

what's missing? there's no API documentation on how to post webhooks, forms, or singletons so I'll need to research how to physically do this