Generate GitHub pull request preview deployments with Laravel Forge

Overview

Forge Previewer

WARNING: This package is not ready for production usage. Use at your own risk.

This package provides a forge-previewer command that can be used to generate pull request review deployments for your GitHub pull requests using Laravel Forge.

The command is designed to be executed inside of a GitHub Action workflow, either when a pull request is opened or using a third-party action to trigger a workflow.

It will do the following things to generate a preview deployment:

  1. Connect to Forge using an API token.
  2. Try to find an existing site for the pull request. If it can't find one, it will create one.
  3. Tell Forge to use the specified repository and branch as the deployment source.
  4. Enable Quick Deploy to ensure any changes to the pull request are automatically deployed.
  5. Try to find an existing database for the pull request. If it can't find one, it will create one.
  6. Creates a database user and generates a random password.
  7. Updates the site's environment file to point to the database, using the generated database user and password.
  8. Attempts to generate an SSL certificate for the domain.
  9. Freshly migrates the database and seeds it using the default DatabaseSeeder.
Comments
  • Disabling the

    Disabling the "composer install dependencies" option

    Good afternoon,

    Can you tell me if it is possible to disable "Install Dependencies"? When creating a new site this option is enabled by default, and through the use of the application I have not found a way to turn it off, does it exist at all? Because it is possible to get this error (below) if the repository does not contain the specified components.

    Composer could not find a composer.json file in /home/forge/***
    To initialize a project, please create a composer.json file.
    
    opened by HillReywer 3
  • Support GitHub actions output

    Support GitHub actions output

    opened by Illizian 3
  • Support preventing the database setup

    Support preventing the database setup

    I noted an issue with the updateSiteEnvironmentFile when using no environment file.

    This should be investigated, as I'm not sure if it's a bug (I did try adding these to my test projects when deploying) so not sure if this is an issue on all first setups for a site.

    A solution is to add a flag to prevent this behaviour:

    {--no-database : Avoid creating a database.}
    
    opened by Illizian 2
  • Support site isolation

    Support site isolation

    We can use the site isolation parameter of the API. This is important for public repo's and ensures security by preventing access to other sites.

    Pseudocode: at https://github.com/ryangjchandler/forge-previewer/blob/main/app/Commands/DeployCommand.php#L177

    -        $site = $this->forge->createSite($server->id, [
    +        $data = [
                 'domain' => $domain,
                 'project_type' => 'php',
                 'php_version' => $this->option('php-version'),
                 'directory' => '/public'
    -        ]);
    +        ];
    +
    +        if (!$this->option('no-isolation')) {
    +            $this->information('Enabling site isolation');
    +
    +            $data['isolation'] = true;
    +            $data['username'] = str($this->getBranchName())->slug();
    +        }
    +
    +        $site = $this->forge->createSite($server->id, $data);
     
             $this->information('Installing Git repository');
    
    enhancement 
    opened by Illizian 1
  • Add support for configuration file

    Add support for configuration file

    Something like a previewer.yml file or similar. Removes the need to specify flags on the command, can just do forge-previewer deploy --config=.previewer.yml or something instead.

    enhancement 
    opened by ryangjchandler 0
Releases(v0.2.0)
  • v0.2.0(Jul 13, 2022)

    What's Changed

    • Adds support for outputting to GitHub Actions by @Illizian in https://github.com/ryangjchandler/forge-previewer/pull/13
    • Enable site isolation by default when deploying by @Illizian in https://github.com/ryangjchandler/forge-previewer/pull/10
    • Adds a flag to prevent database (& dotenv presumptions) by @Illizian in https://github.com/ryangjchandler/forge-previewer/pull/12

    New Contributors

    • @Illizian made their first contribution in https://github.com/ryangjchandler/forge-previewer/pull/13

    Full Changelog: https://github.com/ryangjchandler/forge-previewer/compare/v0.1.3...v0.2.0

    Source code(tar.gz)
    Source code(zip)
  • v0.1.3(Jun 13, 2022)

  • v0.1.2(Jun 13, 2022)

    What's Changed

    • deploy: supply env changes in flag by @ryangjchandler in https://github.com/ryangjchandler/forge-previewer/pull/7

    New Contributors

    • @ryangjchandler made their first contribution in https://github.com/ryangjchandler/forge-previewer/pull/7

    Full Changelog: https://github.com/ryangjchandler/forge-previewer/compare/v0.1.1...v0.1.2

    Source code(tar.gz)
    Source code(zip)
  • v0.1.1(Jun 13, 2022)

  • v0.1.0(Jun 13, 2022)

  • v0.0.2(Jun 13, 2022)

  • v0.0.1(Jun 12, 2022)

Owner
Ryan Chandler
Ryan Chandler
This Package helps you in laravel application to log all desired activity for each request from request entry point to generate response at a single snapshot.

Laravel Scenario Logger This Package helps you in laravel application to log all desired activity for each request from request entry point to generat

Mehrdad Mahdian 6 Sep 27, 2021
Boilerplate code for protecting a form with proof of work. Uses javascript in the browser to generate the hashcash and PHP on the server to generate the puzzle and validate the proof of work.

Boilerplate code for protecting a form with proof of work. Uses javascript in the browser to generate the hashcash and PHP on the server to generate the puzzle and validate the proof of work.

Jameson Lopp 28 Dec 19, 2022
Generate trends for your models. Easily generate charts or reports.

Laravel Trend Generate trends for your models. Easily generate charts or reports. Support us Like our work? You can support us by purchasing one of ou

Flowframe 139 Dec 27, 2022
Laravel Logable is a simple way to log http request in your Laravel application.

Laravel Logable is a simple way to log http request in your Laravel application. Requirements php >= 7.4 Laravel version >= 6.0 Installation composer

Sagar 6 Aug 25, 2022
Easily capture every incoming request and the corresponding outgoing response in your Laravel app.

Easily capture every incoming request and the corresponding outgoing response in your Laravel app. This package is designed to work only with the Lara

Mark Townsend 22 Nov 15, 2022
laravel zibal - transaction request package for zibal

laravel zibal transaction request package for zibal Getting Started To get a local copy up and running follow these simple steps. Installation You can

Abbas mkhzomi 4 Jan 10, 2022
This package can use form request just as Laravel do.

Lumen Form Request This package can use form request just as Laravel do. Installation Install by composer $ composer require chhw/form-request In

null 2 Nov 17, 2021
đź––Repository Pattern in Laravel. The package allows to filter by request out-of-the-box, as well as to integrate customized criteria and any kind of filters.

Repository Repository Pattern in Laravel. The package allows to filter by request out-of-the-box, as well as to integrate customized criteria and any

Awes.io 160 Dec 26, 2022
Easy way to upload Laravel model related files from the request.

Easy way to upload laravel model related file from the requset.

Emon Khan 5 Dec 15, 2022
Easily validate data attributes through a remote request

Laravel Remote Rule Easily validate data attributes through a remote request. This package allows you to define a subset of custom rules to validate a

H-FARM Innovation 27 Nov 20, 2022
Filter resources with request parameters

FilterWhere Filter resources with request parameters Author: Thomas Jakobi [email protected] License: GNU GPLv2 Features With this MODX Revolu

Thomas Jakobi 1 Jul 12, 2022
This is a solution implementation for the coderbyte question, CLEAN GET REQUEST RESULT.

This is a solution implementation for the coderbyte question, CLEAN GET REQUEST RESULT. Two solutions are proposed, the first is a brute force approach while the other is an improved time complexity solution.

null 3 May 23, 2022
PHP Simple Response, XML, JSON,... auto response with accept in request's header

simple-response Simple package to handle response properly in your API. This package does not include any dependency. Install Via Composer $ composer

Phuong Danh 3 Dec 8, 2021
Symfony bundle that provides Cross Site Request Forgery (CSRF or XSRF) protection for client-side applications

CSRF Cookie Bundle This Symfony bundle provides Cross Site Request Forgery (CSRF or XSRF) protection for client-side applications requesting endpoints

David Neustadt 8 Nov 28, 2022
Simple solution for form request validation on lumen.

Form Request Validation for Lumen This small package contains a laravel-like solution for request form validation. Contents Form Request Validation fo

Samuel Nunes de Souza 5 Nov 4, 2022
Livewire trait (throttling). Limiting request processing speed

Livewire Throttling Installation You can install the package via composer: composer require f1uder/livewire-throttling Usage Livewire component <?php

Fluder 5 Dec 7, 2022
Llum illuminates your Laravel projects speeding up your Github/Laravel development workflow

Llum illuminates your Laravel projects speeding up your Github/Laravel development workflow

Sergi Tur Badenas 110 Dec 25, 2022
Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously github.com/hyn/multi-tenant

The unobtrusive Laravel package that makes your app multi tenant. Serving multiple websites, each with one or more hostnames from the same codebase. B

Tenancy 2.4k Jan 3, 2023
Github repository dedicated for my YT tutorial which shows how to use testing in Laravel

Testing in Laravel The following documentation is based on my Laravel Testing for Beginners tutorial we’re going to cover the basics of unit tests, fe

Code With Dary 17 Oct 24, 2022