Skip to content

Git Deployment

The CloudStick platform allows you to deploy code to your application from your Git repositories.

Parameters

Variable Necessity Type Description
provider_name REQUIRED STRING Name of git provider github, gitlab, etc
repository REQUIRED STRING Git repository name
branch REQUIRED STRING Your git branch

Deploy Git

HTTP REQUET

POST https://api.cloudstick.io/api/v1/gitdeploy/servers/{SERVER-ID}/users/{USER-ID}?wsid={WEBSTACK-ID}&api_key={API-KEY}&secret_key={SECRET-KEY

REQUEST

curl --request POST \
  --url 'https://dev-api.cloudstick.io/api/v1/gitdeploy/servers/{SERVER-ID}/users/{USER-ID}?wsid={WEBSTACK-ID}&api_key={API-KEY}&secret_key={SECRET-KEY}' \
  --header 'Content-Type: application/json' \
  --data '{
    "provider_name":"github",
    "repository":"git-user/git-repo",
    "branch":"main"
}'

RESPONCE

{
  "webstack_id": 0,
  "server_id": 793,
  "server_uuid": "ZDAzNTk1M2MtOTk4My00YzM2LWFjZWUtYmM2ZWFjNjUwNWE5",
  "provider_name": "github",
  "repository": "git-user/git-repo",
  "branch": "main",
  "hook_url": "https://api.cloudstick.io/api/v1/webhook/git/webstacks/1280/servers/793",
  "deployment_script": null,
  "git_user": "",
  "git_host": "",
  "custom_git": "",
  "web_stack": {
    "id": 1280,
    "server_id": 793,
    "server_uuid": "ZDAzNTk1M2MtOTk4My0zM2LWFjZWUtYmM2ZWFjNjUwNWE5",
    "created_at": "2021-11-06T14:37:48.574943Z",
    "name": "app-gittest",
    "domains": [
      "git.cloudstick.me"
    ],
    "php_version": "74",
    "is_active": true,
    "stack_type": "apache/nginx",
    "public_path": "",
    "initial_public_path": "",
    "email": "user@example.com",
    "is_node_js": false,
    "nodejs_port": 0,
    "webapp_type": "",
    "cj_protection": true,
    "xss_protection": true,
    "ms_protection": true,
    "php_process_manager": "dynamic",
    "php_max_children": 50,
    "php_max_requests": 500,
    "php_start_servers": 20,
    "php_min_spare_servers": 10,
    "php_max_spare_servers": 30,
    "php_open_base_dir": "/home/user_name/apps/app-gittest/:/var/lib/php/session:/tmp",
    "php_timezone": "UTC",
    "php_disable_functions": "getmyuid,passthru,leak,listen,diskfreespace,tmpfile,link,ignore_user_abort,shell_exec,dl,set_time_limit,exec,system,highlight_file,source,show_source,fpassthru,virtual,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_open,proc_close,proc_nice,proc_terminate,escapeshellcmd,ini_alter,popen,pcntl_exec,socket_accept,socket_bind,socket_clear_error,socket_close,socket_connect,symlink,posix_geteuid,ini_alter,socket_listen,socket_create_listen,socket_read,socket_create_pair,stream_socket_server",
    "php_max_execution_time": 30,
    "php_max_input_time": 60,
    "php_max_input_vars": 1000,
    "php_memory_limit": 256,
    "php_post_max_size": 256,
    "php_upload_max_filesize": 256,
    "php_session_max_lifetime": 1440,
    "php_allow_url_fopen": true,
    "php_short_open_tag": true,
    "add_php_open_base_dir": "",
    "is_backup_enabled": false,
    "sys_user": {
      "id": 2346,
      "created_at": "2021-11-06T14:37:47.418963Z",
      "user_name": "user_name",
      "email": "user@example.com",
      "server_id": 793,
      "is_sudo": {
        "Bool": false,
        "Valid": false
      }
    },
    "nginx_cache": null
  }
}

Git Webhook Records

HTTP REQUEST

GET https://api.cloudstick.io/api/v1/gitwebhook/webstacks/{WEBSTACK-ID}/servers/{SERVER-ID}/users/{USER-ID}?api_key={API-KEY}&secret_key={SECRET-KEY}

REQUEST

curl --request GET \
  --url 'https://api.cloudstick.io/api/v1/gitwebhook/webstacks/{WEBSTACK-ID}/servers/{SERVER-ID}/users/{USER-ID}?api_key={API-KEY}&secret_key={SECRET-KEY}'

RESPONSE

[
  {
    "webstack_id": 1280,
    "webhook_url": "https://api.cloudstick.io/api/v1/webhook/git/webstacks/1280/servers/793",
    "branch_name": "main",
    "git_provider": "github.com",
    "commit_link": "https://github.com/<commit-url>",
    "commit_message": "Update README.md",
    "commiter": "git-user",
    "commit_time": "06 November 2021 (20:57:24 pm)",
    "deployment_stdout": null,
    "deployment_stderr": null,
    "deployment_time": "06 November 2021 (15:27:29 pm)",
    "custom_script": null
  },
]  

Get Git Information

HTTP REQUEST

GET https://api.cloudstick.io/api/v1/gitbranch/webstacks/{WEBSTACK-ID}/servers/{SERVER-ID}/users/{USER-ID}?api_key={API-KEY}&secret_key={SECRET-KEY}

REQUEST

curl --request GET \
  --url 'https://api.cloudstick.io/api/v1/gitbranch/webstacks/{WEBSTACK-ID}/servers/{SERVER-ID}/users/{USER-ID}?api_key={API-KEY}&secret_key={SECRET-KEY}'

RESPONSE

{
  "webstack_id": 1280,
  "server_id": 793,
  "server_uuid": null,
  "provider_name": "github",
  "repository": "git-user/git-repo",
  "branch": "main",
  "hook_url": "https://api.cloudstick.io/api/v1/webhook/git/webstacks/1280/servers/793",
  "deployment_script": null,
  "git_user": "",
  "git_host": "",
  "custom_git": "",
  "web_stack": {
    "id": 393,
    "server_uuid": null,
    "created_at": "0001-01-01T00:00:00Z",
    "name": "",
    "domains": null,
    "php_version": "",
    "is_active": false,
    "stack_type": "",
    "public_path": "",
    "initial_public_path": "",
    "email": "",
    "is_node_js": false,
    "nodejs_port": 0,
    "webapp_type": "",
    "add_php_open_base_dir": "",
    "is_backup_enabled": false,
    "sys_user": null,
    "nginx_cache": null
  }
}

UPDATE/CHANGE BRANCH

REQUEST

PATCH https://api.cloudstick.io/api/v1/gitdeploy/servers/{SERVER-ID}/users/{USER-ID}?wsid={WEBSTACK-ID}&api_key={API-KEY}&secret_key={SECRET-KEY

HTTP REQUEST

curl --request PATCH \
  --url 'https://api.cloudstick.io/api/v1/gitdeploy/servers/{SERVER-ID}/users/{USER-ID}?wsid={WEBSTACK-ID}&api_key={API-KEY}&secret_key={SECRET-KEY}' \
  --header 'Content-Type: application/json' \
  --data '{
    "branch":"develop"
}' 

RESPONSE

201 OK