## DEPLOYMENT

To deploy a new version: 

* Create a ```release``` branch from ```master``` branch with proper version number.  We use [SemVer - Semantic Versioning 2.0.0](https://semver.org/) for versioning.  For the versions available, see the tags on this repository.

* Log into the instance you wish to deploy the application, either ```beta``` or ```production```.

* Go to the directory where we pull source from GitHub.
    
    ```cd build-path``` 
    
* Create a new directory. 
    
    ```mkdir release-1.5.9``` (assuming the next release version is 1.5.9)
    
* Change directory to ```release-1.5.9```

    ``` cd build-path/release-1.5.9```
    
* If a ```git``` remote has not been added on the instance, add the HEAD of the repository. 

    ```git remote add scigap https://github.com/<sub-paths>/<repository>.git```

* Pull source code from the release branch. 

    ```git pull scigap release-1.5.9``` 

* Copy ```tl.sh``` and ```build.properties```. 

    ```copy build-path/tl.sh  build-path/release-1.5.9```

    ```copy build-path/build.properties build-path/release-1.5.9/cipres-config```  
    
* You should be in ```build-path/release-1.5.9``` directory. If not, ```cd``` into it.
    
* In ```tl.sh```, check the value of ```--front-end``` argument and make sure the module is what you want to deploy. Usually, the value in ```tl.sh``` is set to the correct module on each instance and you do not need to change any of it.

    - To deploy ```portal```, the value must be ```portal``` and the complete command should look like this:
    
        ```./build.py --conf-dir=cipres-config --front-end=portal clean deploy```
    
    - To deploy ```REST```, values must be ```rest``` and ```cipres-config/restusers``` and the complete command should look like this:
    
        ```./build.py --conf-dir=cipres-config --front-end=rest --front-end=cipres-config/restusers clean deploy```

* Run the ```tl.sh```.

* Open the browser and check to see if the application is deployed correctly. 

    - Go to ```http://your.server:8080/your_app_name``` or ```https://your.server:8443/your_app_name```

    - The ports 8080 and 8443 are default ports used by Tomcat.  We may or may not used the same two ports on our instances. 

--- 

### Minimum Tests After New Deployment:

1) Run one sge job and one non-sge job (cipres-framework), eg. clustalw and paup.

2) Find sdk.log entries for both jobs, find process worker entries for each in ```logs/running_jobs```, or ```logs/finished_jobs```.

3) Check results via web interface and check for jobs' working directories under ARCHIVED.

4) Make sure you get a job complete email for each job.
