8000 feat: add dbdump REST API to Cord cli by dpgaspar · Pull Request #7 · getcord/cord · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add dbdump REST API to Cord cli #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dpgaspar
Copy link
Contributor

Adding support to dbDumps to Cord cli.

This is a nice to have feature to help everyone on the data migration process

Usage Examples local build:

./dist/index.js project

cord project

Manipulate projects. For more info refer to docs: https://docs.cord.com/rest-apis/projects

Commands:
  cord project ls                     List all projects: GET https://api.cord.com/v1/projects
  cord project dbdump                 Dumps all data from all project
  cord project get <id>               Get a project: GET https://api.cord.com/v1/projects/<ID>
  cord project create                 Create a project: POST https://api.cord.com/v1/projects
  cord project update <id>            Update a project: PUT https://api.cord.com/v1/projects/<ID>
  cord project delete [--force] <id>  Delete a project: DELETE https://api.cord.com/v1/projects/<ID>
  cord project select                 Select a project you would like to use
  cord project which                  See the project you are using

Options:
  --version  Show version number                                                                                                         [boolean]
  --help     Show help                                                                                                                   [boolean]

Actual dump

./dist/index.js project dbdump > db_dump.sql

@dpgaspar dpgaspar changed the title feat: add dbdump REST API to cord SDK cli feat: add dbdump REST API to Cord cli Jul 19, 2024
@dmmiller
Copy link
Member

This seems reasonable. The downside is this will only apply if you run the cord cli from a local version, and not from the official version. I can look at porting this code into the internal version which people would then get from npm.

Thoughts @flooey?

Copy link
Member
@flooey flooey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine to me, but it's not ideal that it needs to buffer the entire response (which could be hundreds of megs) before it outputs it. But possibly it'd be much more difficult to feed it to stdout immediately as it comes in, so I'm not opposed.

@@ -17,6 +17,17 @@ async function listAllApplicationsHandler() {
prettyPrint(apps);
}

async function dbDumpHandler() {
const dump = await fetchCordManagementApi<ApplicationData[]>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it should be fetchCordManagementApi<string>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true I'll change it

zephyring 8000 referenced this pull request in fabi-ai/cord-preview Jul 20, 2024
* Remove bucket for website backup

* Remove DNS for various things

Remove a bunch of DNS entries for stuff that was Cord-the-company
related, but isn't necessary for the service, like the Cord website,
Cord's hosted instance of Clack, etc.

* Remove PR server

The PR server isn't needed to run the service, and other customers
wprobably want to have their own way of doing things rather than
running our PR server exactly as it was run, so don't include it in
the ops distribution.

* Install pyOpenSSL before ec2instanceconnectcli

* Create secrets for all .env secrets

This makes the CloudFormation code create secret placeholders for all
of the different secrets need to generate .env.  The ones that are
just random strings are initialized to random strings, while the ones
that are external API keys are initialized to the string "INSERT API
KEY HERE".

* Fix names of secrets

* Remove check for Cord's GitHub repo

* Install Node 18 on build3

* Disable GitHub actions runner by default

* Don't require running under GitHub actions in build-on-commit.sh

* Don't attempt to push to getcord/monorepo on manual deploy

* feat: add JSON log format (#8)

* Disable stable host keys on zero by default

* Add keyPair definition for radical-ec2-key

* Don't customize app.cord.com bucket name

* Update version of Postgres to 15

---------

Co-authored-by: Adam Vartanian <flooey@cord.com>
Co-authored-by: Daniel Vaz Gaspar <danielvazgaspar@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0