Skip to content

shamoon/cloudways-operations

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloudways Operations

Perform certain operations on a Cloudways server via the Cloudways API. Please note that not all API operations are permitted.

Supported Operations

Operation Key Parameters
Change service state service service: mysql, apache2, nginx, memcached, varnish, redis-server, php*.*-fpm (e.g. php8.0-fpm), elasticsearch, supervisor
state: start, stop, restart
Update server varnish state varnish action: enable, disable, purge
Purge Assets from Cloudways CDN cdn_purge app_id

Required Inputs

1. email [required]

Cloudways account email

2. api-key [required]

Cloudways API key. See https://platform.cloudways.com/api

3. server-id [required]

Numeric ID of the server, can be found in the URL of web panel e.g.: platform.cloudways.com/server/server-id/access_detail

4. operation [required]

Operations are specified with a dot notation and should include each parameter. Order matters, use the same order as specified above. E.g. service.mysql.restart or cdn_purge.12345 (where 12345 represents the app_id).

Using Secrets

The safest way to pass credentials to this action is via Github Secrets. See https://docs.github.com/en/actions/security-guides/encrypted-secrets#using-encrypted-secrets-in-a-workflow

Example Configuration

name: Clear Server Varnish Cache

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - name: Build
        ...
      - name: Deploy
        ...
      - name: Purge Varnish
        uses: shamoon/cloudways-operations@main
        with:
          email: ${{ secrets.CLOUDWAYS_EMAIL }}
          api-key: ${{ secrets.CLOUDWAYS_API_KEY }}
          server-id: ${{ secrets.CLOUDWAYS_SERVER_ID }}
          operation: varnish.purge

Disclaimer

This can break things, be careful

About

Cloudways API Operations Action

Resources

License

Stars

Watchers

Forks

Packages

No packages published