Octopus (Deprecated)
====================

> DISCLAIMER: THIS REPOSITORY IS DEPRECATED. CONTRIBUTIONS AND UPDATES SHOULD BE DISCOURAGED,
> INSTEAD MOVE THE CODE TO A MORE PROPER REPOSITORY.

Amazon Simple Workflow.

### Installation

```bash
$ git clone https://github.com/theorchard/octopus.git
$ pyvenv env
$ source env/bin/activate
$ pip install -r requirements.txt
```

Set your as part of your current environment:

```bash
$ export AWS_ACCESS_KEY_ID=[Key]
$ export AWS_SECRET_ACCESS_KEY=[Secret]
```

### Launch sequence

Launch the decider, the activities then you can launch the flow.

```bash
$ source env/bin/activate
$ python cli.py -f example -w activity &
$ python cli.py -f example -w decider &
$ python cli.py -f example --start
```

Results will appear immediately in AWS SWF. Workflow that requires an input can be launched by using the `-c` flag. Input for workflows has to be valid `escaped json`. For instance:

```bash
$ python cli.py -f example --start -c '{"date_start": "2014-10-01"}'
```

### Deployment notes

For now the deployment is done by using an ec2 instance and docker. This is still a manual process:

* Connect to the ec2 instance and pull down the directory. 
* Make sure the ec2 instance has the required permissions (for now, I just use my own credentials, an instance role should be attached instead.)
* Copy `Dockerfile.shadow` to `Dockerfile` and replace the values in the with the production values.
* Create a docker, using the updated Dockerfile. `sudo docker build -t octopus .`
* Run the docker: `sudo docker run -t octopus`

*Note*: this approach is not scalable to `n flows`. We're currently looking at better deployment processes. 

### Known issues

#### Mac

* `pip install -r requirements.txt` fails on `pg_config`: [Installing psycopg2 on Mac](https://medium.com/small-bits/installing-psycopg2-on-mac-10-10-1-6d7baf4f6e2d)
