Skip to content
This repository was archived by the owner on Mar 19, 2025. It is now read-only.

πŸ‹πŸ“¦βœ‚οΈπŸ“‹πŸ“¦ Docker image of packagist mirror

License

Notifications You must be signed in to change notification settings

webysther/packagist-mirror-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

60 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DEPRECATED

The project has been frozen since the announcement of composer 2, which solved several problems, but still did not cover all users, especially in China. A few weeks ago, it adopted a global CDN model and will shutdown all legacy version 1, which makes this mirror unnecessary. This includes Brazil, China and other countries where performance was still not good enough. This is a good move and I recommend that all existing mirrors start shutting down their domains. I will open a PR to remove the Packagist mirror page. Thank you to the community and everyone who helped the project.

Build Status Docker pulls Minimum PHP Version FOSSA Status Software License Mentioned in Awesome composer

Docker for Packagist Mirror

This project allows you to easily create and update a mirror of the packagist having as dependency only the docker. It is possible to completely customize the mirror only by using environment variable and thereby create an institutional mirror or for a particular country without any problem.

We use webysther/composer-debian as alternative to official composer on docker hub because the alpine version has issues with I/O.

Usage

Schedule in case of restart or another problem, the first execution create a mirror:

* * * * * root docker run --name mirror --rm -v /var/www/html:/public -e MAINTAINER_REPO='mymirror.com' webysther/packagist-mirror

Synchronized continuously:

*    *  * * * root docker run --name mirror --rm --device-read-bps /dev/xvda:600kb --device-write-bps /dev/xvda:600kb -e SLEEP=0 -v /var/www/html:/public webysther/packagist-mirror

Sample used inside packagist.com.br (update docker composer every day):

# Every minute
*    *  * * * root docker run --name mirror --rm --device-read-bps /dev/xvda:600kb --device-write-bps /dev/xvda:600kb -e SLEEP=0 -v /var/www/html:/public webysther/packagist-mirror

# Every 1:00 AM
0    1  * * * root docker pull webysther/packagist-mirror 

# Every 2:30 AM
30   2  * * * root service docker restart

You can add more mirrors with additional URL's separated by comma:

-e DATA_MIRROR='https://packagist.jp,https://packagist.com.br'

Main mirror is used to get providers and fallback in case of error on data mirror, you can also change them:

-e MAIN_MIRROR='https://packagist.com.br'

You also can change parallel connections for every mirror:

-e MAX_CONNECTIONS=10

All enviroment options stay on .env file.

License

FOSSA Status

Releases

No releases published

Sponsor this project

Packages

No packages published