******************************************************* Automate deployment using runscripts management command ******************************************************* Overview: -------------- The idea is to make the deployment process easier by running one management command responsible for running all scripts in one release. The :code:`runscript` management command checks the current version of the release :code:`settings.CODE_VERSION`, determines all non-applied scripts specific to that version then, applies them. Adding a new script to be run: ---------------------------------- - Make sure to update :code:`settings.CODE_VERSION` before running the script. - Go to the following path: :code:`pearlcertification/core/management/commands/runscripts.py` and write the list of scripts to apply in the :code:`scripts` list under Command class (make sure to add any arguments or kwargs the script needs): .. code-block:: python scripts = [ Script("testscript", "v3.25.0", database="resnet", site="cert"), Script("import", "v3.25.0", "file.txt", database="resnet", site="pqs"), ] - To execute the :code:`runscripts` command use the following code: .. code-block:: python python manage.py runscripts - Any script that was successfully applied will be stored in the database under the :code:`ManagementCommand` model whose data can be viewed under django admin page :code:`/cert_admin/core/managementcommand/`. - To make scripts run only in one specific site (cert, green_door, pqs, rea) set :code:`site` kwarg in :code:`Script()` as following: .. code-block:: python Script("testscript", "v3.25.0", database="resnet", site="cert")