From ba3d3c2469a3d3081af66579e63c7e91373db5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Mon, 19 Aug 2019 16:05:32 +0200 Subject: [PATCH] Add jobs & horizon pages --- navigation.php | 6 ++++++ source/docs/horizon.md | 18 ++++++++++++++++++ source/docs/jobs-queues.md | 23 +++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 source/docs/horizon.md create mode 100644 source/docs/jobs-queues.md diff --git a/navigation.php b/navigation.php index 4e43824f..7972ff0c 100644 --- a/navigation.php +++ b/navigation.php @@ -26,12 +26,18 @@ return [ 'Middleware Configuration' => 'docs/middleware-configuration', 'Custom Database Names' => 'docs/custom-database-names', 'Filesystem Tenancy' => 'docs/filesystem-tenancy', + 'Jobs & Queues' => 'docs/jobs-queues', 'Event System' => 'docs/event-system', 'Tenancy Initialization' => 'docs/tenancy-initialization', 'Writing Storage Drivers' => 'docs/writing-storage-drivers', 'Development' => 'docs/development', ], ], + 'Integrations' => [ + 'children' => [ + 'Horizon' => 'docs/horizon', + ], + ], 'Tips' => [ 'children' => [ 'HTTPS Certificates' => 'docs/https-certificates', diff --git a/source/docs/horizon.md b/source/docs/horizon.md new file mode 100644 index 00000000..38f35820 --- /dev/null +++ b/source/docs/horizon.md @@ -0,0 +1,18 @@ +--- +title: Horizon Integration +description: Horizon Integration with stancl/tenancy — A Laravel multi-database tenancy package that respects your code.. +extends: _layouts.documentation +section: content +--- + +# Horizon Integration + +> Make sure your queue is [correctly configured](/docs/jobs-queues) before using Horizon. + +Jobs are automatically tagged with the tenant's uuid and domain: + +![UUID and domain tags](https://i.imgur.com/K2oWTJc.png) + +You can use these tags to monitor specific tenants' jobs: + +![Monitoring tags](https://i.imgur.com/qB6veK7.png) \ No newline at end of file diff --git a/source/docs/jobs-queues.md b/source/docs/jobs-queues.md new file mode 100644 index 00000000..8053da9c --- /dev/null +++ b/source/docs/jobs-queues.md @@ -0,0 +1,23 @@ +--- +title: Jobs & Queues +description: Jobs & Queues with stancl/tenancy — A Laravel multi-database tenancy package that respects your code.. +extends: _layouts.documentation +section: content +--- + +# Jobs & Queues {#jobs-queues} + +Jobs are automatically multi-tenant, which means that if a job is dispatched while tenant A is initialized, the job will operate with tenant A's database, cache, filesystem, and Redis. + +**However**, if you're using the `database` or `redis` queue driver, you have to make a small tweak to your queue configuration. + +Open `config/queue.php` and make sure your queue driver has an explicitly set connection. Otherwise it would use the default one, which would cause issues, since `database.default` is changed by the package and Redis connections are prefixed. + +**If you're using `database`, add a new line to `queue.connections.database`:** +```php +'connection' => 'mysql', +``` + +where `'mysql'` is the name of your non-tenant database connection with a `jobs` table. + +**If you're using Redis, make sure its `'connection'` is not in `tenancy.redis.prefixed_connections`.** \ No newline at end of file