Sha256: 230381e19942c3298ede166b5c83748baf2c40a5a29e05a56e69680137838903

Contents?: true

Size: 922 Bytes

Versions: 1

Compression:

Stored size: 922 Bytes

Contents

module Souls
  class CloudRun < Thor
    desc "awake", "Set Ping Every 15min by Google Cloud Scheduler"
    method_option :url, default: "https://souls.souls.nl", aliases: "--url", desc: "Set URL"
    def awake
      app_name = Souls.configuration.app
      system(
        "gcloud scheduler jobs create http #{app_name}-awake
            --schedule '0,10,20,30,40,50 * * * *' --uri #{url} --http-method GET"
      )
    rescue Thor::Error => e
      raise(Thor::Error, e)
    end

    desc "list", "Show Google Cloud Run List"
    def list
      system("gcloud run services list --platform managed")
    rescue Thor::Error => e
      raise(Thor::Error, e)
    end

    desc "get_endpoint", "Show Worker's Endpoint"
    def get_endpoint(worker_name: "")
      `gcloud run services list  --platform managed | grep #{worker_name} | awk '{print $4}'`
    rescue Thor::Error => e
      raise(Thor::Error, e)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
souls-1.8.3 lib/souls/cli/gcloud/run/index.rb