Git Product home page Git Product logo

luya-deployer's Introduction

LUYA Logo

LUYA Deployer

LUYA Total Downloads Latest Stable Version Join the chat at https://gitter.im/luyadev/luya

This is the recipe to deploy your LUYA Website with PHP Deployer.

Version 3.0 of LUYA Deployer is compatible with PHP Deployer 7

Install

Add the deployer composer package to your project:

composer require luyadev/luya-deployer --dev

Create a deploy.php file with the content of your host configuration(s) and store it in the root directory of your project:

<?php
namespace Deployer;

require 'vendor/luyadev/luya-deployer/luya.php';

// define your configuration here
host('SSHHOST.COM')
    ->setLabels(['stage' => 'prod'])
    ->set('remote_user', 'SSHUSER')
    ->set('deploy_path', '~/httpdocs');

set('repository', 'https://USER:[email protected]/VENDOR/REPO.git');

To deploy to the above configured server just go into the console and run:

./vendor/bin/dep luya prod

The LUYA Deployer will now deploy the to the above host with prod Config. The stage() method determines which Config ENV should be taken, therefore those values must correlate each other.

Configure Hosting

In order to run your website, you have to modify the root directory of your website to current/public_html folder. Deployer will create the following folders:

  • current
  • releases
  • shared

Those folders are located in your defined deploy_path folder. So the current/public_html should be the only directory visible by the web.

Options

Several options and can be defined with set(OPTION, VALUE). Its recommend to set the define the option for a given server:

host('luya.io')
    ->stage('prod')
    ->set(COMPOSER_IGNORE_PLATFORM_REQS, true)
    ->set('deploy_path', '~/httpdocs');

Available Options

Key Constant Default Description
ignorePlatformReqs COMPOSER_IGNORE_PLATFORM_REQS false Whether composer install should ignore platform requirements or not.
adminCoreCommands LUYA_ADMIN_CORE_COMMANDS true Whether the LUYA core commands like migrate, import should be run after deployment.

In order to configure a branch to deploy use set('branch', 'myCheckoutBranch');

Unglue

In order to use unglue you can add after('luya:commands', 'unglue'); in your deploy.php. This will download the unglue phar file and compile the files according to the .unglue file.

Authorization Password / SSH Key

Since the password() method has been removed, authentication can either be done using SSH Keys or by entering the password while deployment. The dep luya prod command will prompt for the users password unless he could not connect by SSH Key. By default the ~/.ssh/id_rsa will be taken to make a first attempt. You can configure ssh settings with the following methods:

->configFile('~/.ssh/config')
->identityFile('~/.ssh/id_rsa')
->forwardAgent(true)
->multiplexing(true)

Read the PHP Deployer Docs for more informations. As we can not cover everything about SSH Keys but a here is a very basic example setup. First you have to create an SSH key, then the Server you'd like to connect must have stored the public key .pub file. So you should never publish the private key but the public key can be stored on the Server:

  1. Generate an SSH Key ssh-keygen -t rsa -b 2048 -C "luyadeployer"
  2. When prompting for Enter passphrase (empty for no passphrase): skip this step (at least when setting up an continuous deployment f.e.).
  3. Copy the content of ~/.ssh/id_rsa.pub which is the public key.
  4. Add the public key to ~/.ssh/authorized_keys on the Server or use ssh-copy-id. Also Plesk f.e. has visual tools to do so Plesk SSH Keys Extension

luya-deployer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

luya-deployer's Issues

Extend Deploy Docs

  • Adding docs how to deploy with git authtoken
  • some general hints for private repo deployment

Runtime Exception during deploy

I am trying to deploy my fresh Kickstarter pack of LUYA CMS to LAMP server. I used a guide from the official site, but during deploy, state got an error. Here is my config:

// define your configuration here
server('prod', 'ip', 22)
    ->user('user')
    ->password('password') // You can use identity key, ssh config, or username/password to auth on the server.
    ->stage('prod')
    ->env('deploy_path', '/home/pi/luya/'); // Define the base path to deploy your project to.

set('repository', 'https://user:[email protected]/user/luya.git');

Here is logs:

