Deploy VCS Projects

The deployment of projects using the Version Control System(VCS) is a practical and commonly used method to connect applications to the cloud.

This makes it easy to handle the source code for your application, allowing you to upgrade the application manually or automatically at periodic fixed intervals to newer versions.

The multiple CLI commands to manage the VCS deployments make it very flexible and bring complete control of your application.

Step 1. Create New Project

To do that, run:

Command:


~/jelastic/environment/vcs/createproject \
--envName {env_name} \
--type {type} \
--context {context} \
--url {url} \
[--branch {branch}] \
--autoupdate {true/false} \
[--interval {interval}] \
--autoResolveConflict {true/false} \
--zdt {true/false}

Example:


~/jelastic/environment/vcs/createproject \
--envName cli-volumes \
--type git \
--context ROOT \
--url https://github.com/user/repo.git \
--branch main \
--autoupdate false \
--autoResolveConflict true \
--zdt false

Create New Project

Basic Settings:

  • {env_name}: your environment’s name
  • {type}: type of VCS (git or svn); in the event of git, along with the parameter {branch} – version of the project
  • {context}: the name of the context for your new project
  • {url}: URL of the repo

Advanced Settings:

  • autoupdate: automatic deployment of your project at configured intervals; re-deployment intervals can be adjusted by specifying the value of the {interval} parameter.
  • autoResolveConflict: conflict resolution will be carried out automatically
  • zdt: enforces ZDT deployment for PHP projects

Note: If you’d like to work with a private repo, you should specify the following auth parameters:


[--login {login}] [--password {password}] [--keyId {keyId}]
  • {login}: your login to the VCS account
  • {password}: password for the VCS account
  • {keyId}: name of the private SSH key you’ve uploaded to the dashboard for secure connections by pairing with its public SSH key attached
Tip: This command performs the same actions as the “Add project” button in the dashboard. Once you’ve run the command above, switch back to GUI and click “Edit” for the created project – you can review your introduced changes there. Should a project not be displayed, just refresh the dashboard page.

Step 2: Configuration Update and Project Deployment

Run the following command to apply your settings and redeploy your project:


~/jelastic/environment/vcs/update --envName {env_name} --context {context}

Configure Update

Here, please substitute with the same values as at the previous step. Also, manual redeployment can be performed based on the updated sources from VCS.

Step 3: Editing Project Settings

To edit the project settings, for example, the version branch, run:

Command:


~/jelastic/environment/vcs/editproject \
--envName {env_name} \
--type {type} \
--oldcontext {oldcontext} \
--newcontext {newcontext} \
--url {url} \
[--branch {branch}] \
--autoupdate {true/false} \
[--interval {interval}] \
--autoResolveConflict {true/false} \
--zdt {true/false}

Example:


~/jelastic/environment/vcs/editproject
--envName cli-volumes \
--type git \
--oldcontext ROOT \
--newcontext NewROOT \
--url https://github.com/user/repo.git \
--branch main \
--autoupdate false \
--autoResolveConflict true \
--zdt false

Edit Project Settings

New Parameters:

  • {oldcontext}: the current project context to be changed
  • {newcontext}: the new context for project (should be specified, could be the same as {oldcontext})
Important Note:
This command updates the project’s settings, so to apply these changes, the update method from step 2 should be executed.

Conclusion

From here on out, you can create and manage your VCS projects directly from the terminal, following the above three steps, i.e project creation, project deployment & editing project VCS settings.