{"id":19272284,"url":"https://github.com/sdslabs/gctl","last_synced_at":"2025-04-21T22:31:22.472Z","repository":{"id":43149518,"uuid":"268619671","full_name":"sdslabs/gctl","owner":"sdslabs","description":"Gasper on the command line. Deploy and manage applications and databases from the terminal.","archived":false,"fork":false,"pushed_at":"2023-04-22T18:30:25.000Z","size":9859,"stargazers_count":20,"open_issues_count":7,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-06-20T03:36:18.208Z","etag":null,"topics":["cli","cloud","database","gasper","golang","server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sdslabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-01T20:00:05.000Z","updated_at":"2023-03-14T17:35:57.000Z","dependencies_parsed_at":"2024-06-20T03:21:29.750Z","dependency_job_id":null,"html_url":"https://github.com/sdslabs/gctl","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdslabs%2Fgctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdslabs%2Fgctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdslabs%2Fgctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdslabs%2Fgctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdslabs","download_url":"https://codeload.github.com/sdslabs/gctl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223881292,"owners_count":17219262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","cloud","database","gasper","golang","server"],"created_at":"2024-11-09T20:36:11.425Z","updated_at":"2024-11-09T20:36:12.206Z","avatar_url":"https://github.com/sdslabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\n\n`gctl` is [Gasper](https://gasper-docs.netlify.app/) on the command line. It allows user to deploy and manage applications and databases from terminal.\n\n## Installation\n\n\u003e Using this package requires a working Go environment. [See the install instructions for Go](https://golang.org/doc/install).\n\n**gctl** can be installed using following command.\n\n``` \n$ go get github.com/sdslabs/gctl \n```\n\nIf you get following output, that means gctl is successfully installed.\n```\n$ gctl\nGasper is an intelligent Platform as a Service (PaaS) used for deploying and managing applications and databases in any cloud topology.\n```\n\nTo execute commands of gctl, run [Gasper](https://gasper-docs.netlify.app/) on your local environment.\n\n## Login\n\nAfter Gasper is up and successfully running, generate PA Token to login in command-line.\n\nLogin to gasper using following command to generate the PA token\n\n```\n$ curl -X POST \\\n  http://localhost:3000/auth/login \\\n  -H 'Content-Type: application/json' \\\n  -H 'Authorization-Type: gctlToken' \\\n  -d '{\n    \"email\": \"anish.mukherjee1996@gmail.com\",\n    \"password\": \"alphadose\"\n  }'\n\n{\n    \"code\":200,\n    \"expire\":\"2020-10-10T21:27:30+05:30\",\"token\":\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6ZmFsc2UsImVtYWlsIjoiZ21haGFrMUBnbWFpbC5jb20iLCJleHAiOjE2MDIzNTE4MTAsImdjdGxfdXVpZCI6IiIsIm9yaWdfaWF0IjoxNjAyMzQ4MjEwLCJ1c2VybmFtZSI6Im1haGFrIn0.bImaUw9p8K_2QMpMqCAyHQHzX2aukDaRpXTDXmAkAoc\"\n}\n```\n\nAfter getting the PA token, login to gctl using command `gctl login` with flag e for email and t for token. Both of the flags are required.\n\n```\n$ gctl login -e anish.mukherjee1996@gmail.com -t eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6ZmFsc2UsImVtYWlsIjoiZ21haGFrMUBnbWFpbC5jb20iLCJleHAiOjE2MDIzNTE4MTAsImdjdGxfdXVpZCI6IiIsIm9yaWdfaWF0IjoxNjAyMzQ4MjEwLCJ1c2VybmFtZSI6Im1haGFrIn0.bImaUw9p8K_2QMpMqCAyHQHzX2aukDaRpXTDXmAkAoc\nLogged in successfully\n```\n\nNow that we have logged in, we are ready deploy and maintain our applications and databases through command-line.\n\n## Application Deployment\n\n* Create a new application using command `gctl create app`. You can provide required details of the app either through a form in terminal or passing a json file in a flag.\n\n  1. Create an app by entering details in a form in the terminal.\n      ```\n      $ gctl create app\n      *App Name: test\n      *Language: php\n      *Application Password: ****\n      *Git URL: https://github.com/sdslabs/gasper-sample-php\n      Is this repo private? [yes/no]: no\n      Branch: \n      *Index: index.php\n      Port: 8000\n      Does this repo contain Gasperfile.txt? [yes/no]: no\n      Build Commands: \n      Run Commands: \n      Environment Variables(key:value): \n      App created successfully \n      Container Id: 32e81f3d244d09da489aec03bea932ae7d96e8e2f5bd9484fc7a21a7e0e967dd Container Port:  44437 Docker Image: docker.io/sdsws/php:3.0 App Url: test.app.sdslabs.co Host Ip: 192.168.43.137 Name Servers:  [8.8.8.8 8.8.4.4] Instance Type: application Language: php Owner: gmahak1@gmail.com Ssh Cmd: ssh -p 2222 test@192.168.43.137 Id: 5f8c8d094374798e04edf3d6\n      ```\n\n      Fields with * are required.\n\n  2. Provide app details in a config json file. Just create the json file with necessary data. Example for required json data to deploy an app can be found in example section of [Gasper Docs](https://gasper-docs.netlify.app/). Run the command `gctl create app {filename} {language}` in the same folder where your config file is and the app will be deployed.\n\n\n- Fetch details of an app using the command `gctl fetch app -n {name}` where n is flag for the name of the app.\n\n- Fetch details of all the apps using the command `gctl fetch app`.\n\n- Delete an app using the command `gctl delete app {app name}`.\n\n- Rebuild an app using the command `gctl rebuild {app name}`.\n\n- Fetch logs of apps using the command `gctl fetch logs {app name} {number of logs}`. The second argument, which is for number of logs, is optional.\n\n- Update an app using a json config file with command `gctl update app {app name} {filename}`. Config file format should be like the one you provided while creating the app. You can also provide details by filling a form in terminal using the command `gctl update app`.\n\n\n## Database Deployment\n\n- A new database can be created either by providing details in flags with the command or by filling a terminal form.\nFollowing example shows how to create a mysql database via Gasper using gctl -\n\n  1. Using flags -\n\n      ```\n      $ gctl create db -t mysql -n alphamysql -p alphamysql\n      Database created\n      ```\n      Here flag t is for database type, n is for database name and p is for database password.\n\n  2. Using terminal form -\n\n      ```\n      $ gctl create db\n      *Database Name: alphatmysql       \n      *Application Password: ***********\n      Database Type: mysql\n      Database created\n      ```\n\n- Fetch details of a database using the command `gctl fetch db -n {name}` where n is flag for the name of the db.\n\n- Fetch details of all the databases using the command `gctl fetch db`.\n\n- Delete a database using the command `gctl delete db {db name}`.\n\n## Instances\n\nFetch details of all the instances using command `gctl fetch instances`.\n\n## Logout\n\nLogout from a system using the command `gctl logout`. You can also revoke the token from sws or using following curl command.\n\n```\n$ curl -X PUT   http://localhost:3000/auth/revoke   -H 'Content-Type: application/json'   -d '{\n    \"email\": \"anish.mukherjee1996@gmail.com\",\n    \"password\": \"alphadose\"\n  }'\n{\"message\":\"token revoked\",\"success\":true}\n```\n\n## Contributing\n\nWe are always open for contributions. If you find any feature missing, or just want to report a bug, feel free to open an issue and/or submit a pull request regarding the same.\n\nFor more information on contribution, refer to the [contributing documentation](./CONTRIBUTING.md).\n\n## Contact\n\nIf you have a query regarding the product or just want to say hello then feel free to visit\n[chat.sdslabs.co](http://chat.sdslabs.co/) or drop a mail at [contact@sdslabs.co.in](mailto:contact@sdslabs.co.in).\n\nMade with :heart: by [SDSLabs](https://github.com/sdslabs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdslabs%2Fgctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdslabs%2Fgctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdslabs%2Fgctl/lists"}