From 64a74b8f38be29269621b6c063961ddb09f91cf6 Mon Sep 17 00:00:00 2001 From: Ry Walker Date: Wed, 14 Dec 2022 22:44:23 -0500 Subject: [PATCH 1/6] Sketch out how deployment could work --- examples/README.md | 21 +++++++++++++++++++++ examples/db/schemas/posts.toml | 26 ++++++++++++++++++++++++++ examples/instances/primary.toml | 8 ++++++++ examples/instances/read.toml | 9 +++++++++ 4 files changed, 64 insertions(+) create mode 100644 examples/README.md create mode 100644 examples/db/schemas/posts.toml create mode 100644 examples/instances/primary.toml create mode 100644 examples/instances/read.toml diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 000000000..eaa7db490 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,21 @@ +# How it could work + +## Given + +* A CoreDB cluster is deployed +* I have user credentials to deploy to it + +## When + +* I type `coredb init` +* I create files according to coredb docs +* I type `coredb deploy` + +## Then + +* My files are analyzed and good stuff happens in the CoreDB cluster + * `db/schemas` directory is parsed for changes, and migrations are generated + * potentially problematic migrations are flagged + * the cli steps me through the migrations one-by-one + * `instances` directory is parsed for instances of postgres to spin up, within which dataplane clusters, and with what limitations + * `apps` directory is parsed for apps to bundle into the postgres deployment (initially, only `actix` framework) \ No newline at end of file diff --git a/examples/db/schemas/posts.toml b/examples/db/schemas/posts.toml new file mode 100644 index 000000000..3d23cfd4d --- /dev/null +++ b/examples/db/schemas/posts.toml @@ -0,0 +1,26 @@ +[table] +schema = "main" +name = "posts" + +[table.fields.id] +type = "int" +default = "autoincrement()" + +[table.fields.createdAt] +type = "DateTime" +default = "now()" + +[table.fields.updatedAt] +type = "DateTime" + +[table.fields.title] +type = "VARCHAR(200)" +default = "" + +[table.fields.body] +type = "VARCHAR" +default = "" + +[table.fields.slug] +type = "VARCHAR(255)" +unique = true diff --git a/examples/instances/primary.toml b/examples/instances/primary.toml new file mode 100644 index 000000000..59d6988f2 --- /dev/null +++ b/examples/instances/primary.toml @@ -0,0 +1,8 @@ +[instance] +name = "primary" +cpu = "2" +mem = "4096" +coredb_account_cluster = "google-us-west" + +[tables] +include = ["posts"] \ No newline at end of file diff --git a/examples/instances/read.toml b/examples/instances/read.toml new file mode 100644 index 000000000..a5dd27a6e --- /dev/null +++ b/examples/instances/read.toml @@ -0,0 +1,9 @@ +[instance] +name = "primary" +cpu = "1" +mem = "1024" +read_only = true +coredb_account_cluster = "aws-us-east" + +[tables] +include = ["posts"] \ No newline at end of file From b17c33f31f04b17d5831245060d545f43a95182b Mon Sep 17 00:00:00 2001 From: Ry Walker Date: Wed, 14 Dec 2022 22:46:49 -0500 Subject: [PATCH 2/6] Update readme --- examples/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/README.md b/examples/README.md index eaa7db490..e85e6f447 100644 --- a/examples/README.md +++ b/examples/README.md @@ -4,11 +4,11 @@ * A CoreDB cluster is deployed * I have user credentials to deploy to it +* I have created a coredb project via `coredb init` +* I create files according to coredb docs ## When -* I type `coredb init` -* I create files according to coredb docs * I type `coredb deploy` ## Then From 75abe14a8d3ffe2ebaf16f85c94f9966b5d5212f Mon Sep 17 00:00:00 2001 From: Ry Walker Date: Wed, 14 Dec 2022 22:47:13 -0500 Subject: [PATCH 3/6] Update readme --- examples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index e85e6f447..5b206ecf7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -4,7 +4,7 @@ * A CoreDB cluster is deployed * I have user credentials to deploy to it -* I have created a coredb project via `coredb init` +* I have created a coredb project on my machine via `coredb init` command * I create files according to coredb docs ## When From 9774c8ef3c02824035e8a51f3a6f93a71cdc2d2c Mon Sep 17 00:00:00 2001 From: Ry Walker Date: Wed, 14 Dec 2022 22:48:09 -0500 Subject: [PATCH 4/6] Update readme --- examples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index 5b206ecf7..df1193194 100644 --- a/examples/README.md +++ b/examples/README.md @@ -17,5 +17,5 @@ * `db/schemas` directory is parsed for changes, and migrations are generated * potentially problematic migrations are flagged * the cli steps me through the migrations one-by-one - * `instances` directory is parsed for instances of postgres to spin up, within which dataplane clusters, and with what limitations + * `instances` directory is parsed for instances of postgres to spin up, within which dataplane clusters, and with what limitations (this assumes that we have magic multi-master functionality, which doesn't exist yet) * `apps` directory is parsed for apps to bundle into the postgres deployment (initially, only `actix` framework) \ No newline at end of file From 8ca65ae1bf6d38ef7d721a3246c2d746f963e4f9 Mon Sep 17 00:00:00 2001 From: Ian Stanton Date: Thu, 15 Dec 2022 18:06:55 -0600 Subject: [PATCH 5/6] Add newlines --- examples/instances/primary.toml | 3 ++- examples/instances/read.toml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/instances/primary.toml b/examples/instances/primary.toml index 59d6988f2..59f7f3c35 100644 --- a/examples/instances/primary.toml +++ b/examples/instances/primary.toml @@ -5,4 +5,5 @@ mem = "4096" coredb_account_cluster = "google-us-west" [tables] -include = ["posts"] \ No newline at end of file +include = ["posts"] + diff --git a/examples/instances/read.toml b/examples/instances/read.toml index a5dd27a6e..8659f99a3 100644 --- a/examples/instances/read.toml +++ b/examples/instances/read.toml @@ -6,4 +6,5 @@ read_only = true coredb_account_cluster = "aws-us-east" [tables] -include = ["posts"] \ No newline at end of file +include = ["posts"] + From 881aee7b78cf82d98b812d8e0bea6a6f00fc1385 Mon Sep 17 00:00:00 2001 From: Ry Walker <4283+ryw@users.noreply.github.com> Date: Fri, 16 Dec 2022 11:07:01 -0500 Subject: [PATCH 6/6] Update examples/instances/read.toml Co-authored-by: Ian Stanton --- examples/instances/read.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/instances/read.toml b/examples/instances/read.toml index 8659f99a3..43de54a69 100644 --- a/examples/instances/read.toml +++ b/examples/instances/read.toml @@ -1,5 +1,5 @@ [instance] -name = "primary" +name = "read" cpu = "1" mem = "1024" read_only = true