herqles-io / hq-code-deployment

Herqles Frameworks and Workers for Code Deployment
MIT License
0 stars 0 forks source link

Apply apptype inheritence to the stage, deploy, rollback json structures #2

Open everestx opened 8 years ago

everestx commented 8 years ago

In working with this framework, I'm finding that inheritance among types would be very helpful. For instance, we have some 3 or 4 very similar apptypes that deviate slightly in each of the task and/or configuration steps.

  1. Ruby API - no assets, no background workers
  2. Ruby Basic Webapp - with assets, no background workers
  3. Ruby Full Webapp - Full service, with assets and background workers
  4. Ruby Background Worker - No web frontend at all, just a daemon

All of these app types are very similar in the stage operation: git clone, bundler, tarball and upload. However, each have a slight deviation in either the stage or deploy tasks (ex: deploy_path or rake assets:precompile)

This of course is still all possible when creating a stage/deploy using -f app.json options in the CLI, but I'm really apt to prevent apps from specifying any custom tasks that could ultimately be shared.

Adding this inheritance would allow different app-types that inherit from parent app-types. As an example Ruby could be the parent or super type. Ruby would then be barebones for stage and deploy: git clone, bundle, tarball, upload.

To get started, we could create a method to manage the read of the apptypes and handle the inheritance and deep merge of the json structure. This could be recursive to allow multiple layers of inheritance, using an app_type or parent_type key in each of the json structures.

rmb938 commented 8 years ago

I agree. We may have to move the app types from json files to python files. Doing that is not to difficult and it allows inheritance using the python model.

class BaseAppType(object)

class RubyType(BaseAppType)

class RubyAPIType(RubyType)

ect..

Doing it this way we could add more customization for app types. Like doing similar tasks depending on environment.

everestx commented 8 years ago

That's a good idea. I'll work in this direction and see what I can come up with. Would you expect to support both json and/or schematics models?