Skip to content

Let deployer take care of your dev/staging Laravel sites.

License

Notifications You must be signed in to change notification settings

rockero-cz/laravel-forge-deployer

Repository files navigation

Banner

Laravel Forge Deployer

Rockero Software License

Our deployer simplifies management of your staging and development client sites on your Forge server by allowing easy deployment of dev/staging branches and pull requests.

If your repository's site does not exist in Forge, our deployer will automatically create the site and handle the initial setup with repository, database, and environment.

URL examples of deployed applications:

For main branch:

https://{your-application}.dev.{your-domain}.com

For staging branch:

https://{your-application}.staging.{your-domain}.com

For pull requests:

https://{your-application}-{pull-request-number}.dev.{your-domain}.com

Setup

  1. Begin by creating a new repository in your GitHub account and use this repostitory as the template.

  2. Next, create a new Forge site for the deployer and perform the initial deployment.

  3. To configure your project, please fill in the required values for your .env file below:

# Your custom deployer token for requests verification, you will use it in GitHub workflows.
DEPLOYER_TOKEN=

# Credentials of your `Forge` and also ID of the server, where you would like to have your dev/staging sites.
FORGE_API_KEY=
FORGE_SERVER_ID=
FORGE_DOMAIN=

# GitHub tokens are used to automatically add comments with application URLs to your pull requests.
GITHUB_OWNER=
GITHUB_TOKEN=
  1. Add the following job to your GitHub workflows using the code below:
deploy:
    runs-on: ubuntu-latest

    steps:
        - name: Deployment
        uses: fjogeleit/http-request-action@master
        with:
            url: "http://your-deployer.com/deploy/${{ github.event.repository.name }}/event/${{ github.event_name }}"
            method: "POST"
            bearerToken: ${{ secrets.YOUR_DEPLOYER_TOKEN }}
            timeout: 600000
            data: '{"branch": "${{ github.ref_name }}", "number": "${{ github.event.pull_request.number }}"}'

The deployer is now ready to deploy your commits upon request. Happy deploying!