Hide

YetaWF Documentation

Display
Print

DeploySite yaml File

Yaml File Syntax

Databases:
  - DevDB:        database name (development system)
    DevServer:    SQL server (development system)
    DevUsername:  user login - SQL server (development system)
    DevPassword:  password - SQL server (development system)
    ProdDB:       database name (production system)
    ProdServer:   SQL server (production system)
    ProdUsername: user login - SQL server (production system)
    ProdPassword: password - SQL server (production system)
    ...repeated...

Deploy:
  Type:           { zip | folder }
  To:             { path to target folder | zip file (absolute path) }
  BaseFolder:     solution folder (YetaWF *.sln file location, absolute path)
  From:           absolute path to published website created by Visual Studio Publish or dotnet publish
  ConfigParm:     modifier used for AppSettings.json, web.config, etc.
  Localization:   { true | false }
  SiteTemplates:  { true | false }
  DetermineBlueGreen: https://yoursite.com/_hc.html
  BlueRegex: \<body\>Blue\<\/body\>
  GreenRegex: \<body\>Green\<\/body\>

FTP:
  Server:         ftp://yourserver
  Port:           port
  User:           FTP user login
  Password:       FTP user password
  FTPCopy:
    - From:       file name or folder (development system)
      To:         file name or folder (production system)
      ReplaceBG:  { true | false }
      Conditional: { true | false }
      ...repeated...

Local:
  PublishFolder:  publish folder (complete site)
  LocalCopy:
    - From:       file name or folder (development system)
      To:         file name or folder (production system)
      ReplaceBG:  { true | false }
      ...repeated...

Site:
  Location:       target folder for deployed site (absolute path, production system)
  Zip:            absolute path to uploaded ZIP file
  Maintenance:    { true | false }
  SiteRunFirst:
    - Command:    command to run
      IgnoreErrors: { true | false }
      ...repeated...
  SiteRun:
    - Command:    command to run
      IgnoreErrors: { true | false }
      ...repeated...

Databases

The Databases tag defines 0 or more databases which are backed up and/or restored as part of the deploy. Deploying databases is completely optional and the Databases tag can be omitted.

The information for each database can usually be copied from the connection strings used to connect to the database.

TagRequiredDescription
DevDByesDefines the database name on the development system. This is the database that is being backed up.
DevServeryesDefines the SQL server name on the development system. This is usually "localhost" for a local SQL server instance.
DevUsernameyesDefines the user login name to sign on the development system's SQL server. The user must have sufficient permission to back up a database.
DevPasswordyesDefines the user's password to sign on the development system's SQL server.
ProdDByesDefines the database name on the target system where the site is deployed. This is the database that is being restored.
ProdServeryesDefines the SQL server name on the target system where the site is deployed.
ProdUsernameyesDefines the user login name to sign on the target system's SQL server. The user must have sufficient permission to restore a database.
ProdPasswordyesDefines the user's password to sign on the target system's SQL server.

When a database is restored, it is created in the target folder (Deploy:To) in a subfolder named DBs. Any existing database is replaced. If the database doesn't exist, it is automatically created.

Deploy

The Deploy tag defines the development system that is used to deploy the site.

A site can be deployed as a ZIP file to be restored on the server using DeploySite, or it can be deployed to a local folder. From there it can be deployed to a server using your favorite deployment tool.

TagRequiredDescription
TypeyesDefines the deployment method, either as a ZIP file (zip) or to a local folder (folder).
ToyesDefines the deployment target, either a ZIP file (Deploy:Type = zip) or a local folder (Deploy:Type = folder). If a ZIP file is specified, it must be an absolute path with file name. If a local folder is specified, it must be an absolute path. If the folder doesn't exist, it is automatically created.
BaseFolderyesDefines the absolute path to the YetaWF folder containing the solution file (*.sln) for the site to be deployed.
FromMVC6 onlyBefore deploying a site it must be published with Visual Studio Publish or dotnet publish. The published output must be specified using this From tag as an absolute path. The published output is merged with other required files/folders and added to the target ZIP of folder where the final deployed site is created.
ConfigParmno, default nullDefines the file name for all configuration files (app.config, AppSettings.json, hosting.json, web.config). When specified, the specified ConfigParm string is added to the config file name before the extension. The ConfigParm string can contain periods. For example, when ConfigParm Prod is specified, the files app.Prod.config, AppSettings.Prod.json, hosting.Prod.json and Web.Prod.config are copied for deployment and are named app.config, AppSettings.json, hosting.json, web.config on the deployed site. If one of the files app.Prod.config, AppSettings.Prod.json, hosting.Prod.json or Web.Prod.config does not exist on the development system, the matching file (without the ConfigParm string) is copied instead.
Localizationno, default falseDefines whether localization resources are deployed. Localization resources are only required if Application.P.YetaWF_Core.Use-Localization-Resources is set to true in AppSettings.json to enable multi-language support.
SiteTemplatesno, default falseDefines whether site templates are deployed. This is only required if additional sites (domains) are created on a deployed site. This is rarely used.
DetermineBlueGreennoThe specified URL is used to find which site (Blue or Green) is currently running. YetaWF uses a healthcheck file (_hc.html) which contains the current site mode (Blue or Green). This option can only be specified for Blue/Green deployment.
BlueRegexnoDefines a regular expression that must be matched by the data retrieved from the URL defined by DetermineBlueGreen. If the expression matches the data, the Green site is deployed (as the Blue site is currently running).
GreenRegexnoDefines a regular expression that must be matched by the data retrieved from the URL defined by DetermineBlueGreen. If the expression matches the data, the Blue site is deployed (as the Green site is currently running).

