### Fully Stateless Mirror Storage Example
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/storage.md
Example configuration for a fully stateless mirror storage setup where all data is read/written directly to S3.
```bash
STORAGE_SOURCE=s3
STORAGE_AWS_BUCKET=my-bucket
MIRROR_METADATA_CACHE_DIR=
MIRROR_DIST_CACHE_DIR=
```
--------------------------------
### Install Dependencies
Source: https://github.com/vtsykun/packeton/blob/master/CONTRIBUTING.md
Navigate to the project directory and install project dependencies using Composer.
```bash
cd packeton
composer install
```
--------------------------------
### Authentik Provider Specific Setup
Source: https://github.com/vtsykun/packeton/blob/master/docs/oauth2/oidc.md
Example configuration for setting up the Authentik OIDC provider. Ensure the redirect URI in Authentik matches the format provided in the documentation.
```yaml
authentik:
allow_login: true
allow_register: true
login_title: 'Login with Authentik'
oidc:
client_id: 'your-client-id'
client_secret: 'your-client-secret'
issuer: 'https://auth.example.com/application/o/packeton/'
```
--------------------------------
### Install Packeton from Source
Source: https://context7.com/vtsykun/packeton/llms.txt
Install Packeton by cloning the repository and using Composer. This includes setting up environment variables, updating the database schema, creating an admin user, and clearing the cache.
```bash
git clone https://github.com/vtsykun/packeton.git
cd packeton
composer install
cp .env .env.local # edit DATABASE_URL, REDIS_URL, APP_SECRET, etc.
# Create database schema
bin/console doctrine:schema:update --force --complete
# Create admin user
php bin/console packagist:user:manager admin --email=admin@example.com --password=secret123 --admin
# Clear cache after config changes
php bin/console cache:clear
# Enable cron (add to crontab for www-data)
* * * * * /var/www/packagist/bin/console okvpn:cron >> /dev/null
# OR run as a daemon
bin/console okvpn:cron --demand
# Start the background worker (via supervisor)
bin/console packagist:run-workers --env=prod --no-debug
```
--------------------------------
### Environment Variables (After)
Source: https://github.com/vtsykun/packeton/blob/master/UPGRADE.md
Example of the new DATABASE_URL format for database configuration after the upgrade.
```yaml
environment:
DATABASE_URL: mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4
```
--------------------------------
### Packeton Full Configuration Example
Source: https://github.com/vtsykun/packeton/blob/master/README.md
A comprehensive example of Packeton's configuration options, including GitHub API usage, RSS feed limits, archiving, authentication, and artifact storage.
```yaml
packeton:
github_no_api: '%env(bool:GITHUB_NO_API)%' # default true
rss_max_items: 30
archive: true
# default false
anonymous_access: '%env(bool:PUBLIC_ACCESS)'
anonymous_archive_access: '%env(bool:PUBLIC_ACCESS)' # default false
archive_options:
format: zip
basedir: '%env(resolve:PACKAGIST_DIST_PATH)'
endpoint: '%env(PACKAGIST_DIST_HOST)' # default auto detect by host headers
include_archive_checksum: false
prebuild_zipball: false # If true - will be created .zip package for each release (and uploaded to S3/storage). Default - build dynamically, only if requested
# disable by default
jwt_authentication:
algo: EdDSA
private_key: '%kernel.project_dir%/var/jwt/eddsa-key.pem'
public_key: '%kernel.project_dir%/var/jwt/eddsa-public.pem'
passphrase: ~
# See mirrors section
mirrors: ~
metadata:
format: auto # Default, see about metadata.
info_cmd_message: ~ # Bash logo, example - [37;44m#StandWith[30;43mUkraine[0m
artifacts:
# Allow uploading archives
support_types: ['gz', 'tar', 'tgz', 'zip']
#Allowed paths for artifact composer repo type
allowed_paths:
- '/data/hdd1/composer'
# Default path to storage/(local cache for S3) of uploaded artifacts
artifact_storage: '%composer_home_dir%/artifact_storage'
web_protection:
## Multi host protection, disable web-ui if host !== app.example.com and ips != 127.0.0.1, 10.9.1.0/24
## But the repo metadata will be available for all hosts and ips.
repo_hosts: ['*', '!app.example.com']
allow_ips: '127.0.0.1, 10.9.1.0/24'
```
--------------------------------
### Packeton .env.local Configuration Example
Source: https://github.com/vtsykun/packeton/blob/master/docs/installation.md
Example of the `.env.local` file for Packeton configuration. This shows how to set database connection URLs for PostgreSQL and MySQL, among other settings.
```dotenv
# .env.local
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=14&charset=utf8"
```
--------------------------------
### Production Docker Compose Configuration
Source: https://github.com/vtsykun/packeton/blob/master/docs/installation-docker.md
This `docker-compose-prod.yml` example demonstrates a multi-container setup for production, separating services like Redis, PostgreSQL, PHP-FPM, Nginx, worker, and cron.
```yaml
version: '3.9'
x-volumes: &default-volume
volumes:
- app-data:/data
- app-var:/var/www/packagist/var
x-restart-policy: &restart_policy
restart: unless-stopped
x-environment: &default-environment
REDIS_URL: redis://redis
DATABASE_URL: "postgresql://packeton:pack123@postgres:5432/packeton?serverVersion=14&charset=utf8"
SKIP_INIT: 1
services:
redis:
image: redis:7-alpine
hostname: redis
<<: *restart_policy
volumes:
- redis-data:/data
postgres:
image: postgres:14-alpine
hostname: postgres
<<: *restart_policy
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: packeton
POSTGRES_PASSWORD: pack123
POSTGRES_DB: packeton
php-fpm:
image: packeton/packeton:latest
hostname: php-fpm
command: ['php-fpm', '-F']
<<: *restart_policy
<<: *default-volume
environment:
<<: *default-environment
SKIP_INIT: 0
WAIT_FOR_HOST: 'postgres:5432'
depends_on:
- "postgres"
- "redis"
nginx:
image: packeton/packeton:latest
hostname: nginx
ports:
- '127.0.0.1:8088:80'
<<: *restart_policy
<<: *default-volume
command: >
bash -c 'sed s/_PHP_FPM_HOST_/php-fpm:9000/g < docker/nginx/nginx-tpl.conf > /etc/nginx/nginx.conf && nginx'
environment:
<<: *default-environment
WAIT_FOR_HOST: 'php-fpm:9000'
depends_on:
- "php-fpm"
worker:
image: packeton/packeton:latest
hostname: packeton-worker
command: ['bin/console', 'packagist:run-workers', '-v']
user: www-data
<<: *restart_policy
<<: *default-volume
environment:
<<: *default-environment
WAIT_FOR_HOST: 'php-fpm:9000'
depends_on:
- "php-fpm"
cron:
image: packeton/packeton:latest
hostname: packeton-cron
command: ['bin/console', 'okvpn:cron', '--demand', '--time-limit=3600']
user: www-data
<<: *restart_policy
<<: *default-volume
environment:
<<: *default-environment
WAIT_FOR_HOST: 'php-fpm:9000'
depends_on:
- "php-fpm"
volumes:
redis-data:
postgres-data:
app-data:
app-var:
```
--------------------------------
### Full Packeton Configuration Example
Source: https://github.com/vtsykun/packeton/blob/master/docs/dev/configuration.md
This is a comprehensive example of a Packeton configuration file, illustrating various settings and their potential values. It includes options for GitHub API usage, RSS feeds, archiving, anonymous access, JWT authentication, metadata formatting, artifact storage, and integrations with services like GitHub, GitLab, Gitea, and Bitbucket.
```yaml
packeton:
github_no_api: '%env(bool:GITHUB_NO_API)%'
rss_max_items: 30
archive: true
anonymous_access: '%env(bool:PUBLIC_ACCESS)%'
anonymous_archive_access: '%env(bool:PUBLIC_ACCESS)%'
archive_options:
format: zip
basedir: '%env(resolve:PACKAGIST_DIST_PATH)%'
endpoint: '%env(PACKAGIST_DIST_HOST)%'
include_archive_checksum: false
jwt_authentication:
algo: EdDSA
private_key: '%kernel.project_dir%/var/jwt/eddsa-key.pem'
public_key: '%kernel.project_dir%/var/jwt/eddsa-public.pem'
passphrase: ~
metadata:
format: auto
info_cmd_message: ~
artifacts:
support_types: ['gz', 'tar', 'tgz', 'zip']
allowed_paths:
- '/data/hdd1/composer'
artifact_storage: '%composer_home_dir%/artifact_storage'
integrations:
alias_name:
allow_login: true
allow_register: false
default_roles: ['ROLE_USER', 'ROLE_MAINTAINER', 'ROLE_GITLAB']
clone_preference: 'api'
repos_synchronization: true
disable_hook_repos: false
disable_hook_org: false
svg_logo: ~
logo: ~
login_title: Login or Register with GitHub
description: ~
login_control_expression: "data['email'] ends with '@packeton.org'"
login_control_expression_debug: false
pull_request_review: true
webhook_url: ~
github:
client_id: 'xxx'
client_secret: 'xxx'
gitlab:
client_id: 'xxx'
client_secret: 'xxx'
api_version: 'v4'
githubapp:
private_key: '%kernel.project_dir%/var/packeton-private-key.pem'
passphrase: ~
app_id: 345472
gitea:
client_id: '44000000-0000-0000-0000-00000000000'
client_secret: 'gto_acxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
bitbucket:
key: GA7000000000000000
secret: 9chxxxxxzxxxxxxxxeexxxxxxxxxxxxx
api_version: ~
mirrors:
packagist:
url: https://repo.packagist.org
orocrm:
url: https://satis.oroinc.com/
git_ssh_keys:
git@github.com:oroinc: '/var/www/.ssh/private_key1'
git@github.com:org2: '/var/www/.ssh/private_key2'
example:
url: https://satis.example.com/
logo: 'https://example.com/logo.png'
http_basic:
username: 123
password: 123
public_access: true
sync_lazy: true
enable_dist_mirror: false
available_package_patterns:
- 'vend1/*'
available_packages:
- 'pack1/name1'
composer_auth: '{"auth.json..."}'
sync_interval: 3600
info_cmd_message: "\n\u001b[37;44m#Слава\u001b[30;43mУкраїні!\u001b[0m\n\u001b[40;31m#Смерть\u001b[30;41mворогам\u001b[0m"
web_protection:
repo_hosts: ['*', '!app.example.com']
allow_ips: '127.0.0.1, 10.9.1.0/24'
status_code: 402
custom_page: >
402 Payment Required
402 Payment Required
nginx
web_protection:
repo_hosts: ['repo.example.com']
```
--------------------------------
### Example Webhook URL for Manual Configuration
Source: https://github.com/vtsykun/packeton/blob/master/docs/pull-request-review.md
An example of a webhook URL for manually enabling pull request review for a single repository. This is used when integration synchronization is not employed.
```text
https://example.com/api/hooks/gitlab/6?token=whk_810d6b279b3f78b758e09fe01f12378d2bd809c4
```
--------------------------------
### Environment Variables (Before)
Source: https://github.com/vtsykun/packeton/blob/master/UPGRADE.md
Example of environment variables used for database configuration before the upgrade.
```yaml
environment:
DATABASE_HOST: postgres
DATABASE_PORT: 5432
DATABASE_DRIVER: pdo_pgsql
DATABASE_USER: postgres
DATABASE_NAME: packagist
DATABASE_PASSWORD: 123456
```
--------------------------------
### Run Docker Compose Containers
Source: https://github.com/vtsykun/packeton/blob/master/docs/installation-docker.md
Commands to start Packeton containers using Docker Compose. Use `docker-compose up -d` for a single supervisor container or `docker-compose up -f docker-compose-prod.yml -d` for the multi-container production setup.
```bash
docker-compose up -d
```
```bash
docker-compose up -f docker-compose-prod.yml -d
```
--------------------------------
### Manual GET Request for Package Update
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/update-packages.md
This is an example of a manual GET request to the generic update endpoint. It uses the `composer_package_name` query parameter. Replace `` with your application's URL and `` with your Packagist username and API token.
```bash
curl 'https:///api/update-package?token=&composer_package_name=vender/name'
```
--------------------------------
### Multiple Storage Source Configuration
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/storage.md
Example of setting multiple storage sources, such as S3 v2 and Google Cloud, using environment variables.
```bash
STORAGE_SOURCE=s3_v2
STORAGE_SOURCE=gcloud
```
--------------------------------
### Run Local Web Server
Source: https://github.com/vtsykun/packeton/blob/master/CONTRIBUTING.md
Start a local development web server using PHP's built-in server. The public directory is the document root.
```bash
php -S localhost:8000 -t public/
```
--------------------------------
### Run Packeton Services with Docker Compose
Source: https://github.com/vtsykun/packeton/blob/master/README.md
Starts the Packeton services. Use '-d' to run in detached mode. The default setup runs with a single supervisor container. Alternatively, use '-f docker-compose-split.yml' to run services in separate containers.
```bash
docker-compose up -d # Run with single supervisor container
docker-compose up -f docker-compose-split.yml -d # Or split
```
--------------------------------
### Install Supervisor for Workers
Source: https://github.com/vtsykun/packeton/blob/master/docs/installation.md
Install the Supervisor process control system, which is used to manage Packeton's background worker processes.
```bash
sudo apt -y --no-install-recommends install supervisor
```
--------------------------------
### Setup Database Schema
Source: https://github.com/vtsykun/packeton/blob/master/CONTRIBUTING.md
Update the database schema using the Doctrine command-line tool. Use --dump-sql to see changes and --force to apply them.
```bash
bin/console doctrine:schema:update --dump-sql --force
```
--------------------------------
### Nginx Server Configuration
Source: https://github.com/vtsykun/packeton/blob/master/docs/installation.md
Example Nginx configuration for Packeton. This setup includes SSL/TLS settings, root directory, rewrite rules, and FastCGI parameters for PHP-FPM.
```nginx
server {
listen *:443 ssl http2;
server_name packeton.example.org;
root /var/www/packeton/public;
ssl_certificate /etc/nginx/ssl/example.crt;
ssl_certificate_key /etc/nginx/ssl/example.key;
ssl_ciphers 'TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-256-GCM-SHA384:ECDHE:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4';
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_session_timeout 5m;
rewrite ^/index\.php/?(.+)$ /$1 permanent;
try_files $uri @rewriteapp;
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
}
access_log off;
location ~ ^/index\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.*);
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
}
```
--------------------------------
### URL Placeholder Example
Source: https://github.com/vtsykun/packeton/blob/master/docs/webhook.md
Demonstrates how to use the `placeholder` tag to dynamically build URL parameters. Supports single values and arrays for multiple requests.
```twig
{% placeholder method with 'post' %}
{% placeholder repoName with [package.name, 'test/test'] %}
```
--------------------------------
### Import Packages from Packagist.com or Satis (Glob Filter)
Source: https://context7.com/vtsykun/packeton/llms.txt
Use the UI import tool to bulk-import packages. This example shows how to use a glob pattern to filter packages by vendor.
```text
okvpn/*
org1/*
vendor2/*
```
--------------------------------
### Get Full Package Info with Stats
Source: https://context7.com/vtsykun/packeton/llms.txt
Retrieve comprehensive information about a package, including download statistics and repository details. Requires authentication.
```bash
curl "https://pkg.example.com/packages/acme/private-lib.json?token=username:apiToken"
```
--------------------------------
### Mirror Storage with Ephemeral Local Cache
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/storage.md
Example configuration for mirror storage using ephemeral local cache directories for improved performance and reduced S3 API requests.
```bash
STORAGE_SOURCE=s3
STORAGE_AWS_BUCKET=my-bucket
MIRROR_METADATA_CACHE_DIR=/tmp/mirror-meta
MIRROR_DIST_CACHE_DIR=/tmp/mirror-dist
```
--------------------------------
### Manual Package List Import Example
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/migrate.md
Provide a manual list of packages when the Composer repository does not offer an API to fetch all available packages. This list can include package names, versions, and descriptions.
```text
sebastian/cli-parser 2.0.0 Library for parsing CLI options
sebastian/code-unit 2.0.0 Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 3.0.0 Looks up which function or method a line of code belongs to
sebastian/comparator 5.0.1 Provides the functionality to compare PHP values for equality
sebastian/complexity 3.0.1 Library for calculating the complexity of PHP code units
sebastian/diff 5.0.3 Diff implementation
sebastian/environment 6.0.1 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 5.0.0 Provides the functionality to export PHP variables for visualization
sebastian/global-state 6.0.1 Snapshotting of global state
sebastian/lines-of-code 2.0.1 Library for counting the lines of code in PHP source code
```
--------------------------------
### Clone Packeton Repository
Source: https://github.com/vtsykun/packeton/blob/master/docs/installation.md
Clone the Packeton repository to your desired directory and navigate into it. This is the first step in the installation process.
```bash
git clone https://github.com/vtsykun/packeton.git /var/www/packeton/
cd /var/www/packeton/
```
--------------------------------
### Start Packeton Docker Container
Source: https://context7.com/vtsykun/packeton/llms.txt
Run Packeton as a single Docker container with a persistent volume for data. This command starts the container and maps port 8080 to the container's port 80.
```bash
# Start the container
docker run -d --name packeton \
--mount type=volume,src=packeton-data,dst=/data \
-p 8080:80 \
packeton/packeton:latest
# Create the first admin user
docker exec -it packeton bin/console packagist:user:manager admin \
--email=admin@example.com --password=secret123 --admin
```
--------------------------------
### Run Sync Workers
Source: https://github.com/vtsykun/packeton/blob/master/CONTRIBUTING.md
Execute the console command to start the synchronization workers. The -vvv flag increases verbosity.
```bash
php bin/console packagist:run-workers -vvv
```
--------------------------------
### Default Docker Compose Configuration
Source: https://github.com/vtsykun/packeton/blob/master/docs/installation-docker.md
This is the typical `docker-compose.yml` for a basic Packeton setup with a single supervisor container.
```yaml
version: '3.6'
services:
packeton:
image: packeton/packeton:latest
container_name: packeton
hostname: packeton
environment:
ADMIN_USER: admin
ADMIN_PASSWORD: 123456
ADMIN_EMAIL: admin@example.com
DATABASE_URL: mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4
ports:
- '127.0.0.1:8080:80'
volumes:
- .docker:/data
```
--------------------------------
### Packeton Proxy Configuration Example
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/mirroring.md
This YAML configuration demonstrates how to enable and configure Packeton proxies for Composer repositories. It includes settings for multiple mirrors, SSH keys, authentication, and synchronization options.
```yaml
packeton:
mirrors:
packagist:
url: https://repo.packagist.org
orocrm:
url: https://satis.oroinc.com/
git_ssh_keys:
git@github.com:oroinc: '/var/www/.ssh/private_key1'
git@github.com:org2: '/var/www/.ssh/private_key2'
example:
url: https://satis.example.com/
logo: 'https://example.com/logo.png'
http_basic:
username: 123
password: 123
public_access: true # Allow public access, default false
sync_lazy: true # default false
enable_dist_mirror: false # default true
available_package_patterns: # Additional restriction, but you can restrict it in UI
- 'vend1/*'
available_packages:
- 'pack1/name1' # but you can restrict it in UI
composer_auth: '{"auth.json..."}' # JSON. auth.json to pass composer opts.
sync_interval: 3600 # default auto.
info_cmd_message: "\n\u001b[37;44m#Слава\u001b[30;43mУкраїні!\u001b[0m\n\u001b[40;31m#Смерть\u001b[30;41mворогам\u001b[0m" # Info message
```
--------------------------------
### Get Full Package Info (with stats)
Source: https://context7.com/vtsykun/packeton/llms.txt
Retrieves comprehensive information about a package, including statistics like downloads and stars.
```APIDOC
## GET /packages/{packageName}.json
### Description
Retrieves comprehensive information about a package, including statistics like downloads and stars.
### Method
GET
### Endpoint
https://pkg.example.com/packages/{packageName}.json
### Parameters
#### Path Parameters
- **packageName** (string) - Required - The name of the package (e.g., 'acme/private-lib').
#### Query Parameters
- **token** (string) - Required - API token for authentication (format: username:apiToken).
### Response
#### Success Response (200)
- **package** (object) - An object containing detailed package information.
- **name** (string) - The name of the package.
- **description** (string) - A brief description of the package.
- **time** (string) - The last update time.
- **versions** (object) - Details about package versions.
- **type** (string) - The type of the package.
- **repository** (string) - The URL of the package repository.
- **downloads** (object) - Download statistics.
- **favers** (integer) - Number of users who favorited the package.
#### Response Example
```json
{
"package": {
"name": "acme/private-lib",
"description": "A private library",
"time": "2024-01-15T10:00:00+00:00",
"versions": {...},
"type": "library",
"repository": "https://github.com/acme/private-lib",
"downloads": {"total": 1523, "monthly": 210, "daily": 7},
"favers": 3
}
}
```
```
--------------------------------
### Original Composer Metadata Example
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/mirroring.md
This JSON snippet shows a typical original Composer metadata structure, including packages and providers URL. It is presented for comparison with the mirrored metadata.
```json
{
"packages": [],
"providers-url": "/p/%package%$%hash%.json",
"providers": {
"actualys/drupal-commerce-connector-bundle": {
"sha256": "4163f3b470b3b824cbcebee5a0d58ea3d516b7b5fa78617ba21120eeec9e494f"
},
"agencednd/oro-api-connector-bundle": {
"sha256": "169c0963fd8442c190f2e9303e0e6fa1fe9ad0c9fb2f6782176d02e65a48eada"
},
"akeneo/batch-bundle": {
"sha256": "4f2c1b9a43124524da45b35236acabd3ee1ad329980b885089e9eb408c1bca01"
},
...
+ 57 packages
}
```
--------------------------------
### Configure Generic OIDC Provider
Source: https://github.com/vtsykun/packeton/blob/master/docs/oauth2/oidc.md
Example configuration for integrating a generic OIDC provider like Authentik. Ensure to replace placeholder values with your actual credentials and URLs.
```yaml
packeton:
integrations:
authentik: # Alias name - can be any URL-safe value
allow_login: true
allow_register: true
default_roles: ['ROLE_USER', 'ROLE_MAINTAINER']
login_title: 'Login with Authentik'
oidc:
client_id: 'packeton-client-id'
client_secret: 'packeton-client-secret'
issuer: 'https://auth.example.com/application/o/packeton/'
```
--------------------------------
### Example Metadata with Strict Mode
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/mirroring.md
This JSON structure illustrates metadata with Strict Mode enabled and manual dependencies' approval. It defines includes, mirrors, metadata URL, and available packages.
```json
{
"includes": {
"include-packeton/all$f05f56b8bd12d014a753cdbe6a7d749facd40908.json": {
"sha1": "f05f56b8bd12d014a753cdbe6a7d749facd40908"
}
},
"mirrors": [
{
"dist-url": "/mirror/orocrm/zipball/%package%/%version%/%reference%.%type%",
"preferred": true
}
],
"metadata-url": "/mirror/orocrm/p2/%package%.json",
"available-packages": [
"romanpitak/dotmailer-api-v2-client",
"oro/platform-enterprise",
"oro/crm-enterprise",
"oro/api-doc-bundle",
"oro/flotr2",
"oro/crm-pro-ldap-bundle",
"oro/multi-host",
"akeneo/batch-bundle"
]
}
```
--------------------------------
### Twig Sandbox Example (Fails)
Source: https://github.com/vtsykun/packeton/blob/master/docs/webhook/wh-security.md
This Twig template attempts to access sensitive package credentials, which is disallowed by the sandbox mode, resulting in a security error.
```twig
{% set text = "*New Releases*\n" %}
{% set title = package.name ~ ' (' ~ versions|map(v => "#{v.version}")|join(',') ~ ')' %}
{% set text = text ~ package.credentials.key %}
{% set request = {
'channel': 'jenkins',
'text': text
} %}
{{ request|json_encode }}
```
--------------------------------
### Enable Basic LDAP Authentication
Source: https://github.com/vtsykun/packeton/blob/master/docs/authentication-ldap.md
Configure LDAP authentication by setting default login providers and defining LDAP user providers. This example uses a test LDAP server for demonstration.
```yaml
parameters:
default_login_provider: 'form_login_ldap'
default_login_options:
provider: all_users
login_path: /login
use_forward: false
check_path: /login
failure_path: null
service: Symfony\Component\Ldap\Ldap
dn_string: 'uid={username},dc=example,dc=com'
services:
Symfony\Component\Ldap\Ldap:
arguments: ['@Symfony\Component\Ldap\Adapter\ExtLdap\Adapter']
tags:
- ldap
Symfony\Component\Ldap\Adapter\ExtLdap\Adapter:
arguments:
- host: ldap.forumsys.com
port: 389
security:
providers:
users_ldap:
ldap:
service: Symfony\Component\Ldap\Ldap
base_dn: dc=example,dc=com
search_dn: "cn=read-only-admin,dc=example,dc=com"
search_password: password
default_roles: ROLE_MAINTAINER
uid_key: uid
all_users:
chain:
providers: ['packagist', 'users_ldap']
```
--------------------------------
### Get Package Data (Dynamic)
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/api.md
Retrieve comprehensive package data, including downloads, maintainers, and GitHub info. Responses are cached for performance.
```APIDOC
## GET /packages/[vendor]/[package].json
### Description
Retrieve comprehensive package data dynamically. This endpoint provides detailed information including downloads, maintainers, and GitHub info. Responses are cached for 12 hours.
### Method
GET
### Endpoint
https://example.com/packages/[vendor]/[package].json?token=
### Query Parameters
- **token** (string) - Required - Your API token.
### Response
#### Success Response (200)
- **package** (object) - Detailed information about the package.
- **name** (string) - The name of the package.
- **description** (string) - The description of the package.
- **time** (string) - The timestamp of the last release.
- **maintainers** (array) - A list of package maintainers.
- **versions** (object) - A list of versions and their dependencies, similar to composer.json.
- **type** (string) - The type of the package.
- **repository** (string) - The URL of the package repository.
- **downloads** (object) - Download statistics.
- **total** (integer) - Total number of downloads.
- **monthly** (integer) - Number of downloads per month.
- **daily** (integer) - Number of downloads per day.
- **favers** (integer) - Number of favers (stars).
#### Response Example
{
"package": {
"name": "[vendor]/[package],
"description": "[description],
"time": "[time of the last release],
"maintainers": ["list of maintainers"],
"versions": ["list of versions and their dependencies, the same data of composer.json"],
"type": "[package type],
"repository": "[repository url],
"downloads": {
"total": "[numbers of download],
"monthly": "[numbers of download per month],
"daily": "[numbers of download per day]"
},
"favers": "[number of favers]"
}
}
```
--------------------------------
### Glob Package Filter Example
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/migrate.md
Use Glob patterns to filter packages by vendor name during import. This is useful for selectively importing packages from a large repository.
```text
okvpn/*
org1/*
```
--------------------------------
### Get Dynamic Package Information API Request
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/api.md
Fetch comprehensive package details, including downloads, maintainers, and GitHub information, via a dynamically generated JSON API. Responses are cached for twelve hours.
```http
GET https://example.com/packages/[vendor]/[package].json?token=
```
--------------------------------
### Use Secrets in Request Body with Logging (Twig)
Source: https://github.com/vtsykun/packeton/blob/master/docs/webhook/webhook-secrets.md
This Twig example shows how to use secrets in the request body and also log the secret value. Note that this specific example might not function as intended.
```twig
{% set request = {
'chat_id': '${secrets.CHART_ID}',
'text': 'example text'
} %}
{% do log('${secrets.CHART_ID}')
{{ request|json_encode }}
```
--------------------------------
### Import Packages from Packagist.com or Satis (Package List)
Source: https://context7.com/vtsykun/packeton/llms.txt
Alternatively, provide a specific list of packages to import, including their versions and short descriptions.
```text
vendor/package1 1.2.0 Short description
vendor/package2 2.0.1 Another package
```
--------------------------------
### Create Admin User
Source: https://github.com/vtsykun/packeton/blob/master/docs/installation.md
Use the Packeton console command to create an administrator user. Ensure you replace 'username', 'admin@example.com', and '123456' with your desired credentials.
```bash
php bin/console packagist:user:manager username --email=admin@example.com --password=123456 --admin
```
--------------------------------
### Get Git Changelog Between Versions
Source: https://context7.com/vtsykun/packeton/llms.txt
Retrieves the Git changelog between two specified versions of a package.
```APIDOC
## GET /packages/{packageName}/changelog
### Description
Retrieves the Git changelog between two specified versions of a package.
### Method
GET
### Endpoint
https://pkg.example.com/packages/{packageName}/changelog
### Parameters
#### Path Parameters
- **packageName** (string) - Required - The name of the package (e.g., 'acme/private-lib').
#### Query Parameters
- **token** (string) - Required - API token for authentication (format: username:apiToken).
- **from** (string) - Required - The starting version (e.g., '1.0.0').
- **to** (string) - Required - The ending version (e.g., '1.1.0').
### Response
#### Success Response (200)
- **result** (array) - An array of changelog entries.
- **error** (string|null) - An error message if the operation failed.
- **metadata** (object) - Metadata about the changelog request.
#### Response Example
```json
{
"result": [
"feat: add new payment gateway integration",
"fix: resolve memory leak in cache handler"
],
"error": null,
"metadata": {"from": "1.0.0", "to": "1.1.0", "package": "acme/private-lib"}
}
```
```
--------------------------------
### Get Package Metadata (Composer v2)
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/api.md
Retrieve package metadata compatible with Composer v2.
```APIDOC
## GET /p2/[vendor]/[package].json
### Description
Retrieve package metadata in a format compatible with Composer v2.
### Method
GET
### Endpoint
https://example.com/p2/firebase/php-jwt.json
### Response
#### Success Response (200)
- **minified** (string) - Indicates the Composer version (e.g., "composer/2.0").
- **packages** (object) - An object containing package details, typically a list of versions.
- **[vendor]/[package]** (array) - A list of versions for the specified package.
#### Response Example
{
"minified": "composer/2.0",
"packages": {
"[vendor]/[package]": ["... list versions"]
}
}
```
--------------------------------
### Submit a New Package
Source: https://context7.com/vtsykun/packeton/llms.txt
Register a new VCS repository as a Composer package. Requires an API token.
```bash
curl -X POST "https://pkg.example.com/api/create-package?token=admin:myapitoken" \
-H "Content-Type: application/json" \
-d '{"repository": {"url": "git@github.com:acme/private-lib.git"}}'
```
--------------------------------
### Get Package Metadata (Composer v1)
Source: https://context7.com/vtsykun/packeton/llms.txt
Retrieves metadata for a specific package in Composer v1 format.
```APIDOC
## GET /p/{packageName}.json
### Description
Retrieves metadata for a specific package in Composer v1 format.
### Method
GET
### Endpoint
https://pkg.example.com/p/{packageName}.json
### Parameters
#### Path Parameters
- **packageName** (string) - Required - The name of the package (e.g., 'acme/private-lib').
#### Query Parameters
- **token** (string) - Required - API token for authentication (format: username:apiToken).
### Response
#### Success Response (200)
- **packages** (object) - An object containing package versions and their metadata.
#### Response Example
```json
{
"packages": {
"acme/private-lib": {
"1.0.0": {"name": "acme/private-lib", "version": "1.0.0", ...},
"1.1.0": {"name": "acme/private-lib", "version": "1.1.0", ...}
}
}
}
```
```
--------------------------------
### Composer Global Authentication Configuration
Source: https://github.com/vtsykun/packeton/blob/master/docs/authentication.md
Set up authentication globally for a specific domain using the Composer CLI. This avoids hardcoding credentials in composer.json. Replace 'example.org' with the target domain and 'username'/'api_token' with actual credentials.
```bash
composer config --global --auth http-basic.example.org username api_token
```
--------------------------------
### Execute Database Migrations
Source: https://github.com/vtsykun/packeton/blob/master/UPGRADE.md
Run this command to apply database schema updates.
```bash
bin/console doctrine:schema:update --force
```
--------------------------------
### Change JWT Algorithm
Source: https://github.com/vtsykun/packeton/blob/master/docs/authentication-jwt.md
Example of how to specify a different digital signature algorithm, such as RS256 for RSA 256, in the JWT configuration.
```yaml
packeton:
jwt_authentication:
...
algo: RS256 # RSA 256
```
--------------------------------
### Configure Environment Variables
Source: https://github.com/vtsykun/packeton/blob/master/CONTRIBUTING.md
Create a local environment file (.env.local) to configure application settings, including the database connection.
```dotenv
# .env.local
APP_ENV=dev
# select database, default SQLite
DATABASE_URL="postgresql://postgres:123456@127.0.0.1:5432/packeton?serverVersion=12&charset=utf8"
```
--------------------------------
### Create Admin User with Console Command
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/README.md
Use this command to create a new admin user. Ensure you replace placeholder values with your desired username, email, and password.
```bash
php bin/console packagist:user:manager username --email=admin@example.com --password=123456 --admin # create admin user
```
--------------------------------
### Get Package Metadata (Composer v1)
Source: https://context7.com/vtsykun/packeton/llms.txt
Retrieve metadata for a specific package in Composer v1 format. Requires authentication.
```bash
curl "https://pkg.example.com/p/acme/private-lib.json?token=username:apiToken"
```
--------------------------------
### Make HTTP Request from Twig
Source: https://github.com/vtsykun/packeton/blob/master/docs/webhook.md
Demonstrates how to make an HTTP GET request to an external API and encode the JSON response.
```twig
{% set tags = http_request('https://registry.hub.docker.com/v1/repositories/okvpn/orocommerce/tags') %}
{{ tags|json_encode }}
```
--------------------------------
### Create Admin User
Source: https://github.com/vtsykun/packeton/blob/master/CONTRIBUTING.md
Use the console command to create an administrator user with a specified password.
```bash
php bin/console packagist:user:manager admin --password=123456 --admin
```
--------------------------------
### Get Package Metadata (Static)
Source: https://github.com/vtsykun/packeton/blob/master/docs/usage/api.md
Retrieve static package metadata. This is the preferred method for accessing up-to-date package information.
```APIDOC
## GET /p/[vendor]/[package].json
### Description
Retrieve static package metadata. This method is efficient and provides up-to-date information.
### Method
GET
### Endpoint
https://example.com/p/[vendor]/[package].json?token=
### Query Parameters
- **token** (string) - Required - Your API token.
### Response
#### Success Response (200)
- **packages** (object) - An object containing package details.
- **[vendor]/[package]** (object) - Details for the specific package.
- **[version]** (object) - Details for a specific version of the package.
- **name** (string) - The name of the package.
- **description** (string) - The description of the package.
- ... (other version-specific details)
#### Response Example
{
"packages": {
"[vendor]/[package]": {
"[version1]": {
"name": "[vendor]/[package],
"description": "[description]",
"// ...": "other details"
},
"[version2]": {
"// ...": "other details"
}
"// ...": "other versions"
}
}
}
```
--------------------------------
### Configure Bitbucket Webhook
Source: https://context7.com/vtsykun/packeton/llms.txt
Set up a webhook for Bitbucket to trigger package metadata refreshes on repository push events. Requires an API token.
```text
Webhook URL: https://pkg.example.com/api/bitbucket?token=username:api_token
Triggers: Repository push
```
--------------------------------
### Interrupt Request Example
Source: https://github.com/vtsykun/packeton/blob/master/docs/webhook.md
Shows how to conditionally interrupt a webhook request using the `interrupt()` function. The request is halted if the condition is met.
```twig
{% set request = {
'chat_id': '1555151',
'parse_mode': 'Markdown',
'text': 'Text'
} %}
{% if package.name == 'okvpn/mq-insight' %}
{{ interrupt() }}
{% endif %}
{{ request|json_encode }}
```
--------------------------------
### Show SQL Schema Changes
Source: https://github.com/vtsykun/packeton/blob/master/UPGRADE.md
Run this command to view pending SQL changes before applying migrations.
```bash
bin/console doctrine:schema:update --dump-sql
```
--------------------------------
### Get Git Changelog Between Versions
Source: https://context7.com/vtsykun/packeton/llms.txt
Retrieve the Git changelog between two specified versions of a package. Requires authentication and version parameters.
```bash
curl "https://pkg.example.com/packages/acme/private-lib/changelog?token=username:apiToken&from=1.0.0&to=1.1.0"
```
--------------------------------
### Nesting Webhook Example
Source: https://github.com/vtsykun/packeton/blob/master/docs/webhook.md
Illustrates how to trigger another webhook from within a Twig template using the `trigger_webhook` function. This allows for sequential requests.
```twig
{% do trigger_webhook(6, {'project': 'OK', 'version': versions[0].version}) %}
```
--------------------------------
### Configure Bitbucket Cloud Integration
Source: https://context7.com/vtsykun/packeton/llms.txt
Set up integration with Bitbucket Cloud. Requires API key and secret.
```yaml
# Bitbucket Cloud
bitbucket:
repos_synchronization: true
bitbucket:
key: 'GA7000000000000000'
secret: '9chxxxxxzxxxxxxxxeexxxxxxxxxxxxx'
```
--------------------------------
### Configure Composer with JWT Token
Source: https://context7.com/vtsykun/packeton/llms.txt
Set up Composer to use the generated JWT token for HTTP Basic authentication with a private repository.
```bash
composer config --global --auth http-basic.pkg.example.com admin
```
--------------------------------
### Configure Supervisor for Packagist Workers
Source: https://github.com/vtsykun/packeton/blob/master/README.md
Set up Supervisor to manage Packagist background workers. This configuration ensures workers are automatically started and restarted.
```ini
[program:packagist-workers]
environment =
HOME=/var/www/
command=/var/www/packagist/bin/console packagist:run-workers --env=prod --no-debug
directory=/var/www/packagist/
process_name=%(program_name)s_%(process_num)02d
numprocs=1
autostart=true
autorestart=true
startsecs=0
redirect_stderr=true
priority=1
user=www-data
```
--------------------------------
### Configure GitLab Self-Hosted Integration
Source: https://context7.com/vtsykun/packeton/llms.txt
Set up integration with a self-hosted GitLab instance. Requires specifying the base URL and OAuth client credentials.
```yaml
# GitLab self-hosted
gitlab_prod:
base_url: 'https://gitlab.mycompany.com/'
clone_preference: 'clone_https'
repos_synchronization: true
pull_request_review: true
gitlab:
client_id: 'abc123'
client_secret: 'def456'
```
--------------------------------
### Get Package Metadata (Composer v2)
Source: https://context7.com/vtsykun/packeton/llms.txt
Retrieve metadata for a specific package in Composer v2 format. Does not require authentication for basic metadata.
```bash
curl "https://pkg.example.com/p2/acme/private-lib.json"
```
--------------------------------
### Submit a Package
Source: https://context7.com/vtsykun/packeton/llms.txt
Registers a new VCS repository as a Composer package. Requires an API token for authentication.
```APIDOC
## POST /api/create-package
### Description
Registers a new VCS repository as a Composer package.
### Method
POST
### Endpoint
https://pkg.example.com/api/create-package?token=admin:myapitoken
### Parameters
#### Query Parameters
- **token** (string) - Required - API token for authentication.
#### Request Body
- **repository.url** (string) - Required - The URL of the VCS repository.
### Request Example
```json
{
"repository": {
"url": "git@github.com:acme/private-lib.git"
}
}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates the success of the operation.
- **name** (string) - The name of the registered package.
#### Response Example
```json
{
"status": "success",
"name": "acme/private-lib"
}
```
```
--------------------------------
### Run Packeton Docker Container
Source: https://github.com/vtsykun/packeton/blob/master/docs/installation-docker.md
Starts the Packeton Docker container in detached mode, mounts a volume for data persistence, and maps port 8080.
```bash
docker run -d --name packeton \
--mount type=volume,src=packeton-data,dst=/data \
-p 8080:80 \
packeton/packeton:latest
```
--------------------------------
### Docker Volume Mapping (Before)
Source: https://github.com/vtsykun/packeton/blob/master/UPGRADE.md
Illustrates the previous Docker volume mapping structure for persistent data.
```yaml
- .docker/redis:/var/lib/redis
- .docker/zipball:/var/www/packagist/app/zipball
- .docker/composer:/var/www/.composer
- .docker/ssh:/var/www/.ssh
```