Dynflow / dynflow

DYNamic workFLOW orchestration engine
http://dynflow.github.io
MIT License
121 stars 44 forks source link

Installation documents for rails #421

Open omarluq opened 1 year ago

omarluq commented 1 year ago

Hey all! I was wondering if there are any references for installation and configuring the gem ?

adamruzicka commented 1 year ago

Hi, sadly nothing official really. It really depends in which environment you want to deploy it. You can take a look at how theforeman/foreman uses it for usage with rails and use that as a starting point. I'll be more than glad to answer any questions you might have and maybe we could then distill some proper docs from it.

Nevertheless, if you stick to rails getting started in development should be pretty straightforward, this seemed to work for me just now https://github.com/adamruzicka/df-test/commit/9a25e563b2fc0cf58e6f3ebbb313325ab24669f9 .

Once you do that, you should be able to fire a rails console a do something like this

> ::Rails.application.dynflow.world.trigger(::Actions::HelloWorld, "my friend").finished.wait; nil
ExecutionPlan bd87a6ea-7111-452d-982c-30b457ec04ee      pending >>  planning
         Step bd87a6ea-7111-452d-982c-30b457ec04ee: 1   pending >>   running in phase     Plan Actions::HelloWorld           
         Step bd87a6ea-7111-452d-982c-30b457ec04ee: 1   running >>   success in phase     Plan Actions::HelloWorld           
ExecutionPlan bd87a6ea-7111-452d-982c-30b457ec04ee     planning >>   planned                                                 
ExecutionPlan bd87a6ea-7111-452d-982c-30b457ec04ee      planned >>   running                                                 
         Step bd87a6ea-7111-452d-982c-30b457ec04ee: 2   pending >>   running in phase      Run Actions::HelloWorld           
Hello my friend                                                                                                              
         Step bd87a6ea-7111-452d-982c-30b457ec04ee: 2   running >>   success in phase      Run Actions::HelloWorld           
ExecutionPlan bd87a6ea-7111-452d-982c-30b457ec04ee      running >>   stopped

If you're not planning on using it together with rails, there are ways of embedding it into other ruby projects.

omarluq commented 1 year ago

@adamruzicka your application.rb is exactly what im looking for! It's interesting that I have to define a dynflow function in my application module to init dynflow! Would be nice if there was an initializer