FTP

The FTP tag defines how a site is deployed/uploaded to the server using FTP. This is only used if a ZIP file is created (Deploy:Type = zip) and is otherwise ignored.

TagRequiredDescription
ServeryesDefines the FTP server. Must start with "ftp://".
Portno, default 21Defines the FTP server port.
UseryesDefines user login to sign on to the FTP server.
PasswordyesDefines user password to sign on to the FTP server.

FTP:Copy

The Copy tag defines a list of files/folders to be uploaded. The ZIP file and the DeploySite utility must be explicitly listed in Copy tags as they are not automatically uploaded. Multiple files/folders can be uploaded by adding multiple Copy list items.

TagRequiredDescription
FromyesDefines a file or folder on the development system either as an absolute path or a relative path (to Deploy:BaseFolder). This file is uploaded to the server (Copy:To).
ToyesDefines a file or folder on the target system as an absolute path (must start with "/") and is uploaded to the server.
ReplaceBGno, default falseDefines whether {BlueGreen} tags are replaced with the current Blue/Green deployment type. See Blue/Green Tags for more information.
Conditionalno, default falseDefines whether the file is only uploaded if its date/time stamp is newer than the file on the server and if its size is different. This is ignored when uploading folders and only applies to files. When uploading large files such as the DeploySite utility, Conditional should be set to true.

Local

The Local tag defines how a site is deployed to a folder. This is only used if a ZIP file is created (Deploy:Type = zip) and is otherwise ignored. The Local tag is typically used instead of the FTP tag when FTP upload to the server is not possible or desired.

TagRequiredDescription
PublishFolderyesDefines the folder where the complete site and all utilities for deployment on a server are saved.

Local:Copy

The Copy tag defines a list of files/folders to be copied to the PublishFolder. The ZIP file and the DeploySite utility must be explicitly listed in Copy tags as they are not automatically copied. Multiple files/folders can be copied by adding multiple Copy list items.

TagRequiredDescription
FromyesDefines a file or folder on the development system either as an absolute path or a relative path (to Deploy:BaseFolder). This file is copied to the PublishFolder (Copy:To).
ToyesDefines the file or folder name as it is copied to PublishFolder.
ReplaceBGno, default falseDefines whether {BlueGreen} tags are replaced with the current Blue/Green deployment type. See Blue/Green Tags for more information.

Site

The Site tag defines how an uploaded ZIP file is deployed on the server (by running DeploySite on the server). After running the DeploySite on the development system, all necessary items were uploaded via FTP to the server. Running DeploySite on the server unzips the ZIP file and copies all files into the proper location.

TagRequiredDescription
LocationyesDefines the target location on the server where the deployed site is located. This must be an absolute path.
ZIPyesDefines the absolute path of the uploaded ZIP file which is used to deploy the site.
Maintenanceno, default falseDefines whether the website is set to "maintenance mode" while the site is deployed on the server by placing an App_Offline.htm file into the root of the server. This is only possible when Blue/Green deployment is not. A YetaWF site has a web page ./wwwroot/Maintenance/Offline For Maintenance.html that is copied to the root of the server. This file can be customized before deployment.

Site:RunFirst

The RunFirst tag can be used to define 0 or more commands to execute before deploying the site. This could be used to stop application pools, stop sites, or other actions.

TagRequiredDescription
CommandyesDefines the complete command line to execute.
IgnoreErrorsno, default falseDefines whether site deployment stops if the command line failed (IgnoreErrors = false). If IgnoreErrors true is specified, deployment continues even if the command line failed.

Site:Run

The Run tag can be used to define 0 or more commands to execute after the ZIP file has been unzipped and all files have been copied to the target location and the site is ready to run. This could be used to perform site testing, before it becomes active.

TagRequiredDescription
CommandyesDefines the complete command line to execute.
IgnoreErrorsno, default falseDefines whether site deployment stops if the command line failed (IgnoreErrors = false). If IgnoreErrors true is specified, deployment continues even if the command line failed.

Blue/Green Tags

Blue/Green tags can be replaced by the actual site (Blue/Green) when uploading or copying files using FTP:Copy or Local:Copy and ReplaceBG is set to true. The following tags are available:

TagWhen Deploying Blue Site
Replaced By
When Deploying Green Site
Replaced By
{bluegreen}bluegreen
{BLUEGREEN}BlueGreen
{BLUEGREEN-OTHER}GreenBlue