Deployment
Sites

Deployment

  • 2023-01-22 12:11:29

Introduce

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.Deployment 0

Environment

Some applications, such as those created with the Laravel Framework, may require files .envto 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 Deployment 1 Deployment 2

! 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.examplecan result in empty environment files on first deployment.

Automated 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:

  1. At the site management console > SelectTự động triển khai Deployment 3 Deployment 4
  2. SelectBật tự động triển khai

Deployment script

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

PHP Versions

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, phpwill 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.xwhich x.xcorresponds 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.

Environment variables

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

Deployment from CI

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.

  1. At the site management console > SelectURL Tự động kích hoạt triển khai Deployment 5 Deployment 6
  2. SelectLàm mới mã thông báo triển khai

Use Deployment Trigger

You can do the deployment at any time by instructing your CI platform to make the request GETor POSTto 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.

Deployment branch

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:

  1. At the site management console > SelectCập nhật nhánh triển khai Deployment 7
  2. Enter the branch name to changeDeployment 8
  3. SelectCập nhật

Steps to activate triển khai ngayit manually:

  1. At the site management console > SelectTriển khai và Lịch sử Deployment 9
  2. SelectTriển khai ngay Deployment 10

Git Remote

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:

  1. At the site management console > SelectCập nhật Git Remote Deployment 11
  2. Change the provider or the full path of the repository.Deployment 12
  3. SelectCập nhật

Steps to Xóa code:

  1. At the site management console > SelectXóa code Deployment 13
  2. SelectXóa code Deployment 14
Author FlashVPS Admin
FlashVPS Admin
Joined in 3 years ago