NOTE – this routine deployment updates ALL of : the python libraries, the web API, and the web app
from the main branch of the BrainAnnex repository, which is often slightly ahead of the PyPI distribution
for the various versions of the brainannex python libraries.
On LOCAL machine: simply stop Flask, if running.
On SERVER:
Use PuTTY or other client (we recommend the free MobaXterm) to SSH to the server.
* Stop Gunicorn (or Flask's built-in server, whichever you're using)
if using Gunicorn (with or without Caddy):
| ps -e | grep gunicorn | Show all gunicorn processes |
| sudo pkill -f gunicorn | To kill all gunicorn processes at once; it takes a bit of time |
| ps -e | grep flask | Show all flask processes |
| kill 12345 | Replace the number with the process ID returned by the previous command! |
* Note: no need to stop the Neo4j database

You may use GitHub Desktop to pull the latest version from the main branch of the repository.
| sudo su - | To elevate permissions to the root account |
| cd /home/brain_annex | Or whatever location you used for your install |
| git reset --hard | To permanently discard all local changes to all files; typically not needed, but doesn't hurt |
| git pull --ff-only https://github.com/BrainAnnex/brain-annex.git | It fetches the remote repo, and merges it with the current one;
the "--ff-only" means only update to the new history if there is no divergent local history NOTE: your personalized "config.ini" file on the servers won't be affected, because it's NOT part of the repository. Likewise, your personalized "Caddyfile" on the server, if applicable, won't be affected |
| cat brainannex/__init__.py | grep __version__ | Optional, to double-check the version number of your upgrade |
| exit | To return to the normal login account (i.e., no longer root) |
requirements.txt
(see changelog), then
one needs to perform library installs/uninstalls in venv as needed (SAFE TO DO EVEN IF NOT NEEDED!)
If you're on local machine and using an IDE such as PyCharm, you should get prompted if you change your requirements.txt file.
On Linux:
| $ cd /home/brain_annex | Or whatever location you used |
| $ source venv/bin/activate | This will enter the virtual environment; notice the changed prompt in the next line |
| (venv) $ pip3 install -r requirements.txt | It should print out "Successfully uninstalled XYZ" and "Successfully installed ABC" |
| (venv) $ pip3 list | Optional: to see all the installed packages |
| (venv) $ pip3 show SOME_PACKAGE_NAME | Optional: to see more info about that particular package |
| (venv) $ deactivate | To exit the virtual environment |
Check any special instructions in the Change Log,
for the current release, as well as any release between the latest one and the one you're upgrading from.
Infrequently needed, but there have been cases of needed file changes and/or Cypher queries to manually run (using the Neo4j browser interface) as part of the upgrade,
to migrate your existing database to the new version of the BrainAnnex web app.
Finally, start the Web App