Updating HypatiaCatalog.com - HypatiaOrg/HySite GitHub Wiki

[!Note] To run the command on this page, navigate to HySite directory that has the Docker compose.yaml file

[!TIP] For a visual representation and more discussion of the HypatiaCalalogs Website's design, see the Application Design wiki page.

Optional: Local Frontend (Web2py) update

To pull the latest Web2py framework updates from the source repositories, use the our wiki page: Web2py Framework Update

Update 1/5: Get for Frontend (Web2py) updates pushed to HySite

Our Main repository, HySite, uses submodules to include the web2py framework. Update the submodules to what has been committed to the HySite repository with the following command:

git submodule update --recursive

Note: Docker will need to be open to run this command.

[!WARNING] This command is part of the update script that the server runs, so it is best practice also to run this locally before updating the server.

Update 2/5: Run the data upload Python script

While it is possible to run this in the Python Console in PyCharm, the argparse statements at the end won't register. So it's better to run python update.py within the PyCharm terminal.

[!TIP] For a visual representation and more information about the data upload script, see the Data Pipeline section of the Application Design wiki page.

To see all the options for this script, add the help flag, for example:

python backend/update.py --help

Note that the --no-refresh-exo flag is used to prevent the script from downloading the exoplanet data from the NASA Exoplanet Archive (NEA). Instead, a cached copy of the data is used.

Docker environment (option 1)

docker compose run --build --rm django-api python update.py

Python environment (option 2)

python backend/update.py

View the test version of the website on your local computer

[!TIP] For a visual representation of the test website and more discussion on the configuration of the test website, see the Test Website section of the Application Design wiki page.

docker compose pull

and then

docker compose up --build

Since the whole thing needs to be built, which includes a variety of packages, it will take some time for it to build. To view the website in the browser, type in localhost. Use control-c to stop the server and free up the terminal.

Update 3/5: Commit and push the changes to the repository in GitHub

Before rebuilding containers on the server, all changes must be pushed to the GitHub Repository and must be on the main branch.

These steps are found in the following Wiki Page: Git Best Practices

Update 4/5: Publish the data to a public database

The public is the database used by the live website. It makes a copy of the data in the test database and moves it to the public database.

This creates duplicate database entries that were created in the previous step. We run the same update script, but now we add the --publish flag to the command to run a separate definition that updates the public database.

Docker environment (option 1)

This requires that any changes have been pushed to the repository and are on the main branch or the caleb/no-api branch for the Web2py repository.

docker compose run --rm django-api python update.py --publish

Python environment (option 2)

python backend/update.py --publish

This will take the files that were generated under test/ and move them to the folders for the website. The progress of the database update can be viewed using the MongoDB Compass, specifically looking at the number of stars.

Note: This command will make it such that anyone using Hypatia during this update will get a smaller number of stars that will change over time as the database is rebuilding.

Update 5/5: Finish the Update database

(option 1) rebuild the Docker containers

SSH into the server

ssh hysite

Update the server's packages

Find out what needs to be updated with:

sudo apt-get update

Install all the available updates (this will update Docker):

sudo apt-get upgrade -y

Run the updates script

/home/ubuntu/HySite/scripts/update.sh

exit the connection

exit

Clear the Docker files

This will help free up disk space by removing the Docker files and cache data after completing the update process.

docker system prune --all --force 

(option 2) restart the containers only

Consider this option if you have already run the update.sh script and do not want to rebuild the containers. This command logs into the Hypdata Catalog server and restarts the Docker containers, which refreshes the API settings and allows you to see changes to the summary data.

ssh hysite "docker compose --file /home/ubuntu/HySite/compose.yaml restart"