xetus-oss / docker-archiva

A docker image for Apache Archiva
Apache License 2.0
55 stars 33 forks source link

fix: convert archiva.xml default relative locations to absolute paths #15

Closed tmeneau closed 5 years ago

tmeneau commented 5 years ago

The default archiva.xml used in the v2-legacy image uses relative paths for the managedRepository/Location and managedReopsitory/indexDir paths. This merger request adds some logic to the entrypoint to:

  1. Check for relative paths;
  2. If found, remap the relative paths to their expected absolute path within the container;
  3. If old .indexer directories exist (e.g. /archiva-data/repositories/repositories/.../.indexer), to just remove the whole /archiva-data/repositories/repositories directory; and finally
  4. Log some helpful instructions for how to resolve this.

Additionally, this adds those instructions to the README to help users who run into #13.

tkent commented 5 years ago

@tmeneau - thanks for tackling this! To write down the updates from our talks...

  1. Move the upgrade code into a separate script, called from the entry point when needed.
  2. We'll work together to fixup my confusing "Image Version 1" and "Image Version 2" references in the change log. Instead, we'll just use tag references.
  3. Confirm that fixing up the XML, then removing the JCR, has the intended results (which is that the JCR gets rebuilt and without losing any artifact data and minimal settings loss.
  4. Since the upgrade process is a little bit descrutive, require that that the environment variable UPGRADE_PRE_V2 be set to true for the upgrade to run. If the upgrade is detected and UPGRADE_PRE_V2 is not set, then simply exit with a helpful message to stdout.
tmeneau commented 5 years ago

Thanks for the feedback @tkent! I made the changes you recommended.

I did some digging on the JCR, and it looks like Archiva uses it exclusively for storing artifact metadata. Local tests confirm that removing the JCR is adequate to force a full rescan of the repositories in addition to being easily automated. Thanks for the recommendation, that was the key to fully automating the upgrade process!

The intention is to patch (re: replace) the existing v2 image with this pull request. For users whom aren't affected by #13 should be unaffected by this; all other users will be unable to start their Archiva containers with a message directing them to the README documentation describing the upgrade and how to proceed.