HOW TO DEPLOY?
In the example below, we will use Laravel Deployer for Laravel 7.x but the steps to follow are the same for Laravel 5.8 and 6.x.
Suppose that the application folder is called "Laravel7" and the application name "MyApp".
1- Checking server requirements
Open the www.your-domain.com/laravel-deployer/ link in your browser, you should have like this:
- PHP version : 7.2.31Sufficient
- Apache mod rewriteEnabled
- BCMath PHP ExtensionEnabled
- Ctype PHP ExtensionEnabled
- Fileinfo PHP ExtensionEnabled
- JSON PHP ExtensionEnabled
- Mbstring PHP ExtensionEnabled
- OpenSSL PHP ExtensionEnabled
- PDO PHP ExtensionEnabled
- Tokenizer PHP ExtensionEnabled
- XML PHP ExtensionEnabled
Your server meets the requirements of Laravel 7.x. You can continue the deployment. Please read the note below.
For the next step, you should have the following information:
- Mysql database host
- Mysql database port
- Database name
- Database username
- Database password
- Smtp host
- Smtp port
- Smtp username
- Smtp password
- Email encryption (ssl or tls)
If you see an error message, do the necessary by configuring your server. If all goes well, click on "Next step"
2- Creation of the .env file
Environment configuration file form [.env]
Please read carefully:
- Do not use "#" and "/*" in all fields. This can cause errors
- All fields are required
- You can add other keys and values to the [.env] file after deployment
Fill out the form and click on "Create [.env] file". You should have this:
Environment configuration file [.env]
The environment configuration file [../Laravel7/.env] was successfully createdNext step : Preparation of various files
Click on "Next step : Preparation of various files".
3- Preparing various files
Preparing various files
[../Laravel7/app/Providers/AppServiceProvider.php] file has been edited
Laravel Deployer's routes added
Laravel Deployer controller file added
Laravel Deployer's view file addedNext step : Clear caches
Click on "Next step : Clear caches".
4- Removing caches, migrate tables and seed database
Configuration cache cleared!
Application cache cleared!
Route cache cleared!
Compiled views cleared!
Next step : Migrate tables
Click on "Next step : Migrate tables". You should have this:
Migration table created successfully.
Migrated: 2014_10_12_000000_create_users_table (0.02 seconds)
Migrated: 2014_10_12_100000_create_password_resets_table (0.02 seconds)
Migrated: 2019_08_19_000000_create_failed_jobs_table (0.02 seconds)
Next step : Seed database
Click on "Next step : Seed database".
Database seeding completed successfully.
Create a symbolic link
Do you want to create a symbolic link (symlink) from [/home/user/public_html/Laravel7/public/storage] to [/home/user/public_html/Laravel7/storage/app/public] ?
It is recommended to create a symbolic link to allow access to the files in the "storage" folder of your application.
Yes ! Create a symlik
Do not create a symlink. Go to the next step
It is recommended that you create a symbolic link for accessing files in your application's
"storage" folder. If you want to create a symbolic link, click on "Yes ! Create a symlink". Otherwise, click "Do not create a symlink. Go to the next step", you will skip a step.
6- Create symlink (If you clicked on "Yes! Create a symlink")
If you need information, read the Laravel 7.x documentation: https://laravel.com/docs/7.x/filesystem#the-public-disk
The [/home/user/public_html/Laravel7/public/storage] link has been connected to [/home/user/public_html/Laravel7/storage/app/public].
The links have been created.
Next step : Delete deployment files
Click on "Next step : Delete deployment files", this will delete the Laravel Deployer files in your application.
7- Configuration of the [.htaccess] file
The application has been switched to production mode
Laravel Deployer's routes have been removed
Laravel Deployer's controller file have been removed
Laravel Deployer's view file have been removed
Configuration of the [.htaccess] file
Choose "yes" or "no" depending on your server configuration. Click on "Submit". Deployment is complete.
End of deployment
Deployment is complete. Do not forget to delete the "laravel-deployer" folder.Go to your website
Delete the "laravel-deployer" folder from your server.
Want to see examples of deployment done with Laravel Deployer? See here.