git تالف عند إعادة بناء تطبيق المشغل

After upgrading docker_manager through the UI (which seemed to go fine), the Admin dashboard just rendered an empty page, even if the rest of the forum seemed to work.

To resolve this, I resorted to run:

./launcher rebuild app

However, during that process, it ran into errors:

I, [2025-07-14T08:54:06.062789 #1]  INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse bash -c '
  set -o errexit
  if [ $(git rev-parse --is-shallow-repository) == "true" ]; then
      git remote set-branches --add origin main
      git remote set-branches origin tests-passed
      git fetch --depth 1 origin tests-passed
  else
      git fetch --tags --prune-tags --prune --force origin
  fi
'
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index

… and the error: packfile just continues to be spammed until interrupted.

From the looks of it, the git repository has become corrupted. But what git repository?
I don’t even have a /var/www/discourse folder, so I assume this is inside a container volume?

I am a bit stumped. Thanks for helping!

What do you mean by that?

Normally you’d update docker_manager via the UI.

Aah! My mistake. I meant UI, not API. I’ll edit it right way.

إعجاب واحد (1)

I tried to have resolved it by starting and entering the app container:

./launcher start app
./launcher enter app

Then I verified that the error occurred when calling the git command as the user discourse:

cd /var/www/discourse
sudo -H -E -u discourse bash -c 'git fetch --tags --prune-tags --prune --force origin'

Resulting in:

error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index
etc..

I tried to resolve it by renaming discourse and clone a new one:

cd /var/www
mv discourse discourse-old
git clone https://github.com/discourse/discourse.git
chown -R discourse:discourse discourse

Once cloned, tried to run the git fetch again with no errors!

cd /var/www/discourse
sudo -H -E -u discourse bash -c 'git fetch --tags --prune-tags --prune --force origin'

But as I exited the container shell and tried to rebuild again with ./launcher rebuild app, I got the same error.

Does the ./launcher rebuild app use a different container than ./launcher enter app enters?

إعجاب واحد (1)

yes, there are two levels of git, one outside (not including all the cloned plugins!)

your error does indeed appear to occur inside the container … most strange!

Finally got it to work!
I think it was a mixture between a corrupted git and the result of a previous docker upgrade. I resolved it by pruning all docker containers and images:

cd /opt/discourse
./launcher stop app
docker container prune
docker image prune -a
./launcher rebuild app

This resulted/ended with:

Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade.
Once you start the new server, consider running:
    /usr/lib/postgresql/15/bin/vacuumdb --all --analyze-in-stages

Running this script will delete the old cluster's data files:
    ./delete_old_cluster.sh
-------------------------------------------------------------------------------------
UPGRADE OF POSTGRES COMPLETE

Old 13 database is stored at /shared/postgres_data_old

To complete the upgrade, rebuild again using:

./launcher rebuild app
-------------------------------------------------------------------------------------

By running the rebuild again, it started working fully:

./launcher rebuild app
إعجاب واحد (1)