$ ./vendor/bin/dep luya prod -vvv
➤ Executing task deploy:prepare
↳ on [prod]
> echo $0
< bash
< 
> if [ ! -d /home/pi/luya/ ]; then mkdir -p /home/pi/luya/; fi
> if [ ! -L /home/pi/luya//current ] && [ -d /home/pi/luya//current ]; then echo true; fi
> cd /home/pi/luya/ && if [ ! -d releases ]; then mkdir releases; fi
> cd /home/pi/luya/ && if [ ! -d shared ]; then mkdir shared; fi
• done on [prod]
✔ Ok [1s 295ms]
➤ Executing task deploy:release
↳ on [prod]
> if [ -d /home/pi/luya//releases/20190419103847 ]; then echo 'true'; fi
> mkdir /home/pi/luya//releases/20190419103847
> cd /home/pi/luya/ && if [ -h release ]; then rm release; fi
> ln -s /home/pi/luya//releases/20190419103847 /home/pi/luya//release
• done on [prod]
✔ Ok [382ms]
➤ Executing task deploy:update_code
↳ on [prod]
> which git

In PhpSecLib.php line 124:
                      
  [RuntimeException]  
                      

Exception trace:
 () at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\deployer\deployer\src\Server\Remote\PhpSecLib.php:124
 Deployer\Server\Remote\PhpSecLib->run() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\deployer\deployer\src\functions.php:296
 run() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\deployer\deployer\recipe\common.php:54
 {closure}() at n/a:n/a
 call_user_func() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\deployer\deployer\src\Server\Environment.php:101
 Deployer\Server\Environment->get() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\deployer\deployer\src\functions.php:573
 env() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\deployer\deployer\recipe\common.php:176
 {closure}() at n/a:n/a
 call_user_func() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\deployer\deployer\src\Task\Task.php:79
 Deployer\Task\Task->run() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\deployer\deployer\src\Executor\SeriesExecutor.php:43
 Deployer\Executor\SeriesExecutor->run() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\deployer\deployer\src\Console\TaskCommand.php:82
 Deployer\Console\TaskCommand->execute() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\symfony\console\Command\Command.php:255
 Symfony\Component\Console\Command\Command->run() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\symfony\console\Application.php:960
 Symfony\Component\Console\Application->doRunCommand() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\symfony\console\Application.php:255
 Symfony\Component\Console\Application->doRun() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\symfony\console\Application.php:148
 Symfony\Component\Console\Application->run() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\deployer\deployer\src\Deployer.php:101
 Deployer\Deployer->run() at C:\xampp\htdocs\l.site1.com\luya-kickstarter\vendor\deployer\deployer\bin\dep:64

luya [-p|--parallel]

What do i do wrong?

Additional infos

Q A
LUYA Version 1.0.4
PHP Version php-7.0
Platform Apache
Operating system Raspbian Stretch Lite

install

Found another Basil :( Must be me :)

What steps will reproduce the problem?

composer require luyadev/luya-deployer --dev

What is the expected result?

install luya-deployer

What do you get instead? (A Screenshot can help us a lot!)

- Can only install one of: symfony/process[v3.4.9, v4.4.2].
- Installation request for symfony/process (locked at v4.4.2) -> satisfiable by symfony/process[v4.4.2].

LUYA Check ouput (run this script and post the result: luyacheck.php)

I removed the mod_rewrite check as it was erroring cause I use nginx php-fpm.
The rest are:-

1: [ini_get('short_open_tag')] ''
2: [ini_get('error_reporting')] '22527'
3: [phpversion()] '7.2.26'
4: [php_ini_loaded_file()] '/etc/php.ini'
5: [php_sapi_name()] 'cli'
PHP Warning: Use of undefined constant unknown - assumed 'unknown' (this will throw an Error in a future version of PHP) in /web/luya-kickstarter/public_html/luyacheck.php(22) : eval()'d code on line 1

Additional infos

Q A
LUYA Version luya-core = 1.0, luya-module-cms = 2.0
PHP Version 7.2
Platform LEMP
Operating system Centos 6.4

unglue task

provide default "task" for unglue compile. maybe download unglue phar file.

config file being reset

What steps will reproduce the problem?

Have entered database config vars for ENV_PROD.

run: ./vendor/bin/dep luya prod

receive:
⤠Executing task deploy:prepare
⤠Executing task deploy:release
⤠Executing task deploy:update_code
⤠Executing task deploy:vendors
⤠Executing task deploy:luya

In PhpSecLib.php line 124:

Error: SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: NO)

check upstream... config.php has been reset to clean. ie: has no settings entered.

What is the expected result?

Not to receive the following error:-
Error: SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: NO)

What do you get instead? (A Screenshot can help us a lot!)

LUYA Check ouput (run this script and post the result: luyacheck.php)

Can't run... Use nginx

Additional infos

Q A
LUYA Version latest
PHP Version 7.2
Platform LEMP
Operating system Centos 7.7

add runtime to shared folders.

As cache clearing can be done by a console command, the runtime folder should be part of shared foldes, this is also what yii2 deployer recipe does by default.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.