Skip to content

Test CMS Changes

Wesley B edited this page Nov 7, 2022 · 22 revisions

Via Remote CMS Docker Image on Remote Server

  1. Deploy branch on available development server for the relevant project.

Via Local CMS Docker Image on Local Standalone CMS

  1. Have an existing Core-CMS.
  2. (If docker containers are running) Stop (i.e. bring down) the docker containers.
  3. Checkout branch to test.
  4. Run command npm run build.
  5. Start (i.e. bring up) the docker containers.

Via Remote CMS Docker Image on Local Standalone CMS

  1. Have an existing Core-CMS.

  2. (If docker containers are running) Stop (i.e. bring down) the docker containers.

  3. Ensure CMS secrets are up to date and accurate.

  4. Checkout relevant branch.¹

  5. Delete local CMS static directory and all local build directories.²

    Steps

    From repo root:

    • rm -rf static
    • rm -rf taccsite_cms/static/**/build
    • rm -rf taccsite_custom/*/static/**/build
  6. In the relevant docker-compose config file, update the services:cms:image value to a provided docker image tag.

  7. Rebuild the cms docker container without cache.

    Steps
    1. docker-compose build --no-cache cms (beware of -f
    2. docker-compose up --force-recreate --no-deps -d cms (beware of -f
  8. Start (i.e. bring up) the docker containers.

  9. (If error contacting database) Stop (i.e. bring down) then Restart (i.e. bring up) the docker containers.⁴

  10. In the CMS container, run python manage.py collectstatic --no-input.

Via Remote CMS Docker Image on Local Portal (with CMS)

⚠️ Warning: These steps have not been thoroughly verified.

  1. Have an existing Core-Portal.

  2. (If docker containers are running) Stop (i.e. bring down) the dockers.

  3. Checkout relevant branch.⁵

  4. Ensure CMS secrets are up to date and accurate.

  5. Delete local CMS static directory.²

    Steps

    From repo root:

    • rm -rf server/cms/static
  6. In the relevant docker-compose config file, update the services:cms:image value to a provided docker image tag.

  7. Rebuild the cms docker container without cache.

    Steps
    docker-compose -f server/conf/docker/docker-compose-dev.all.debug.yml up --force-recreate --no-deps -d cms
    
  8. Start (i.e. bring up) the docker containers.

  9. (If error contacting database) Stop (i.e. bring down) then Restart (i.e. bring up) the docker containers.⁴

  10. In the CMS container, run python manage.py collectstatic --no-input.


Footnotes
  1. Which branch?

    • For testing changes to any files except secrets.py, checkout main as a precaution to avoid an inaccurate test.

      The files to test should come from the image, not your local machine. If you have locally checked out main, and any files in the docker are unintentionally synced from your local environment to the docker, then they are the wrong files, thus more likely to cause a test failure.

    • For testing changes to secrets.py, checkout relevant branch and edit volumes in relevant docker-compose files to sync the secrets.py file:

            - ${PWD}/taccsite_cms/secrets.py:/code/taccsite_cms/secrets.py
      
  2. Why delete? To be sure that any static files in the CMS docker container originate from the image and were not synced from your local environment.

  3. If you intend to test a remote image without local modification, then do not use -f docker-compose.dev.yml (nor docker-compose.custom.yml based on docker-compose.dev.yml), because the - .:/code entry for volumes will overwrite the containers files originating from the image.

  4. The first start may hit a database contact error, Name or service not known. The second start should not.

  5. So that the CMS test is against the correct Portal code:

    • If the CMS branch has an accompanying Portal branch, then checkout that accompanying Portal branch.
    • If the CMS branch does not have an accompanying Portal branch, then checkout main.

Via Local CMS on Local Portal

Advanced. See Locally Develop CMS + Portal + Docs.