Skip to content

Commit

Permalink
improve deployer docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Apr 15, 2020
1 parent 63ff8b9 commit b79027c
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
[![Latest Stable Version](https://poser.pugx.org/luyadev/luya-deployer/v/stable)](https://packagist.org/packages/luyadev/luya-deployer)
[![Join the chat at https://gitter.im/luyadev/luya](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/luyadev/luya)

This is the recipe to deploy your LUYA Website with [deployer](http://deployer.org).
This is the recipe to deploy your LUYA Website with [PHP Deployer](http://deployer.org).

> **Version 2.0 of LUYA Deployer uses latest [deployer](http://deployer.org) version which does not support the password() method. In order to use `password()` install verison ^1.0 of luya deployer! [See Version 1.0 Documentation](https://github.com/luyadev/luya-deployer/tree/1.0)**
> **Version 2.0 of LUYA Deployer uses latest [PHP Deployer](http://deployer.org) version which does not support the password() method. In order to use `password()` install version ^1.0 of LUYA Deployer! [See Version 1.0 Documentation](https://github.com/luyadev/luya-deployer/tree/1.0)**
## Install

Expand All @@ -21,7 +21,7 @@ Add the deployer composer package to your project:
composer require luyadev/luya-deployer --dev
```

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

```php
<?php
Expand All @@ -45,13 +45,17 @@ To deploy to the above configured server just go into the console and run:
./vendor/bin/dep luya prod
```

If you have defined other servers like `prep`, `dev` etc you can just changed the server in the command. Lets say you have defined also a `dev` server:
The LUYA Deployer will now deploy the to the above host with `prod` [Config](https://luya.io/api/luya-Config). The `stage()` method determines which [Config ENV](https://luya.io/api/luya-Config) should be taken, therefore those values must correlate each other.

```sh
./vendor/bin/dep luya dev
```
## Configure Hosting

> In order to configure a branch to deploy use `set('branch', 'myCheckoutBranch');`
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

Expand All @@ -68,17 +72,26 @@ Available Options

|Key|Constant|Default|Description
|---|--------|-------|-----
|`ignorePlatformReqs`|`COMPOSER_IGNORE_PLATFORM_REQS`|false|Whether composer install should ignore platform requierments or not.
|`ignorePlatformReqs`|`COMPOSER_IGNORE_PLATFORM_REQS`|false|Whether composer install should ignore platform requirements or not.
|`installFxpPlugin`|`COMPOSER_INSTALL_FXP`|true|Whether composer global fxp plugin should be installed or not.
|`adminCoreCommands`|`LUYA_ADMIN_CORE_COMMANDS`|true|Wether the LUYA core commands like migrate, import should be run after deployment.
|`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');`
## Configure Hosting
## Authorization Password / SSH Key

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:
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:

+ current
+ releases
+ shared
```php
->configFile('~/.ssh/config')
->identityFile('~/.ssh/id_rsa')
->forwardAgent(true)
->multiplexing(true)
```

Those folders are located in your defined `deploy_path` folder. So the `current/public_html` should be the only directory visible by the web.
Read the [PHP Deployer Docs](https://deployer.org/docs/hosts.html) 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](https://www.plesk.com/extensions/ssh-keys/)

0 comments on commit b79027c

Please sign in to comment.