Deployment of NearBeach

Note

NearBeach uses Pypi and Docker to deploy to customers.

NearBeach on Pypi can be found here

NearBeach on Docker can be found here

There are two release processes.

Process 1: should be used when there is new code for NearBeach, and any library updates

Process 2: should be used when there is a security issue within any of the libraries used for NearBeach. This will deploy an update for those libraries without sending out any new NearBeach code. aka deploy separately from the NearBeach deployment cycle.

i.e Boto3 has a security patch, and we need to deploy

Initial Checks

Check 1: If NearBeach requires any new Python Packages, these will need to be noted within the following locations;

NearBeach Source

  • /requirements.txt

  • /NearBeach/requirements.txt

  • /.github/deployment_files/template_pyproject.toml

The above will make sure the Python package is installed in the Docker build of NearBeach.

Check 2: Make sure Docker will build and run

  1. Using a terminal, cd into the NearBeach-Docker source directory

  2. Do a simple git pull and check that you are on the correct branch

  3. Run the following command to build a local version of NearBeach docker build –no-cache –file Dockerfile –tag robotichead/nearbeach:nearbeach-local .

  4. Use the docker-compose example on https://nearbeach.org/self-hosting/ and save in an appropriate location as docker-compose.yml

  5. Using the terminal, cd to the location of the docker-compose.yml file from previous instructions

  6. Modify the NearBeach image to match the build name. image: robotichead/nearbeach:nearbeach-local

  7. Using docker compose up -D you can easily test the local docker build of NearBeach

Check 3: Make sure Local Code will build and run

  1. Use the docker-compose example on https://nearbeach.org/self-hosting/ and save in an appropriate location

  2. Modify the Volumes to override the NearBeach installation directory - https://stackoverflow.com/questions/40905761/how-do-i-mount-a-host-directory-as-a-volume-in-docker-compose

TODO - Finish Check 3 code

Deployment Process 1

Note

Please make sure you are in a terminal, that is in the root folder of the project.

  1. Make sure you are on the develop branch, and all required features have been finished. i.e. merged into the develop branch.

  2. Run audit tools and fix any packages

    npm audit
    
  3. Compile the JavaScript into production mode

    npm run prod
    
  4. Implement the End to End tests using playwright

    npm run e2e
    

    Please note - you’ll need a default instance of NearBeach running with the fixture “NearBeach_basic_setup.json”.

  5. Check all screenshots from the End to End tests

  6. Make sure the development branch has been pushed into origin. This will include the compilation of the production JavaScript

  7. Check CircleCI’s latest build status for the development branch. All tests should be passing. If there are any tests that have failed, they’ll need to be fixed before deployment.

  8. Using gitflow, we’ll create a release.

    git flow release start <<version_number>>
    

    The version number should follow the format x.y.z. More information can be found at https://semver.org/

  9. Using gitflow, we’ll finish the release.

    git flow release finish <<version_number>>
    
  10. Push both the dev and main branch into the origin.

  11. Go to github, and do a release in github. Currently the release from the console does not trigger the github actions.

  12. Check the github actions for NearBeach, to see if the workflows are running correctly.

Deployment Process 2

This process should ONLY be followed when we just want to deploy a new version of NearBeach’s core libraries without deploying any of the new code. i.e. separated from the development cycle.

Example 1: Boto3 has a security patch, we need to release this library into NearBeach’s docker containers and get everyone to use the newest versions.

  1. Go to https://github.com/NearBeach/NearBeach

  2. On the NearBeach github page, click on the “Create a new release”

  3. Appropriately fill out the tag using the version x.y.z - for more information please read https://semver.org/

  4. Fill out the rest of the information as approprately as possible. Explain why there is a release, i.e. security patch for external library

  5. Make sure the target is “main”

  6. Deploy the release