Deployment is the process in which your code is downloaded from a source control provider onto your server, ready for the world to access. FlashVPS shows deployments as a table, a table showing what (logs) was deployed, when it was deployed, and how long it took to deploy.
Some applications, such as those created with the Laravel Framework, may require files .env
to configure settings such as databases and caching. You can create and edit your Environment files in the management console of the FlashVPS site.
At the site management console > Select.env
! Automatic Environment Files
If your project contains a.env.example
, FlashVPS will automatically copy this file and replace some settings to match your server's database settings. Empty files.env.example
can result in empty environment files on first deployment.
FlashVPS's 'Auto Deployment' feature allows you to easily deploy your projects as you push code to your source control provider. When you push to your configured deployment branch, FlashVPS will pull your latest code from source control and run your application's configured deployment script. You can enable FlashVPS auto-deployment by following:
Tự động triển khai
Bật tự động triển khai
The commands that are executed on your server when your project is deployed are determined by your site's deployment script. Of course, this deployment script can be edited directly in the FlashVPS UI.
FlashVPS provides a number of variables for you to use easily
FLASHVPS_SITE_ROOT='/đường-dẫn/đến/yoursite.com' FLASHVPS_CODE_BRANCH='siteBranch' FLASHVPS_PHP='your-phpVersion' FLASHVPS_PHP_FPM='your-phpVersion-fpm'
By default, your site's deployment script will:
cd $FLASHVPS_SITE_ROOT git pull origin $FLASHVPS_CODE_BRANCH echo 'Restarting FPM...'; sudo -S service $FLASHVPS_PHP_FPM reload
! Zero Downtime Deployments
Implementations may make your site unavailable for a moment. If you want a website with no delays in rollout, check out Envoyer
If you have multiple versions of PHP installed on your server, your deployment script may need to be updated to use the correct PHP version.
By default, php
will always point to the active PHP version used on the CLI. If you need to use a different version of PHP, you must use phpx.x
which x.x
corresponds to the version used (e.g. php8.1
) when calling PHP commands.
Deployment scripts for newly created sites use the $FLASVHPS_PHP environment variable. This environment variable will always contain the name of the current PHP version configured for the site, so no additional changes are needed to your deployment script when using this variable and when switching your PHP version. your website.
FlashVPS will automatically include the following environment variables in your deployment script at runtime:
Variable | Description |
---|---|
FLASHVPS_PHP_FPM |
The PHP-FPM process name being used by FlashVPS. |
FLASHVPS_PHP |
The PHP version being used by the website or the FlashVPS server. |
FLASHVPS_CODE_BRANCH |
The name of the branch to be deployed. |
FLASHVPS_SITE_ROOT |
The root of the deployment path, for example:/home/flashvps/mysite.com |
So far, we've discussed deploying FlashVPS sites from the FlashVPS UI or by using FlashVPS' 'Auto Deployment' feature. However, you can also deploy them from the CI platform of your choice.
To do FlashVPS implementation from CI platform you can use Triển khai từ CI
.
URL Tự động kích hoạt triển khai
Làm mới mã thông báo triển khai
You can do the deployment at any time by instructing your CI platform to make the request GET
or POST
to the URL shown in your site details.
While you can refresh the site token at any time, you'll need to update any services that are using this URL after refreshing the token.
You can change the deployed branch for your site by updating the deployment branch settings. Once you've updated the deployment branch, you'll then need to select Deploy Now to manually enable a new deployment for the new deployment branch.
Steps to update nhánh triển khai
:
Cập nhật nhánh triển khai
Cập nhật
Steps to activate triển khai ngay
it manually:
Triển khai và Lịch sử
Triển khai ngay
Updating Git Remote from the site management console will update the Git Remote URL on your server; however, the site will not be deleted or unavailable during this process. An updated Git Remote must contain the same Git repository/history as the one currently installed.
You should not use this function to install a completely different project on a website. If you want to install a completely different project, you should completely uninstall the existing repository using the 'Remove Code' button in the Site Management Console.
Steps to update Git Remote
:
Cập nhật Git Remote
Cập nhật
Steps to Xóa code
:
Xóa code
Xóa code