Skip to content

Rocketeer

Here is an introduction to Rocketeer

There are two ways to install rocketeer with compiled archive or with composer

Once you use rocketeer ignite you will receive the following questions:

1.No connections have been set, please create one: (production)
2.No host is set for [production], please provide one: 
3.No username is set for [production], please provide one:
4.No password or SSH key is set for [production], which would you use? (key) [key/password]
5.Please enter the full path to your key ($PATHTOUSER/.ssh/id_rsa)
6.If a keyphrase is required, provide it
7.No repository is set for [repository], please provide one:
8.No username is set for [repository], please provide one:
9.No password is set for [repository], please provide one:
production/0 | Ignite (Creates Rocketeer's configuration)
10.What is your application's name ? ($USER)
The Rocketeer configuration was created at $USER/.rocketeer

Redacted

Configuration Files

Doing a Check on the server ready for your deployment

rocketeer check

Dry Run Example

A dry run will help check that your tasks and strategies appear correct before running them.

vendor/bin/rocketeer deploy --on="$YOURCONNECTION" --branch="$BRANCHNAME" --pretend --verbose

Key / Password Prompt

Depending on the way you are connecting to your server provide the key or password, the below example will use the users id_rsa key to connect via ssh.

No password or SSH key is set for [production/0], which would you use? (key) [key/password]
# Type key
Please enter the full path to your key ($PATHTOUSER/.ssh/id_rsa)
# Type Enter
If a keyphrase is required, provide it
# Type Enter

Setting up strategies

Tasks

To set up a task: - Create the task class in the folder .rocketeer/tasks/. - ```php <?php declare(strict_types=1);

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
    namespace Tasks;

    class TestTask extends \Rocketeer\Abstracts\AbstractTask
    {

        /**
         * Description of the Task
         *
         * @var string
         */
        protected $description = 'Test Task -- Add more description here...';

        /**
         * Run the task.
         *
         * @return void
         */
        public function execute()
        {
            $this->explainer->line('Running test task...');

            /* Run Test Task Function */

            $this->explainer->line('Successfully ran test task...');
        }

    }
  ```
  • Call the Tasks\TestTask::class, here we place it after the deploy step.

    • ```php // Tasks to execute before the core Rocketeer Tasks 'before' => array( 'setup' => array(), 'deploy' => array(), 'cleanup' => array(), ),

    // Tasks to execute after the core Rocketeer Tasks 'after' => array( 'setup' => array(), 'deploy' => array( Tasks\TestTask::class, ), 'cleanup' => array(), ), ```

Task - Functions

When working with setting up the tasks knowing the location of the task when it is executed is important. Rocketeer has some methods that allow you to run bash commands in the certain folders.

  • $this->runInCurrentRelease('$BASHCMD')
  • $this->run('$BASHCMD')

Getting the current connection: - $this->getConnection()->getName()

More methods from extending the AbstractTask The api docs - AbstractTask

Useful Example

Tutorial Breakdown of how to use Rocketeer