Mirroring script for packagist.org and composer repositories metadata in general
git clone https://github.com/composer/mirror mirror
cd mirror
composer install
cp mirror.config.php.dist mirror.config.php
mirror.config.php
to fit your needs, and mind the TODO entries which MUST be filled-in../mirror.php --v1
should be run permanently to sync Composer 1 metadata (if you do not need Composer 1 metadata, you don’t have to run this, but then you must set has_v1_mirror
to false
in the config)./mirror.php --v2
should be run permanently to sync Composer 2 metadata./mirror.php --gc
should be run once an hour or so with a cron job to clean up old v1 files (if you do not need Composer 1 metadata, you don’t need to run this)In case the v2 metadata gets very outdated because you did not update the mirror for a while, this will be detected
and a resync will happen automatically.
However, if you want to run a resync manually to see what is going on you can use:
./mirror.php --resync -v
This will make sure the v2 metadata is in sync again (wait for the script to complete which may take a while) and
then running ./mirror.php --v2
regularly again should get you back on regular updates.
If-Modified-Since
requests with 304 Not Modified
In your mirror dir:
git pull origin master
composer install
Then restart the workers