As of 11/30/22, this repo no longer serves as the base image for the Texastribune website and CMS. For now, it is still in use for the salaries app.
Github's dependabot regularly creates PRs that bump package versions in order to fix known security issues. To ensure that these updates don't cause unexpected behavior on the Texas Tribune website, we prefer to test them locally before merging and deploying them.
Consult our dependabot testing guide for step-by-step instructions on testing and deploying.
The following instructions provide a general guide to updating, adding or removing Python and Node dependencies in this repo.
# bring down latest
git pull origin master
# create a feature branch for your changes
git checkout -b <new-branch-name>If you're adding or updating a python dependency:
- Run a shell inside a container
make base-shell
- Add or update python dependency
# from inside the container shell from step 1: # add or upgrade a new production python dependency poetry add <package> # add/upgrade a new development dependency poetry add --dev <package> # pin the dependency to a specific version like this poetry add <package>@1.0.0
- Return to your local machine's shell
exit - Proceed to build and test locally.
Though recommended to use the poetry CLI, another way to accomplish the same is to edit
pyproject.tomlmanually, then runpoetry lockin the shell inside the container.
See the poetry docs for more commands and details on usage.
If you're adding or updating a node dependency:
- Run a shell inside a container
make dev-shell
- Add or update node dependency
# from inside the container shell from step 1: # enter the node directory cd node # add a new package npm install --save <package-name> # use --save-dev if dev dependency # add a specific version of a package npm install --save <package>@1.0.0 # get help on npm for further usage npm help
- Return to your local machine's shell
exit - Proceed to build and test locally.
-
Build new images locally based on your python or node dependency updates
# from your local machine's shell - not the container! make imagesThis creates two local images:
texastribune/base:<git-branch-name>-devtexastribune/base:<git-branch-name>-base
You can check that they were successfully created by runnning:
docker images | $(git branch --show-current) # example output: texastribune/base branchname-dev 2707ec0fcf6b 22 minutes ago 2.24GB texastribune/base branchname-base 8a387eac996c 59 minutes ago 1.37GB
-
Test it locally
- Switch to your local
texastribunerepo:- Update the
BASE_PRODUCTION_VERSIONandBASE_DEVELOPMENT_VERSIONvariables - See
texastribunedocs for they should be updated, or use your text editor search.
- Update the
- Create a
texastribunePR.
- Switch to your local
-
If all looks good, proceed to deploy steps.
If this is a small change that's very unlikely to affect anyone else, you'll build your new images directly through master, otherwise build your images through your feature branch.
- Commit your changes to your
tt-basebranch. - Merge this branch into
masterand proceed to steps to deploy texastribune. - Run the
make bumpcommand and follow the prompts in order to bump the version and tag it. The final prompt will push the tag to remote. There should be as little gap as possible between this step and the previous one so as to avoid conflicts with other committers. - Proceed to deploy to texastribune steps.
- Commit your changes to your
tt-basebranch. - Push your branch.
- Docker Hub will build the images with the same name as when you built them locally.
- Now anyone can pull down and use the images
texastribune/base:<git-branch-name> - Update your associated
texastribunePR to use these ^ images built from thett-basefeature branch. Anyone can pull that PR's branch down to test locally. - You can check the status of the builds on Docker Hub. You'll see a more accurate build log when logged-in under an account that is affiliated with the texastribune org in Docker Hub.
- After the related
texastribunePR is approved, merge yourtt-basefeature branch into master, and delete the feature branch. git checkout masterandgit pullto get your local master branch even with remote.- Run the
make bumpcommand and follow the prompts in order to bump the version and tag it. The final prompt will push the tag to remote. There should be as little gap as possible between this step and the previous one so as to avoid conflicts with other committers. - Proceed to deploy to texastribune steps.
- Change your related
texastribunePR to use the tag instead of the branch name (example:texastribune/base:1.2.14-baseandtexastribune/base:1.2.14-dev). See thetexastribuneREADME for the locations to change the version. You may want to wait until the Docker Hub build is complete before pushing yourtexastribunePR image version because the CI tests will fail if the image isn't available yet. - Make sure Docker Hub has built the image with the tag before deploying the
texastribunePR. In an emergency you can leave in the branch name -- the image should already be built by Docker Hub and it won't go away even when the branch is deleted. - Merge related
texastribunePR. - Deploy it
- Your work is done.