Skip to content

Deploying BSIS

Brett Ausmeier edited this page Apr 19, 2016 · 10 revisions

N.B. The commands below should not be run as root or with sudo. They should be run as a user who is a sudoer. At some point you might be prompted for your password or GitHub credentials.

Known Issues

  • The scripts may fail if the server that they are running on does not have enough memory. The Grunt and Maven builds are the steps which require the most memory. 2GB should be sufficient, but depending on what else is running you may need more than this. If you have less than 2GB you may need to set up swap https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04.

  • If you have already set up Tomcat and deployed BSIS you will need to remove the existing BSIS webapp from the Tomcat webapps directory. You can do this by running rm -r /var/lib/tomcat7/webapps/bsis*.

  • It is possible that Tomcat might hang during startup due to a lack of entropy in the system. If you run into this issue you can generate entropy by running the following commands:

    sudo apt-get install rng-tools
    sudo rngd -r /dev/urandom

Set up BSIS

1. Download and run the script to provision the BSIS backend

# Download
curl -sL https://raw.githubusercontent.com/jembi/bsis/master/infrastructure/deployment/env/provision.sh > provision-backend.sh
# Run
bash provision-backend.sh

2. Download and run the script to provision the BSIS frontend

# Download
curl -sL https://raw.githubusercontent.com/jembi/bsis-frontend/master/infrastructure/deployment/env/provision.sh > provision-frontend.sh
# Run
bash provision-frontend.sh

3. Configure server settings

Edit the config file and change the apiHost from localhost to the VM's IP address:

nano /opt/bsis-frontend/app/config/config.json

Exit nano with ctrl+x

4. Update the frontend

# Download the update script
curl -sL https://raw.githubusercontent.com/jembi/bsis-frontend/master/infrastructure/deployment/env/update.sh > update-frontend.sh
# Run
bash update-frontend.sh

Update the deployed BSIS versions

Updating BSIS can be done by rerunning the setup steps above. The update scripts are just the same as the provision scripts with some commands removed so that they run faster for convenience.

Update the frontend

Run the update script which was downloaded as part of the setup steps above:

bash update-frontend.sh

If you want to deploy a different branch or tag you can pass the reference as the first parameter to the script e.g. bash update-frontend.sh my-branch.

Update the backend

# Download the update script
curl -sL https://raw.githubusercontent.com/jembi/bsis/master/infrastructure/deployment/env/update.sh > update-backend.sh
# Run
bash update-backend.sh

If you want to deploy a different branch or tag you can pass the reference as the first parameter to the script e.g. bash update-backend.sh v1.0.

Configure email

Email needs to be configured for the "Forgot Password" functionality to work. To configure the email settings follow the steps below:

Open the email.properties file located at /opt/bsis/src/email.properties for editing.

nano /opt/bsis/src/email.properties

Set up the SMTP credentials that you have for sending emails. The simplest way to do this is to create a Gmail account and simply add the username and password for that account as the smtp.auth.username and smtp.auth.password properties respectively. Alternatively, if you use a different service for SMTP you will also need to update the smtp.host and smtp.port properties with the details that the service provides.

After editing the file the SMTP properties should look something like:

smtp.host=smtp.example.com
smtp.port=25
smtp.auth.username=example
smtp.auth.password=exampleP4ssw0rd

Once you have saved the file you will need to redeploy the backend so that the changes can take effect. This can be done by following the "Update the backend" steps above.