Skip to content

Update documentation #168

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

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 47 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,60 @@
# Deploy Operations for Laravel
# 🚀 Laravel Deploy Operations

![the dragon code operations](https://preview.dragon-code.pro/the-dragon-code/deploy-operations.svg?brand=laravel&mode=dark)
![the dragon code laravel deploy operations](https://preview.dragon-code.pro/the-dragon-code/deploy-operations.svg?brand=laravel&mode=dark)

[![Stable Version][badge_stable]][link_packagist]
[![Total Downloads][badge_downloads]][link_packagist]
[![Github Workflow Status][badge_build]][link_build]
[![License][badge_license]][link_license]

> Operations are like version control for your operation process,
> allowing your team to modify and share the application's operational schema.
> If you have ever had to tell a teammate to manually perform any operation on a production server,
> you've come across an issue that operation solves.
⚡ **Performing any actions during the deployment process**

Create specific classes for a one-time or more-time usage, that can be executed automatically after each deployment.
Perfect for seeding or updating some data instantly after some database changes, feature updates, or perform any
actions.

This package is for you if...

- you regularly need to update specific data after you deploy new code
- you often perform jobs after deployment
- you sometimes forget to execute that one specific job and stuff gets crazy
- your code gets cluttered with jobs that are not being used anymore
- your co-workers always need to be reminded to execute that one job after some database changes
- you often seed or process data in a migration file (which is a big no-no!)

## Installation

```Bash
composer require dragon-code/laravel-deploy-operations
```

## Documentation

See the [documentation](https://deploy-operations.dragon-code.pro) for detailed installation and usage instructions.
📚 Read the full documentation at [deploy-operations.dragon-code.pro][link_website].

## Upgrade Guide
## Basic Usage

To upgrade from `Laravel Deploy Actions` versions 4 and 5 to `Deploy Operations`, read these guides:
Create your first operation using `php artisan make:operation` console command and define the actions it should
perform.

- [To 6.x from 5.x](https://deploy-operations.dragon-code.pro/prologue/upgrade-guide/6.x.html)
- [To 5.x from 4.x](https://deploy-operations.dragon-code.pro/prologue/upgrade-guide/5.x.html)
```php
use DragonCode\LaravelDeployOperations\Operation;

return new class extends Operation {
public function __invoke(): void
{
// any actions
}
};
```

Next, you can run the console command to start operations:

```Bash
php artisan operations
```

📚 [Check out the full documentation to learn everything that Laravel Deploy Operations has to offer.][link_website]

## License

Expand All @@ -34,10 +67,12 @@ This package is licensed under the [MIT License](LICENSE).

[badge_license]: https://img.shields.io/packagist/l/dragon-code/laravel-deploy-operations.svg?style=flat-square

[badge_stable]: https://img.shields.io/github/v/release/TheDragonCode/laravel-actions?label=stable&style=flat-square
[badge_stable]: https://img.shields.io/github/v/release/TheDragonCode/laravel-actions?label=packagist&style=flat-square

[link_build]: https://github.com/TheDragonCode/laravel-actions/actions

[link_license]: LICENSE

[link_packagist]: https://packagist.org/packages/dragon-code/laravel-deploy-operations

[link_website]: https://deploy-operations.dragon-code.pro
81 changes: 36 additions & 45 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ function getChildren(folder, sort = 'asc') {

return fs
.readdirSync(path.join(dir))
.filter(item =>
fs.statSync(path.join(dir, item)).isFile() &&
!names.includes(item.toLowerCase()) &&
extension.includes(path.extname(item))
)
.filter(item => fs.statSync(path.join(dir, item)).isFile() && !names.includes(item.toLowerCase()) && extension.includes(path.extname(item)))
.sort((a, b) => {
a = resolveNumeric(a)
b = resolveNumeric(b)
Expand All @@ -46,13 +42,10 @@ export default defineUserConfig({
bundler: viteBundler(),

lang: 'en-US',
title: 'Deploy Operations for Laravel',
description: 'Run operations after deployment - just like you do it with migrations!',
title: 'Laravel Deploy Operations',
description: 'Performing any actions during the deployment process',

head: [
['link', {rel: 'icon', href: `https://${hostname}/images/logo.svg`}],
['meta', {name: 'twitter:image', content: `https://${hostname}/images/logo.svg`}]
],
head: [['link', {rel: 'icon', href: `https://${hostname}/images/logo.svg`}]],

theme: defaultTheme({
hostname,
Expand All @@ -72,56 +65,54 @@ export default defineUserConfig({
navbar: [
{
text: '6.x',
children: [
{text: '6.x', link: '/getting-started/installation/index.md'},
{text: '5.x', link: 'https://github.com/TheDragonCode/laravel-deploy-operations/blob/5.x/docs/index.md'},
{text: '4.x', link: 'https://github.com/TheDragonCode/laravel-deploy-operations/blob/4.x/docs/index.md'},
{text: '3.x', link: 'https://github.com/TheDragonCode/laravel-deploy-operations/blob/3.x/docs/index.md'},
]
}
],

sidebarDepth: 1,

sidebar: [
{
text: 'Prologue',
children: [
{
text: 'Upgrade Guide',
link: '/prologue/upgrade-guide/index.md'
text: '6.x',
link: '/getting-started/installation.md'
},
{
text: 'License',
link: '/prologue/license.md'
}
text: '5.x',
link: 'https://github.com/TheDragonCode/laravel-deploy-operations/blob/5.x/docs/index.md'
}, {
text: '4.x',
link: 'https://github.com/TheDragonCode/laravel-deploy-operations/blob/4.x/docs/index.md'
}, {
text: '3.x',
link: 'https://github.com/TheDragonCode/laravel-deploy-operations/blob/3.x/docs/index.md'
},
]
},
}],

sidebarDepth: 1,

sidebar: [
{
text: 'Getting Started',
children: [
{
text: 'Installation',
link: '/getting-started/installation/index.md'
}
text: 'Getting Started', children: [
'/index.md',
'/getting-started/installation.md',
'/guide/basic.md',
'/upgrade-guide/index.md'
]
},

{
text: 'How To Use',
text: 'Guide',
children: [
'/how-to-use/running.md',
'/how-to-use/creating.md',
'/how-to-use/status.md',
'/how-to-use/rollback.md',
'/how-to-use/customize-stub.md',
'/guide/running.md',
'/guide/creating.md',
'/guide/status.md',
'/guide/rollback.md',
'/guide/customize-stub.md',
]
},

{
text: 'Helpers',
children: getChildren('helpers')
},
{
text: 'Extras',
children: [
'/extras/database-data-dumper.md'
]
}
]
})
Expand Down
File renamed without changes.
28 changes: 28 additions & 0 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Installation

## Install the package

All you need to do to get started is add `Deploy Operations` to your [composer](https://getcomposer.org) dependencies:

```bash
composer require dragon-code/laravel-deploy-operations
```

If necessary, you can publish the configuration file by calling the console command:
В случае необходимости

```bash
php artisan vendor:publish --tag=config --provider="DragonCode\LaravelDeployOperations\ServiceProvider"
```

## Publish the operation stub (optional)

You may publish the stub used by the `make:operation` command and/or [Laravel Idea](https://laravel-idea.com)
plugin for [JetBrains PhpStorm](https://www.jetbrains.com/phpstorm/) if you want to modify it.

```bash
php artisan vendor:publish --tag=stubs --provider="DragonCode\LaravelDeployOperations\ServiceProvider"
```

As a result, the file `stubs/deploy-operation.stub` will be created in the root of the project,
which you can change for yourself.
23 changes: 0 additions & 23 deletions docs/getting-started/installation/index.md

This file was deleted.

53 changes: 53 additions & 0 deletions docs/guide/basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Basic Usage

Create your first operation using `make:operation` command and define the actions it should perform.

```bash
php artisan make:operation
```

```php
use DragonCode\LaravelDeployOperations\Operation;

return new class extends Operation {
public function __invoke(): void
{
// any actions
}
};
```

Next, To run operations, execute the `operations` artisan command:

```bash
php artisan operations
```

The order in which operations are called is checked by file name in alphabetical order,
without taking into account directory names:

```bash
# actual file names
2022_10_14_000001_test1 # 1
2022_10_14_000004_test4 # 4
bar/2022_10_14_000003_test3 # 3
foo/2022_10_14_000002_test2 # 2
```

```bash
# order of running operations at startup
2022_10_14_000001_test1 # 1
foo/2022_10_14_000002_test2 # 2
bar/2022_10_14_000003_test3 # 3
2022_10_14_000004_test4 # 4
```

In addition to other options described in the "Guide" section, you can divide the execution of operations into
"before" and "after" certain actions.
For example, before and after restarting the queues:

```bash
php artisan operations --before
php artisn queue:restart
php artisan operations
```
File renamed without changes.
11 changes: 11 additions & 0 deletions docs/guide/customize-stub.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Customize Stub

You may publish the stub used by the `make:operation` command and/or [Laravel Idea](https://laravel-idea.com)
plugin for [JetBrains PhpStorm](https://www.jetbrains.com/phpstorm/) if you want to modify it.

```bash
php artisan vendor:publish --tag=stubs --provider="DragonCode\LaravelDeployOperations\ServiceProvider"
```

As a result, the file `stubs/deploy-operation.stub` will be created in the root of the project,
which you can change for yourself.
File renamed without changes.
Loading