Wie konfiguriere ich den PHP Deployer in TYPO3?

Möchten Sie den beliebtesten PHP-Deployer in einem TYPO3-Projekt verwenden? Folgen Sie dieser Anleitung, um den Deployer zu installieren, die Hosts zu konfigurieren und den TYPO3 PHP Deployer Code zu verwenden.

Step 1. PHP Deployer installieren

// Download latest PHP Deployer
curl -LO https://deployer.org/deployer.phar

// Switch to root user + Move to bin to access "dep" command
sudo -s
mv deployer.phar /usr/local/bin/dep
chmod +x /usr/local/bin/dep

// Verify the installation
dep --version

Step 2.Konfigurieren Sie PHP Deployer Hosts.yml

# Create .hosts.yaml at root of your project

# Configure Staging Server
DOMAIN/IP:
  host: DOMAIN/IP
  user: username
  stage: staging
  branch: staging
  identity_file: ~
  deploy_path: /var/www/your/path/

# Configure Production Server
DOMAIN/IP:
  host: DOMAIN/IP
  user: username
  stage: production
  branch: master
  identity_file: ~
  deploy_path: /var/www/your/path/

Step 3. TYPO3 Deploy.php vorbereiten

<?php

// Create deploy.php at root of your project

namespace Deployer;
require 'recipe/common.php';

# Project name
set('application', 'project');

# Define Git-Repository
set('repository', 'git@gitlab.com:yourpath/project.git');

# [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true); 

# Set maxium releases backup
set('keep_releases', 5);

# Set Server
inventory('.hosts.yaml');

# DocumentRoot / WebRoot for the TYPO3 installation
set('typo3_webroot', 'public');

# Main TYPO3 task
task('deploy', [
    'deploy:info',
    'deploy:prepare',
    'deploy:lock',
    'deploy:release',
    'deploy:update_code',
    'deploy:shared',
    'deploy:vendors',
    'deploy:writable',
    'deploy:symlink',
    'deploy:unlock',
    'cleanup',
])->desc('Deploy your project');
after('deploy', 'success');

# Shared directories
set('shared_dirs', [
    '{{typo3_webroot}}/fileadmin',
    '{{typo3_webroot}}/typo3temp',
    '{{typo3_webroot}}/uploads'
]);

# Shared files
set('shared_files', [
    '{{typo3_webroot}}/.htaccess'
]);

# Writeable directories
set('writable_dirs', [
    'config',
    '{{typo3_webroot}}/fileadmin',
    '{{typo3_webroot}}/typo3temp',
    '{{typo3_webroot}}/typo3conf',
    '{{typo3_webroot}}/uploads'
]);

# [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');

Step 4. Erledigt! Fahren Sie mit der Bereitstellung fort.

 

aufstellen

Post a Comment

×

    Got answer to the question you were looking for?