Skip to content
Mougrim edited this page Jul 6, 2023 · 16 revisions

To see deploy actions you can run mougrim-deployer.php help deploy. To see deploy action info you can run mougrim-deployer.php help deploy <action>. For example replace <action> to switch.

Init

Action init have next options:

  • --application-path - destination path.
  • --user - linux user.
  • --group - linux group.

This action init project directory:

  • Create application directory (--application-path param value).
  • Create versions directory. For example if --application-path=/project, then versions directory /project/versions.

For this directories owner user <user> and owner group <group>.

Deploy

Action deploy have next options:

  • --tag - git tag.
  • --skip-git - skip git checkout tag, and other work with git for debug or dev deploy.
  • --skip-deploy-files - skip deploy files to version dir for debug or dev deploy.
  • --application-path - destination path.
  • --user - linux user.
  • --group - linux group.
  • --before-deploy-script - scripts, run after git checkout tag, not template. This param multiple.
  • --after-deploy-script - scripts, run after deploy to new tag, as template. This param multiple.
  • --template-files - files, which needs process as templates. This param multiple.
    Available variables, passed to template:
    • parameters from config;
    • parameters from request;
    • versions-path - versions dir path;
    • version-path - new version dir path;
    • current-link-path - current link path.
    If we have param variable=value, and template Text {{ variable }} other text, then template converted to Text value other text. You can use nested parameters, for example {{ template-parameters.nested-variable }} Template path is also template, for example version-path=/project/versions/v1.0.0 and template path {{ version-path }}/bin/script.sh will replaces to /project/versions/v1.0.0/bin/script.sh.
  • --template-parameters - Custom template parameters, passed to templates - files in 'template-files' and commands names.

This action do next steps:

  • Checkout git tag (--tag param value).
  • Run before deploy scripts (--before-deploy-script params values).
  • Create version folder. For example if you deploy tag v1.3.2, and --application-path=/project, then deploy action create directory /project/versions/v1.3.2. If directory exists, then you need input yes for remove directory, or no for cancel deploy.
  • Deploy project to version directory.
  • Process template files (--template-files params values).
  • Run after deploy scripts (--after-deploy-script params values).

Switch

Action switch have next options:

  • --tag - git tag.
  • --application-path - destination path.
  • --user - linux user.
  • --group - linux group.
  • --after-switch-script - scripts, run after switch to new tag, as template. This param multiple.
  • --template-parameters - Custom template parameters, passed to templates - files in 'template-files' and commands names.

This action switch project to new version:

  • Create new links in project root directory to files (and directories) in current link, if in new version new files exists.
  • Switch current link to new version.
  • Remove old links in project root directory, if in new version destination files (and directories) not exists.
  • Run after switch scripts (--after-switch-script params values). For example you can chose --after-switch-script='sudo service nginx reload'

Index

Action index is default action. This action run next actions:

  • init;
  • deploy;
  • switch;

This action have same options with init, deploy and switch actions.

Dev

For deploy files in dev environment you can use dev action. This action same with index, but force add param --skip-git and param --tag have default value dev.

Clone this wiki locally