Skip to content

continuousphp/aws-swf

Repository files navigation

aws-swf

Build Status

Spaghetti compilation

We would assume you know the basic recipe of cooking spaghetti, if not, it's a good oportunity for your next date!

Here is our application workflow representation :

- Cooking Spaghetti ( Workflow )

    - Baking pasta ( Child Workflow )
        - Hot watter ( Activity )
        - Plunge pasta ( Activity )

    - Secret sauce ( Child Workflow )
        - Roast Oignons ( Activity )
        - Tomato Sauce ( Activity )

    - Compile pasta,sauce,parmesan ( Activity )
    - Eat !! ( Activity )

Installation

$ composer require 'continuousphp/aws-swf'

We use PSR-4 autoloading for discover Workflow and Activity class. But like SWF not support camelCase, we need enable classmap into composer.json the file vendor/composer/autoload_classmap.php is created during composer installation and help us to find class name much faster.

{
    "autoload": {
        "classmap": ["demo/"]
    }
}

run composer dump-autoload if dependencies already installed after your edition of composer.json.

Service Configuration

$ServiceConfig = new Continuous\Swf\ServiceConfig(
    'cphp-demo-0.1.0',
    'myDemoServer',
    $sdkAws->createClient('Swf'),
    'Continuous\\Demo\\Swf'
);

AWS Requirement

In order to run our workflow Spaghetti demo, you need to have an AWS Account.

## Setup IAM

For security reason we recommand you to create a speficic user with appropriate ACL before run this demo.

  1. Connect to your AWS console and go into AWS IAM section.
  2. Create new user named cphp-aws-swf-demo with keys assigned.
  3. Copy in your clipboard our policy config/aws-policy.json.
  4. Create an inline policy under Permissions tab on your user.
  5. Select Custom Policy and past the json in Policy document and follow instruction.

Now you have an user with proper permission, you need create credential file dedicated to aws keys

# Use Makefile target for generate file
$ make aws-config
# Create yourself a file  `.aws.conf` with your keys like this
aws.key=XXXX
aws.secret=XXX

Build the Workflow

Now our project are well setup, we are able to run phing task for build our Domain named cphp-demo with our Spaghetti Workflow and Activities associates.

  1. Use Makefile for setup AWS SWF
$ make setup
  1. Use Phing directly
# prepare settings for phing task
./vendor/bin/phing -propertyfile .aws.conf build

# run AWS SWF setup process
./vendor/bin/phing -propertyfile .aws.conf init

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published