# (DEPRECATED)

We no longer need to maintain a Docker-based approach to running OA/WS as we
have dedicated Dev server machines to simplify all of the steps required in
setting up.   Please see the [README](./README.md) for latest development setup.

# Docker Guide

This guide explains how to use Docker to run a development server for the frontend-accounting React app.

## Prerequisites

1. Docker Toolbox (**tested**: 1.9.1)
1. Makefile dependencies (make command)
1. Chrome browser (optional - for opening a browser already pointed to React app page)

## One-time Setup

The reason we are using Docker to run a development server for our React app is that it has a dependency on OA/Workstation - when the React app initializes, it needs to display a list of Statements.  This list is retrieved from the Workstation AccountingController `/accounting/overview` action.

It is still possible to develop some aspects  of the React app without running under Docker, but in order to test full functionality when embedded in Workstation, we need this Docker-ized version of the React app.

Consequently, you will first need to [setup OA/Workstation](https://github.com/theorchard/orchard/blob/master/docker-guide.md) by following all instructions and verify that <http://workstation.192.168.99.100.xip.io> (or whatever your docker-machine IP) is available on your dev box.

## Developing

1. Make sure you've created `.env` from `.env.shadow`
1. Make sure your containers from Orchard repo are running
1. Review [Cookies](#cookies) below for information on getting your React app to talk to your Workstation container successfully
1. `make start` to run the React app's webpack devserver in a container
1. `make accounting` to launch Chrome pointing at your devserver hosting the React app
1. `make cli` to execute a bash shell on the running container
1. `make clean` to shutdown the container
1. See [Makefile](./Makefile) for additional make targets

## Cookies

Our React app will be making calls to <http://workstation.192.168.99.100.xip.io> (or whatever your docker-machine IP) in order to retrieve statements.  Before it can do that, you will need to:

1. Login to your OA at <http://oa.192.168.99.100.xip.io>
1. Use a cookie inspection tool to view Cookies for OA.
1. Modify the cookie named `PHPSESSID` to have a domain of `.192.168.99.100.xip.io` (use your actual docker-machine IP)
1. Launch Workstation for a client via "Login as Admin"
1. Verify that Workstation is also using a cookie with `PHPSESSID` set to `.192.168.99.100.xip.io`
1. When launching <http://oa.192.168.99.100.xip.io>, make sure that it is also using a cookie with `PHPSESSID` set to `.192.168.99.100.xip.io`
