Install Automation & Dockerized implementation


#1

I’m just getting started looking at Dreamfactory as part of our containerized backend, and wanted to check if there were any good resources or best-practices for automating the setup up of the dreamfactory instances and the app configurations.

Ideally it would work like our other containers in that it takes some environment variables (server names, api keys, dev/prod flags) and end up in a predictable, fully-functional, public-traffic-ready state once built locally or as part of our cloud build pipeline.

There seems to be two core stages that would be involved: #1 the setup of the dreamfactory instance itself, and #2 the setup of our App in terms of services, schema etc.

For #1 the first hurdle is the need for a system admin to be setup via the GUI - is there a way to do this via a config file? I have seen there is a CLI for this stage, so maybe thats possible to use via docker? I’ve also seen some issues with cookies persisting between builds of the container and causing auth issues preventing log-in/out, but thats more client-side.

For #2, there is the exporting of packages to configure the app, which seems to cover all the needed data there. Can these packages be imported via shell commands while setting up a docker container (either in the dockerfile or on entrypoint)?

All the above is likely possible to achieve by taking an image of the setup after configuring it manually (e.g. a copy of the local SQL database and filesytem) and using that as a golden master for all builds, but that seems like it could be quite brittle in terms of moving between environments (dev, test, staging, prod), security, and future updates.

Happy to take any suggestions/tips from people running dreamfactory in docker, or using a CI/CD pipeline.


#2

I would like to know from core team about these questions too.

The #1 is crucial. The current Docker image (and Docker Compose containers) does not handle this inicial step, and I haven’t succeeded in acomplish this through php artisan dreamfactory:setup is a nice way. The lack of documentation (even command descriptions) is horrible.

About the #2, I’m looking for two options, both using Configuration Management tools, like Terraform or Ansible. In the first, creating a provider (go binary) and placing it somewhere in PATH. The second developing a new module and maybe some roles. Both consuming the /system API.


#3

This has meanwhile been adressed, see http://www.devops-blog.net/dreamfactory/using-dreamfactory-2-x-as-rest-api-with-docker aswell as http://blog.dreamfactory.com/scaling-dreamfactory-with-docker


#4

Some more info about automated deployments:

So the very initial setup requires an admin account to be created. Imho that cant be automated yet via the system API.
Everything else will be handled and setup by the docker image via env vars.
(Cookies/Sessions dont cause problems between containers as DF uses completly stateless JWT tokens)

For seeding/importing your apps/roles/service/etc you can export/import them as a package via UI or via the system/package API. Which allows for automation / integration into CI/CD pipelines.
There are also alot other system/ endpoints which allow a more individual setup.

For orchestration (throughout various environments), I use docker-compose, see http://www.devops-blog.net/dreamfactory/orchestrating-dreamfactory-with-docker-compose-and-a-loadbalancer