Home

Awesome

Project has been moved

Please find the new home for Velocita at GMTA Velocita-Proxy.

To upgrade to the new image, simply replace the image isaaceindhoven/velocita-proxy by gmta/velocita-proxy. All tags are still available in the new repository.

Velocita

Docker Image Version (latest semver) Docker Pulls License

Velocita is a caching reverse proxy for Composer repositories and package distribution locations, such as Packagist or GitHub.

Installation

There are two parts to Velocita:

Running Velocita Proxy

Velocita is available as a Docker image. There are two supported ways to run this image:

Using docker compose

  1. Clone this repository:

    git clone https://github.com/isaaceindhoven/velocita-proxy
    cd velocita-proxy
    
  2. Copy .env.dist to .env

  3. Edit .env and set:

    • VELOCITA_URL: the URL (e.g. https://mydomain.tld) on which Velocita is hosted
    • VELOCITA_TLS_ENABLED: set to true to enable HTTPS
    • VELOCITA_TLS_CERT_FILE: the path to your X.509 PEM-encoded certificate (or chain) for the domain
    • VELOCITA_TLS_KEY_FILE: the path to the private key associated with the certificate
  4. Start Velocita:

    docker compose -f docker-compose.yml -f docker-compose.https.yml up -d
    
  5. Done!

Using docker

Alternatively, you can run the Docker image directly: see the image's usage instructions.

Using Composer-velocita

Composer-velocita is a Composer plugin that redirects downloads to your Velocita instance for all repositories it supports.

Run the following commands on the machine where you want to enable Velocita, replacing https://url.to.your.velocita.tld/ with the URL of your instance:

composer global config allow-plugins.isaac/composer-velocita true
composer global require isaac/composer-velocita
composer velocita:enable https://url.to.your.velocita.tld/

And you're all set!

Configuration

See the Docker image instructions for environment variables that you can use to configure the proxy's behavior.

Performance

Velocita can give you major performance improvements when a package is not present in the local cache. For example, installing the PHPUnit dependencies from composer.lock:

ConfigurationDurationRelative
Composer2.2s ± 0.1s100%
Composer + Velocita0.5s ± 0.1s23%

Command: composer install --profile after composer require phpunit/phpunit:9.5.19 and clearing both the local cache and the vendor folder.

Velocita works great together with Symfony Flex:

ConfigurationDurationRelative
Composer + Symfony Flex4.7s ± 0.7s100%
Composer + Symfony Flex + Velocita1.6s ± 0.2s35%

Command: composer create-project symfony/skeleton:v6.0.99 symfony --profile after clearing the local cache.

Benchmark setup:

Authors

Contributing

Raise an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License - see the LICENSE file for details.