what is laravel forge
laravel forge is a tool that makes PHP deployment a breeze, it allows users to use Git and some popular server providers to launch cloud servers and handle the deployment process. Laravel Forge has a lot of features and an easy-to-use UI that allows users to easily create and configure servers and deploy applications; after configuring the service provider, there is a high possibility that users can manage the server again without accessing the AWS console.
The operating environment of this tutorial: Windows 7 system, Laravel 9 version, DELL G3 computer.
What is laravel forge
Laravel Forge is a tool that makes PHP deployment a breeze. It has tons of features and an easy-to-use UI that allows you to easily create and configure servers and deploy applications. After configuring the service provider, there is a good chance that you will be able to manage the server again without accessing the AWS console.
Laravel Forge allows you to use Git and some popular server providers to launch cloud servers and handle the deployment process. The process is explained below:
First, you need to connect AWS or any other cloud provider to your Forge account. Next, link your source control (such as GitHub) to Forge. You can now create the server. Install the source control repository on the server. Finally, press the deploy button. Easy enough?
Server configured with Laravel Forge comes with the following stack:
Ubuntu 16.06
Nginx
PHP 7.2/7.1/7.0/5.6
MySQL/MariaDB/Postgres
Redis
Memcached
After creating the server, you can configure it further.
When you sign up, you can choose from the different plans they offer. I chose the $12/month Basic plan; however, you get a free trial with access to everything on the list for five days.
After logging in, you will see the following content.
You can choose Digital Ocean, AWS, Linode and Vultr for service providers. Alternatively, you can use Forge and a custom VPC. As for source code control, Forge supports GitHub, GitLab, and Bitbucket. In this tutorial, I will discuss the basics of configuring AWS to use Forge and GitHub for source code management. Once completed, you will be able to create and configure any number of servers.
If you are using another service provider on the list, you can skip this step and contact us later after we configure AWS and Laravel Forge.
Setting up Laravel Forge and AWS
To set up Forge and AWS, you need to perform the following steps.
1. Log in to Laravel Forge
Log in to Laravel Forge and select AWS as the service provider. You will be asked to enter the Key ID (Key) and Key Access Key (Key). You need to create a specific IAM user with a policy that provides sufficient access to Laravel Forge. IAM is Amazon's way of mapping permissions for each user, so if any issues arise, you can revoke access.
2. Create a new IAM user
Log in to the AWS Console and create a new IAM user.
# Give the user a meaningful name and check the Programmatic Access box.
3. Select the correct policy
Set the correct permissions for the laravel-forge IAM user. Create a new user group as user groups are ideal for managing permissions. Now the natural question is, "What policies should the fake user have access to?" While you could use AdministratorAccess to provide it, you shouldn't.
If you need Forge to create and configure servers on your behalf, you need to add two policies:
AmazonEC2FullAccess
AmazonVPCFulAccess
4. Save the credentials and confirm
Confirm the IAM account, on the next page you will Find the access key and password.
Go to the Laravel Forge page and paste it there. That’s all.
5. Link your GitHub account to Forge
If you haven’t done so already, connect your GitHub/Bitbucket account to Forge. Forge will add the public key to your account when you create the server. If you need to add new service providers and/or update source control, you can add these options in your profile.
Deploy now and deploy quickly
To deploy, you can deploy manually using the "Deploy Now" button. Alternatively, you can enable the Quick Deployment option, which automatically deploys your project when you push your code to the master branch of your chosen GitHub repository.
Deployment script
The default deployment script pulls the code from the repository, installs dependencies, starts the server, and deploys the application every time when running the migration. This is the actual deployment script.
cd /home/forge/redmonark.com git pull origin laravelapi composer install --no-interaction --prefer-dist --optimize-autoloader echo "" | sudo -S service php7.2-fpm reload if [ -f artisan ] then php artisan migrate --force fi
If you need to tweak it and add extra stuff, you can.
[Related recommendations: laravel video tutorial]
The above is the detailed content of what is laravel forge. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Method for obtaining the return code when Laravel email sending fails. When using Laravel to develop applications, you often encounter situations where you need to send verification codes. And in reality...

How to implement the table function of custom click to add data in dcatadmin (laravel-admin) When using dcat...

The impact of sharing of Redis connections in Laravel framework and select methods When using Laravel framework and Redis, developers may encounter a problem: through configuration...

Custom tenant database connection in Laravel multi-tenant extension package stancl/tenancy When building multi-tenant applications using Laravel multi-tenant extension package stancl/tenancy,...

LaravelEloquent Model Retrieval: Easily obtaining database data EloquentORM provides a concise and easy-to-understand way to operate the database. This article will introduce various Eloquent model search techniques in detail to help you obtain data from the database efficiently. 1. Get all records. Use the all() method to get all records in the database table: useApp\Models\Post;$posts=Post::all(); This will return a collection. You can access data using foreach loop or other collection methods: foreach($postsas$post){echo$post->

How to check the validity of Redis connections in Laravel6 projects is a common problem, especially when projects rely on Redis for business processing. The following is...

A problem of duplicate class definition during Laravel database migration occurs. When using the Laravel framework for database migration, developers may encounter "classes have been used...

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.
