Stay Updated

Update Angular and other WebUI dependencies

Use ng update to update application and its dependencies. Following order is recommended ("don’t update to much at the same time"). According to the release frequency we can expect A major release every 6 months, 1-3 minor releases for each major release, and a patch and pre-release (next or rc) build almost every week!

# update yarn package manager, e.g. via brew
$ brew upgrade yarn
==> Upgrading yarn 1.22.5 -> 1.22.10
# check if everything is OK *before* you update dependencies
cd ui/
$ yarn test
# Avoid "The installed local Angular CLI version is older than the latest stable version."
$ ng update @angular/cli

# check which anguluar components *can* be updated (safe operation)
We analyzed your package.json, there are some packages to update:

  Name                               Version                  Command to update
 --------------------------------------------------------------------------------
  @angular/cdk                       10.1.3 -> 10.2.1         ng update @angular/cdk
  @angular/cli                       10.0.6 -> 10.1.1         ng update @angular/cli
  @angular/core                      10.0.9 -> 10.1.1         ng update @angular/core
  @angular/material                  10.1.3 -> 10.2.1         ng update @angular/material
  rxjs                               6.6.2 -> 6.6.3           ng update rxjs

# update at leat CLI + Core, optionally also cdk, material and rxjs (requires clean repo)
$ git status
$ ng update @angular/cli @angular/core @angular/cdk @angular/material rxjs

# run tests again to chec if everything is still working
$ yarn test:headless
TOTAL: 15 SUCCESS

# Use `--all` to update all packages in package.js, optionally with --allow-dirty
$ ng update --all --allow-dirty

# Stay within major version: use the following command to take the latest 10.x.x vers
ng update @angular/cli@^10 @angular/cdk@^10  @angular/core@^10  @angular/material@^10

Use yarn outdated for "none-angular" package.json dependencies:

$ yarn outdated
yarn outdated v1.22.10

info Color legend :
"<red>"    : Major Update backward-incompatible updates
"<yellow>" : Minor Update backward-compatible features
"<green>"  : Patch Update backward-compatible bug fixes

Package                           Current  Wanted   Latest   Package Type    URL
@angular-devkit/build-angular     0.1002.0 0.1002.0 0.1100.3 devDependencies https://github.com/angular/angular-cli
@angular/animations               10.2.3   10.2.3   11.0.3   dependencies    https://github.com/angular/angular#readme
ngx-markdown                      11.1.1   11.1.2   11.1.2   dependencies    https://github.com/jfcere/ngx-markdown
tslib                             2.1.0    2.2.0    2.2.0    dependencies    https://www.typescriptlang.org/
typescript                        4.1.5    4.1.5    4.2.4    devDependencies https://www.typescriptlang.org/
(...)

Update Kotlin and other Backend Dependencies

Java Libraries

Use the very efficient gradle-versions-plugin, add id("com.github.ben-manes.versions") version "0.33.0" to the plugins block of `build.gradle.kts `

$ ./gradlew dependencyUpdates

The following dependencies are using the latest milestone version:
 - com.rometools:rome:1.15.0
(...)

The following dependencies have later milestone versions:
 - org.springframework.boot:spring-boot-starter-test [2.3.2.RELEASE -> 2.3.3.RELEASE]
 (...)

Gradle release-candidate updates:
 - Gradle: [6.5 -> 6.8.3 -> 7.0-rc-2]

Generated report file build/dependencyUpdates/report.txt

Upgrade Gradle

Use sdkman to manage gradle versions, make sure Gradle an JVM Versions match according to the Compatibility Matrix
sdk list gradle

$ ll /Users/<user>>/.sdkman/candidates/gradle
total 16
drwxr-xr-x  8 tillkuhn  staff   256  1 Feb  1980 6.5/
drwxr-xr-x  8 tillkuhn  staff   256  1 Feb  1980 6.7.1/
lrwxr-xr-x  1 tillkuhn  staff     5 24 Apr 09:25 current@ -> 6.7.1
update wrapper props, see also Upgrading the Gradle Wrapper
$ grep Url gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
$ ./gradlew wrapper --gradle-version 8.5
Make sure Java version in github setup workflow action is available and matches your local dev setup:
$ more ../.github/workflows/kotlin.yml
   - name: Set up Eclipse Temurin JDK
     uses: actions/setup-java@v3
     with:
       distribution: 'temurin'
       java-version: 21

