Update docs

This commit is contained in:
Anton Medvedev 2022-03-22 20:39:45 +01:00
parent 97cbbd4d79
commit 84f0431271
3 changed files with 51 additions and 35 deletions

View File

@ -58,7 +58,7 @@ stages:
deploy:
stage: deploy
image:
name: debreczeniandras/deployerphp:7-beta
name: deployphp/deployer:7
entrypoint: [""]
before_script:
- mkdir -p ~/.ssh
@ -77,15 +77,11 @@ deploy:
Only one deployment job runs at a time with the [`resource_group` keyword](https://docs.gitlab.com/ee/ci/yaml/index.html#resource_group) in .gitlab-ci.yml.
In addition, you can ensure that older deployment jobs are cancelled automatically when a newer deployment runs by enabling the [Skip outdated deployment jobs](https://docs.gitlab.com/ee/ci/pipelines/settings.html#skip-outdated-deployment-jobs) feature.
### Deploy code
Since by default every GitLab CI job already clone the repo, you could use [`rsync`](contrib/rsync.md#usage) task instead of `deploy:update_code` to upload the code from the job to the host.
In addition, you can ensure that older deployment jobs are cancelled automatically when a newer deployment runs by enabling the [skip outdated deployment jobs](https://docs.gitlab.com/ee/ci/pipelines/settings.html#skip-outdated-deployment-jobs) feature.
### Deploy secrets
Since it is not recommended pushing secrets in the repository, you could use a GitLab variable to store them.
Is not recommended committing secrets in the repository, you could use a GitLab variable to store them.
Many frameworks use dotenv to store secrets, let's create a GitLab file variable named `DOTENV`, so it can be deployed along with the code.
@ -93,7 +89,7 @@ Set up a deployer task to copy secrets to the server:
```php
task('deploy:secrets', function () {
upload(getenv('DOTENV'), get('deploy_path') . '/shared/.env');
upload(getenv('DOTENV'), '{{deploy_path}}/shared/.env');
});
```

View File

@ -1,34 +1,22 @@
# CLI Usage
After [installation](installation.md) of Deployer globally,
you will have the ability to run the `dep` command from your terminal.
To get a list of all available tasks run the `dep` command.
You can run it from any subdirectory of you project,
Deployer will automatically find project root dir.
We recommend adding next alias to your .bashrc file:
```bash
alias dep='vendor/bin/deployer.phar'
```
Usage:
command [options] [arguments]
Options:
-h, --help Display help for the given command. When no command is given display help for the list command
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi|--no-ansi Force (or disable --no-ansi) ANSI output
-n, --no-interaction Do not ask any interactive question
-f, --file=FILE Recipe file path
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
As well as installing completion script for Deployer, completion supports:
- tasks,
- options,
- host names,
- and configs.
Available commands:
blackjack Play blackjack
config Get all configuration options for hosts
help Display help for a command
init Initialize deployer in your project
list List commands
run Run any arbitrary command on hosts
ssh Connect to host through ssh
tree Display the task-tree for a given task
For example for macOS run next commands:
```bash
brew install bash-completion
dep completion bash > /usr/local/etc/bash_completion.d/deployer
```
## Overriding configuration options
@ -147,7 +135,11 @@ runLocally('ls', ['cwd' => '/root/directory']);
## Play blackjack
Deployer comes with buildin blackjack, to play it:
> Yeah, well. I'm gonna go build my own theme park... with blackjack and hookers!
>
> In fact, forget the park!
>
> — Bender
```
dep blackjack

View File

@ -1,3 +1,31 @@
# YAML
TODO
Deployer supports recipes written in YAML. For validating structure, Deployer uses
JSON Schema declared in [schema.json](https://github.com/deployphp/deployer/blob/master/src/schema.json).
Here is an example of YAML recipe:
```yaml
import:
- recipe/laravel.php
config:
repository: 'git@github.com:example/example.com.git'
remote_user: deployer
hosts:
example.com:
deploy_path: '~/example'
tasks:
build:
- cd: '{{release_path}}'
- run: 'npm run build'
after:
deploy:failed: deploy:unlock
```
YAML recipes can include recipes written in PHP. For example, some tasks maybe written in PHP and imported in YAML.
Also, other way around is possible: import YAML recipe from PHP. Use [import()](api.md#import) function for that.