Skip to content
Stephan Kulla edited this page May 22, 2024 · 16 revisions

How to update dependencies?

Variant 1: Do it manually

yarn dependencies

Use yarn upgrade-interactively and update the dependency or a list of dependencies. Run all checks (e.g. via yarn check:all) and fix errors which occur. In case of updates in the major version have a look at the changelog of the dependency where breaking changes are defined. Don't forget to run yarn dedupe after your updates (deduplicates dependencies with overlapping ranges, see https://yarnpkg.com/cli/dedupe).

It is recommended to make smaller commits / PRs with only some updates instead of always updating everything. Merge the PRs into main when some updates succeed and do not break the CI.

cargo dependencies

To edit your versions in Cargo.toml, you can use

$ cargo upgrade

if you want also for a specific dependency only.

If you only want to update your lock file without editing your Cargo.toml for newer versions, do

$ cargo update

Variant 2: Set up and use dependa-bot

See https://docs.github.com/en/code-security/dependabot/working-with-dependabot, set it up in the repository and merge the PRs. In case the CI breaks, fix the error in the particular pull request.

How to update the version of Node.JS / Rust / Python

We manage asdf for our tool chain. Here you can also update the used programming language. Example with Node.JS:

# List all versions of Node.JS
asdf list all nodejs

# Install version X
asdf install nodejs X

In case the repository has a .tool-versions file make sure that you change it accordingly (e.g. via asdf local nodejs X). After installing the new version make sure that you make the appropriate changes in the repository:

How to update yarn?

See https://yarnpkg.com/cli/set/version

How release a new version of api.serlo.org

The first part consists of bumping the version of api.serlo.org. The bumping of a new version of serlo/api.serlo.org and its packages:

is done via the scripts/update_version.sh script.

To create the new version and release it:

  1. Checkout the serlo/api.serlo.org repository and create a new branch that will be used for the changes that will be generated to create the new tag version.
  2. Make sure that the core.editor git config is set in the host where you are running the script.
  3. Run yarn update-version.
  4. You will see that the scripts/changelog.ts file will open in the editor you setup in step 2.
  5. In the release property of the scripts/changelog.ts file, add a new object with the tagName, date and the changes that are included in the new release (here you can see the shape of the release Section).
  6. Save the changes in the scripts/changelog.ts file.
  7. Then, you will see the following message: "Generating CHANGELOG" in the console output and that the package.json files and the yarn.lock file will be updated by the scripts/update_version.sh script.
  8. Then git commit will be executed for the changes that were updated in the step 7 to be committed. In this step you may stage the changes, and write a message such as: "Release version MAJOR.MINOR.PATCH"
  9. Push the changes to the remote branch that was created in step 1. and open a PR.
  10. Verify that all the GitHub Actions checks pass, ask for a review of your changes, and then, merge the PR with the new version changes.
    • On the merge to the main branch, the Deploy workflow will run, and it will build the new api-server and api-swr-queue-worker images and tag them with the version that was created in the previous steps. The images will also be pushed to the Google Cloud Container Registry.

How release a new version of database-layer

The first part consists of bumping the version of the server in the database-layer repository. This is done via the scripts/update_server_version.sh script.

To create the new version and release it:

  1. Clone the database-layer repository and create a new branch that will be used for the changes that will be generated to create the new tag version.
  2. Make sure that the core.editor git config is set in the host where you are running the script.
  3. Run the script ./scripts/update_server_version.sh.
  4. You will see that the scripts/changelog.ts file will open in the editor you setup in step 2.
  5. In the release property of the scripts/changelog.ts file, add the new object with a tagName, date and the changes that are included in the new release (here you can find the shape of the release Section).
  6. Save the changes in the scripts/changelog.ts file.
  7. Then, you will see the following message: "Generating CHANGELOG" in the console output and that the package.json files and the yarn.lock file will be updated by the scripts/update_server_version.sh script.
  8. Then git commit will be executed for the changes that were updated in the step 7 to be committed. In this step you may stage the changes, and write a message such as: "Release version MAJOR.MINOR.PATCH"
  9. Push the changes to the remote branch that was created in step 1. and open a PR.
  10. Verify that all the GitHub Actions checks pass, ask for a review of your changes, and then, merge the PR with the new version changes.
    • On the merge to the main branch, the Deploy workflow will run, and it will build the new serlo-org-database-layer image and tag it with the version that was created in the previous steps. The image will also be pushed to the Google Cloud Container Registry.

How to manually run db-setup in staging

Go to https://console.cloud.google.com/ and make sure, that you have selected serlo-staging as a project:

2024-05-22-085710_174x56_scrot

Go to "menu > Kubernetes Engine > Workloads" and select dbsetup. The site should look like this:

2024-05-22-085856_1032x478_scrot

Select "Run now". Wait until in "managed Pods" at the bottom of the page the status becomes "Succeeded". Note that this means, that the DB migration is still running:

2024-05-22-090252_791x111_scrot

How to rerun db-migrations manually

Prerequisites: If necessary: Run db-setup again (see above) – this step is necessary when you have made changes to the DB migration (for example by fixing a bug) and you want to run it again.

Go to https://console.cloud.google.com/ and make sure, that you have selected serlo-staging as a project:

2024-05-22-085710_174x56_scrot

Go to "menu > Kubernetes Engine > Workloads" and select db-migration-cronjob. Click "Run now" (after db-setup succeeded).

Clone this wiki locally