Make sure Intellij config matches the Java and Gradle versions / paths used on the commandline

  • IntelliJ → Preferences → Build Tools → Gradle → Specified Location → Use the 8.x.x Path (not the softlink)

  • IntelliJ → Project Structure → Project SDK: Make sure Gradle JVM is the same as on OS Level

API Dockerfile

Check JRE / JDK version in api/Dockerfile and compare with recent versions on dockerhub (or check for later major versions since it’s already 2024)

ARG FROM_TAG=21-jre
FROM eclipse-temurin:$FROM_TAG

Upgrade Go Tools

The -u flag instructs get to update modules providing dependencies of packages named on the command line to use newer minor or patch releases when available. (…​) go get will install the package in the first directory listed at GOPATH

show outdated
go list -u -f '{{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}' -m all 2> /dev/null
github.com/tillkuhn/angkor/tools/topkapi: v0.0.0-20210521165321-b2f4d7d69add -> v0.0.0-20210521185530-5fcee18c5a1f
update all modules
~/tools/imagine$ go get -u all
go: downloading github.com/aws/aws-sdk-go v1.38.16
go: downloading golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb

$ git status
	modified:   go.mod
	modified:   go.sum

$ brew info go
go: stable 1.16 (bottled), HEAD

Update Infrastructure

Terraform

Upgrade Terraform itself:

  • Check hashicorp/terraform releases for new versions download or update update with your preferred package management tool. When using tfswitch, you can use tfswitch -l to list available versions, and install them as required.

  • It’s also recommended to configure terraform versions constrains with required_version inside versions.tf

  • CI/CD: Update the terraform_version and cache-keys in .github/workflows/infra.yml to control which TF version / image is used during continuous integration

  • Locally: If you use tfswitch or tfenv to manage multiple TF versions on your workstartion, you may want to update version inside versions.tf

  • Run make plan with the updated CLI Version, see what would happen, make decisions, commit and make sure CI/CD runs through in both plan and apply mode!

Upgrade Terraform Providers:

  • Read the Lock and Upgrade Provider Versions to learn about provider versions (7Min)

  • You can also check registry.terraform.io/search/providers for recent updates in providers you may be interested in, e.g. aws, local, http

  • Check your versions.tf file and pay special attentions to Version Constraints. Each provider versions is locked in the local file .terraform.lock.hcl which is created by terraform during the initial init task, but the constraints control the range range within provider versions will be upgraded if you run terraform init in -upgrade mode (see last step)

    • use ~> aka "the pessimistic constraint operator" to Allow only the rightmost version component to increment.

    • use one or multiple >, >=, <, ⇐ operators to specify min, max or range of versions (usually for more optimistic scenarios)

      terraform {
        required_providers {
          aws = {
            source = "hashicorp/aws"
            version = ">= 3.22.0, < 4.0.0"
          } (...)
      }
  • Run terraform init -upgrade which will check for provider updates within the given constrains as per versions.tf. If updates are possible, it will update locked versions and hashes, and you should commit those updates to version control!

    $ terraform init -upgrade
    Initializing provider plugins...
    - Finding hashicorp/aws versions matching ">= 3.22.0, < 4.0.0"...
    - Finding hashicorp/local versions matching ">= 2.0.0, < 3.0.0"...
    (...)
    
    $ git commit -a -m "Update locked versions in .terraform.lock.hcl"

On EC2 Instance (automized or to be automized):

  • Check for new AMI (does not automatically replace exisitng instance during tf apply)

  • Force destroy and recreation of the instance (always a good idea)

Running System

System logs

How To Clear The systemd journal Logs: Check /etc/systemd/journald.conf

$ journalctl --disk-usage
Archived and active journals take up 64.0M on disk
# does not work?
$ sudo journalctl -m --vacuum-time=1m
$ journalctl -m --vacuum-size=20M

Docker

$ cat /etc/cron.daily/docker-prune
docker system prune -f >>/home/ec2-user/logs/docker-prune.log 2>&1