3. Debugging | Rocketeer Chinese document


Investigate failed deployments

If there is a problem with deployment and the default output is not helpful to you, you can do something. First, try running any command you are running with the -- verbose flag. This will show more information about what is happening.

The two main information added are the commands running on the server and what happens in real time on the server:

$ rocketeer deploy --verbose
|-- Running: Deploy (Deploys the website) [~14.25s]
|---- Running: Primer (Run local checks to ensure deploy can proceed)
|---- Running: CreateRelease (Creates a new release on the server) [~5.98s]
|------ Running strategy for Deploy: Sync
$ mkdir /home/www/myapp/releases/20140817160812
$ rsync ./ user@host:/home/www/myapp/releases/20140817160812 --verbose --recursive --rsh="ssh" --exclude=".git" --exclude="vendor"
[local] building file list ... done
[local] .gitattributes
[local] [...]
[local] sent 970690 bytes  received 1910 bytes  84573.91 bytes/sec
[local] total size is 964547  speedup is 0.99
|---- Running: Dependencies (Installs or update the dependencies on server) [~5.15s]
|------ Running strategy for Dependencies: Composer
$ cd /home/www/myapp/releases/20140817160812
$ /usr/local/bin/composer install --no-interaction --no-dev --prefer-dist
[user@host] (production) Loading composer repositories with package information
[user@host] (production) Installing dependencies from lock file
[user@host] (production) [...]
[user@host] (production)
[user@host] (production) Generating autoload files
[user@host] (production) Generating optimized class loader
[user@host] (production) Compiling common classes
[user@host] (production) Compiling views
|---- Running: Migrate (Migrates and/or seed the database) [~0.21s]
|------ Running strategy for Migrate: Artisan
$ rm -rf /home/www/myapp/current
$ ln -s /home/www/myapp/releases/20140817160812 /home/www/myapp/current
Successfully deployed release 20140817160812
|-- Running: Cleanup (Clean up old releases from the server) [~2.68s]
$ rm -rf /home/www/myapp/releases/20140817135635
Removing 1 release from the server
Execution time: 27.4618s

Investigate slow deployment

If your deployment seems unusually slow, I suggest you check the time displayed in parentheses next to each task name:

|---- Running: CreateRelease (Creates a new release on the server) [~5.98s]

This time is the average execution time of the task record. For example, if you deploy it twice in 10 seconds and 8 seconds, it will be displayed as [~ 8s]. This time is an estimate and does not represent the actual time of the task. It is only a prediction based on the previous deployment.

Investigate missing binaries, permissions issues, etc.

If you find that Rocketeer cannot execute a command, first, check whether you use the same certificate and whether you can execute the command manually. Rocketeer only does what you ask it to do. If there is a problem with your server that affects command execution, it will encounter the same problem.

However, Rocketeer has one biggest difference from you: by default, Rocketeer will run in a shell less session. This means that it will not log in using Bash or Zsh, which is problematic for some specific tools (such as RVM, NVM, etc.) loaded through. bashrc or. zshrc files.

To solve this problem, Rocketeer has an option to run some specific commands in the shell. You can configure it in the remote.php file:

// implement

// If enabled, the shell is forced to be created
// This is required for certain tools such as RVM or NVM
'shell'          => false,

// A series of commands that run under the shell
'shelled'        => ['npm ', 'bundle ', 'grunt'],

Just enable the shell option and add any commands you need to log in to the array. They match the command, which means that it can only match part of the command to be executed.

This article was first published in LearnKu.com On the website.

Posted on Fri, 03 Dec 2021 04:08:54 -0500 by android6011