Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Deployer 7 Updates #2677

Closed
wants to merge 12 commits into from
40 changes: 40 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
# Config
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is about configuration in general. Using get/set. Global config and hosts.


In the `config:` section of your `yaml` file you set all the required items to start deploying your application. It starts with `config:` following by the items in configuration in an indented list. Example

```yml
config:
application: 'domain'
```

All the options for configuration will be discussed below.

## Application

the name of your application is the first item to start with. The domain name of the application is a standard choice:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go to recipe documentation in docs/recopes/common.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could move it over. Is there need to keep Deployer 6 and 7 settings for common.php?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, only v7


```yml
application: 'domain'
```

## Respository

Using `repository` you can set the repository you would like to use for deployment. Example:

```yml
repository: 'git@github.com:user/domain.git'
```


## Releases

How many releases to keep can be set with `keep_releases`:

```yml
keep_releases: 10
```

## Shared Files

```
shared_files:
```
10 changes: 3 additions & 7 deletions docs/contrib/php-fpm.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@ require 'contrib/php-fpm.php';
## Usage

Start by explicitely providing the current version of PHP-version using the `php_fpm_version`.
Alternatively, you may use any of the options above to configure how PHP-fpm should reload.

Then, add the `php-fpm:reload` task at the end of your deployments by using the `after` method like so.
To set the appropriate PHP FPM version you add a line starting with `php_fpm_version` followed by the version needed to your `.yaml` file. Example:

```php
set('php_fpm_version', '8.0');
after('deploy', 'php-fpm:reload');
```yml
php_fpm_version: 7.4
```




## Configuration
### php_fpm_version
[Source](https://github.com/deployphp/deployer/blob/master/contrib/php-fpm.php#L32)
Expand Down
2 changes: 1 addition & 1 deletion docs/recipe/deploy/writable.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ One of:
- acl

```php title="Default value"
'chgrp'
'acl'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

```


Expand Down
65 changes: 65 additions & 0 deletions docs/yaml-examples/laravel-yaml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Laravel PHP Yaml Example

Here is an example `yaml` file for a Laravel PHP setup using the Laravel recipe `recipes/laravel.php` as well as PHP FPM & NPM from the `contrib` directory. The repository is a dummy one in this example, but all else is useful for most Laravel setups:

```yml
import:
- recipe/laravel.php
- contrib/php-fpm.php
- contrib/npm.php

config:
application: 'domain'
repository: 'git@github.com:user/domain.git'
php_fpm_version: 7.4
keep_releases: 10
shared_files:
- '.env'
- '.transip_private_key'
shared_dirs:
- 'public/uploads'
- 'public/published'
- 'storage/logs'
- 'storage/tls'
- 'storage/app/public'
- 'storage/app/modules'
writable_dirs:
- 'public/uploads'
- 'public/published'
- 'storage/framework/cache/data'
- 'storage/logs'
- 'storage/tls'
- 'storage/app/public'
- 'storage/app/modules'

hosts:
prod:
remote_user: forge
hostname: 'domain.com'
deploy_path: '~/{{hostname}}'
staging:
remote_user: forge
hostname: 'staging.domain.com'
deploy_path: '~/{{hostname}}'

tasks:
deploy:
- deploy:prepare
- deploy:vendors
- artisan:storage:link
- artisan:view:cache
- artisan:config:cache
- artisan:migrate
- npm:install
- npm:run:prod
- deploy:publish
- php-fpm:reload
npm:run:prod:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can add something like this somewhere :

hosts:
  prod:
    remote_user: forge
    hostname: 'domain.com'
    deploy_path: '~/{{hostname}}'
    labels:
        npm_build_script: prod
  staging:
    remote_user: forge
    hostname: 'staging.domain.com'
    deploy_path: '~/{{hostname}}'
    labels:
        npm_build_script: dev
...

npm:run:dev:
    select: 'npm_build_script=dev'
    script:
        - 'cd {{release_or_current_path}} && npm run dev'

npm:run:prod:
    select: 'npm_build_script=prod'
    script:
       - 'cd {{release_or_current_path}} && npm run prod'
hosts:
  prod:
    remote_user: forge
    hostname: 'domain.com'
    deploy_path: '~/{{hostname}}'
  staging:
    remote_user: forge
    hostname: 'staging.domain.com'
    deploy_path: '~/{{hostname}}'
...

npm:run:dev:
    select: '__host__=prod'
    script:
        - 'cd {{release_or_current_path}} && npm run dev'

npm:run:prod:
    select: '__host__=staging'
    script:
       - 'cd {{release_or_current_path}} && npm run prod'

script:
- 'cd {{release_or_current_path}} && npm run prod'

after:
deploy:
- failed:deploy:unlock
- artisan:horizon:terminate
```
28 changes: 28 additions & 0 deletions docs/yaml.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# YAML

TODO


## General Example

Here is a general yaml example for your average PHP application:

``yml
import:
-

config:
application: 'domain'
repository: 'git@github.com:user/domain.git'
php_fpm_version: 7.4
keep_releases: 10
shared_files:
-
shared_dirs:
-
writable_dirs:
-
```


## Specific Examples

[Laravel PHP Framework Example](yaml-examples/laravel-yaml.md)