From a4d347ba9ca5e54fa4fee1cada94e41ab6429afe Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Mon, 7 Aug 2023 13:36:03 +0800 Subject: [PATCH 01/11] update homepage header and footer items --- packages/doc/docusaurus.config.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/doc/docusaurus.config.js b/packages/doc/docusaurus.config.js index 13749708..03a39b55 100644 --- a/packages/doc/docusaurus.config.js +++ b/packages/doc/docusaurus.config.js @@ -75,6 +75,11 @@ const config = { position: 'left', label: 'Blog', }, + { + href: 'https://github.com/Canner/vulcan-sql-examples', + position: 'left', + label: 'Examples', + }, { href: 'https://discord.gg/ztDz8DCmG4', position: 'left', @@ -100,12 +105,16 @@ const config = { items: [ { label: 'Getting Started', - to: '/docs/intro', + to: '/docs/get-started/first-api', }, { label: 'Building Data API', to: '/docs/develop/init', }, + { + label: 'Extensions', + to: '/docs/extensions/overview', + }, { label: 'API Catalog & Documentation', to: '/docs/catalog/intro', @@ -118,6 +127,10 @@ const config = { label: 'Deployment and Maintenance', to: '/docs/deployment', }, + { + label: 'References', + to: '/docs/references/project-configurations', + }, ], }, { @@ -140,6 +153,10 @@ const config = { label: 'GitHub', href: 'https://github.com/Canner/vulcan-sql', }, + { + label: 'Examples', + href: 'https://github.com/Canner/vulcan-sql-examples', + }, { label: 'Privacy', href: 'https://cannerdata.com/terms/privacy' From d064d00bcebec407cf8ef91e1588c4a7e5b6395b Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Tue, 8 Aug 2023 09:26:06 +0800 Subject: [PATCH 02/11] add fly.io deployment guide --- packages/doc/docs/deployment/flydotio.mdx | 179 ++++++++++++++++++++++ packages/doc/sidebars.js | 11 ++ 2 files changed, 190 insertions(+) create mode 100644 packages/doc/docs/deployment/flydotio.mdx diff --git a/packages/doc/docs/deployment/flydotio.mdx b/packages/doc/docs/deployment/flydotio.mdx new file mode 100644 index 00000000..576a6145 --- /dev/null +++ b/packages/doc/docs/deployment/flydotio.mdx @@ -0,0 +1,179 @@ +# Fly.io + +In this step-by-step guide, we'll guide you how to deploy your VulcanSQL project to [Fly.io](https://fly.io/). +Fly.io is a developer friendly service to deploy your apps. Besides, it has [free allowances](https://fly.io/docs/about/pricing/#em-free-allowances-em), +which is a great deployment option for side-projects. + +## Step 1: Install Fly.io + +Please go to [this website](https://fly.io/docs/hands-on/install-flyctl/) for installing `flyctl`, which is a command-line utility that lets you work with Fly.io. +You should install the version that's appropriate for your operating system. + +After successfully installed `flyctl`, you should see the following message if you type `fly` in the terminal: + +``` +cyyeh@JimmydeMBP vulcan-sql % fly +This is flyctl, the Fly.io command line interface. + +Here's a few commands to get you started: + fly launch Launch a new application + fly apps Create and manage apps + fly postgres Create and manage Postgres databases + fly mysql Create and manage PlanetScale MySQL databases + fly redis Create and manage Upstash Redis databases + fly machines Create and manage individual Fly.io machines + +If you need help along the way: + fly help Display a complete list of commands + fly help Display help for a specific command, e.g. 'fly help launch' + +Visit https://fly.io/docs for additional documentation & guides +``` + +## Step 2: Login to Fly.io + +**Signup** + +If this is your first time setting up Fly.io, please execute the following command in the terminal: + +```bash +fly auth signup +``` + +After successfully sign up in Fly.io, you should see the following message in the terminal: + +``` +Waiting for session... Done +successfully logged in as xxxxx@xxx +``` + +For more detailed introduction on how to sign up, you can [read more here](https://fly.io/docs/hands-on/sign-up/). + +**Login** + +If you already have a Fly.io account, please execute the following command in the terminal: + +```bash +fly auth login +``` + +After successfully login in Fly.io, you should see the following message in the terminal: + +``` +Waiting for session... Done +successfully logged in as xxxxx@xxx +``` + +For more detailed introduction on how to sign in, you can [read more here](https://fly.io/docs/hands-on/sign-in/). + +## Step 3: Packaging your VulcanSQL project + +In this guide, we'll deploy the Docker version of your VulcanSQL project. So please execute the following command in the terminal: + +```bash +vulcan package --output docker +``` + +After executing the command, you'll see a message shown like below and a new directory `dist` in the project directory. + +```bash +2023-08-07 08:47:26.246 INFO [CORE] Package successfully, you can go to "dist" folder and run "docker build ." to build the image. +✔ Package successfully. +``` + +The directory structure of `dist` is as following: + +``` +dist +├── Dockerfile +├── config.json +├── index.js +├── package.json +└── result.json +``` + +:::caution +External resources and configurations, such as `profiles.yaml`, are not copied to the `dist` folder. +You'll need to copy them manually. We strongly recommend using a separate profile instead of the one used for development. + +After copying `profiles.yaml` into the `dist` folder, you should also add one line in `Dockerfile` as following: + +```shell +. +. +. +FROM node:16-bullseye-slim +WORKDIR /usr/app +COPY --from=build /usr/app /usr/app +COPY config.json . +COPY index.js . +COPY result.json . +# add the line below +COPY profiles.yaml . +ENV NODE_ENV production + +CMD [ "node", "index.js" ] +``` + +**Notes: if you have [multiple profiles](../references/data-source-profile#define-profile-in-independent-yaml-files), you should copy them into the dist folder and add them all in the Dockerfile.** +::: + +## Step 4: Setup Fly.io deployment config + +Please execute the following command in the terminal in order to generate a Fly.io deployment config `fly.toml`: + +```shell +fly launch +``` + +After executing the command, Fly.io would ask you several questions such as: +1. Chooese an app name +2. Select organization +3. Choose a region for deployment +4. Would you like to set up a Postgresql database now? +5. Would you like to set up an Upstash Redis database now? +6. Would you like to deploy now? + +After answering these questions, you will see `fly.toml` in the `dist` folder and the content is similar to this: + +```toml +# fly.toml app configuration file generated for xxxxx on 2023-07-13T22:40:54+08:00 +# +# See https://fly.io/docs/reference/configuration/ for information about how to use this file. +# + +app = "xxxxx" +primary_region = "bos" + +[http_service] + internal_port = 3000 + force_https = true + auto_stop_machines = false + auto_start_machines = false + min_machines_running = 1 + processes = ["app"] +``` + +:::info +You can make `auto_stop_machines` to be false, so that you don't need to worry if the machine will hibernate if no one accesses it for a while. +::: + +For more detailed introduction on how to launch your app, you can [read more here](https://fly.io/docs/hands-on/launch-app/). + +## Step 5: Deploy to Fly.io + +Finally, you can execute the following command in the terminal to deploy your VulcanSQL project and share it with the world! + +```shell +fly deploy +``` + +After successfully deploying the app, you should see the following message in the terminal: + +```shell +Watch your app at https://fly.io/apps/xxxx/monitoring + +Visit your newly deployed app at https://xxxxx/ +``` + +Congratulations! Now your VulcanSQL app is on the cloud and is ready to be shared to the world! \ No newline at end of file diff --git a/packages/doc/sidebars.js b/packages/doc/sidebars.js index 50a71543..45a667c6 100644 --- a/packages/doc/sidebars.js +++ b/packages/doc/sidebars.js @@ -389,6 +389,17 @@ const sidebars = { className: 'sidebar-title', }, 'deployment', + { + type: 'category', + label: 'Cloud Deployment Guides', + link: { type: 'doc', id: 'deployment/flydotio' }, + items: [ + { + type: 'doc', + id: 'deployment/flydotio', + }, + ], + }, { type: 'html', value: From bc133ba6af0926093d09e87969b02b2f0fe2287d Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Tue, 8 Aug 2023 09:28:30 +0800 Subject: [PATCH 03/11] refine wording --- packages/doc/docs/deployment/flydotio.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/doc/docs/deployment/flydotio.mdx b/packages/doc/docs/deployment/flydotio.mdx index 576a6145..334a6c5b 100644 --- a/packages/doc/docs/deployment/flydotio.mdx +++ b/packages/doc/docs/deployment/flydotio.mdx @@ -66,7 +66,7 @@ successfully logged in as xxxxx@xxx For more detailed introduction on how to sign in, you can [read more here](https://fly.io/docs/hands-on/sign-in/). -## Step 3: Packaging your VulcanSQL project +## Step 3: Package your VulcanSQL project In this guide, we'll deploy the Docker version of your VulcanSQL project. So please execute the following command in the terminal: From b0ff7715fc2043753c8c838bbf31a6ea5112eea9 Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Tue, 8 Aug 2023 13:02:40 +0800 Subject: [PATCH 04/11] add gcp:cloudrun deployment guide --- packages/doc/docs/deployment/gcp-cloudrun.mdx | 76 +++++++++++++++++++ packages/doc/sidebars.js | 4 + 2 files changed, 80 insertions(+) create mode 100644 packages/doc/docs/deployment/gcp-cloudrun.mdx diff --git a/packages/doc/docs/deployment/gcp-cloudrun.mdx b/packages/doc/docs/deployment/gcp-cloudrun.mdx new file mode 100644 index 00000000..a579dfed --- /dev/null +++ b/packages/doc/docs/deployment/gcp-cloudrun.mdx @@ -0,0 +1,76 @@ +# GCP: Cloud Run + +In this step-by-step guide, we'll guide you how to deploy your VulcanSQL project to Google Cloud Platform(GCP) +using [Cloud Run](https://cloud.google.com/run). It's a service that we can build and deploy containerized apps +written in any language(including Go, Python, Java, Node.js, .Net, and Ruby) on a fully managed platform. + +:::info +For more detailed information of the deployment process, you can [read more here](https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-nodejs-service). +::: + +## Step 1: Install and setup the Google Cloud CLI + +Before you begin to use Cloud Run on GCP, you need to do several things: +1. In the Google Cloud console, on the [project selector page](https://console.cloud.google.com/projectselector2/home/dashboard), select or create a Google Cloud project. +2. [Make sure the billing is enabled for your Google Cloud project.](https://cloud.google.com/billing/docs/how-to/verify-billing-enabled#console) +3. [Install](https://cloud.google.com/sdk/docs/install) the Google Cloud CLI. +4. Initialize the gcloud CLI with the folowwing command: + ```shell + gcloud init + ``` +5. You can set the default project for your Cloud Run service with the following command: + ```shell + gcloud config set project [PROJECT_ID] + ``` + +For more detailed instructions on how to setup the environment, you can [read more here](https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-nodejs-service#before-you-begin). + +## Step 2: Package your VulcanSQL project + +In this guide, we'll deploy the Docker version of your VulcanSQL project. So please execute the following command in the terminal: + +```bash +vulcan package --output docker +``` + +After executing the command, you'll see a message shown like below and a new directory `dist` in the project directory. + +```bash +2023-08-07 08:47:26.246 INFO [CORE] Package successfully, you can go to "dist" folder and run "docker build ." to build the image. +✔ Package successfully. +``` + +The directory structure of `dist` is as following: + +``` +dist +├── Dockerfile +├── config.json +├── index.js +├── package.json +└── result.json +``` + +## Step 3: Deploy to Cloud Run from source + +Now you can deploy you VulcanSQL app to GCP with the following command: + +```shell +gloud run deploy [YOUR_CLOUDRUN_SERVICE_NAME] --port=3000 --allow-unauthenticated +``` + +:::caution +Important: This quickstart assumes that you have owner or editor roles in the project you are using for the quickstart. +Otherwise, refer to [Cloud Run deployment permissions](https://cloud.google.com/run/docs/reference/iam/roles#additional-configuration), +[Cloud Build permissions](https://cloud.google.com/build/docs/iam-roles-permissions#predefined_roles), and +[Artifact Registry permissions](https://cloud.google.com/artifact-registry/docs/access-control#permissions) for the permissions required. +::: + +After successfully deploy the app, you'll see a similar message in the terminal: + +``` +Service [vulcansql-project] revision [vulcansql-project-00001-mud] has been deployed and is serving 100 percent of traffic. +Service URL: https://vulcansql-project-ggcxvljfba-df.a.run.app +``` + +Congratulations! Now your VulcanSQL app is on the cloud and is ready to be shared to the world! \ No newline at end of file diff --git a/packages/doc/sidebars.js b/packages/doc/sidebars.js index 45a667c6..d2243bfb 100644 --- a/packages/doc/sidebars.js +++ b/packages/doc/sidebars.js @@ -398,6 +398,10 @@ const sidebars = { type: 'doc', id: 'deployment/flydotio', }, + { + type: 'doc', + id: 'deployment/gcp-cloudrun', + } ], }, { From d3878319dd01931892fdcb0ee94b8b6e912d2e21 Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Tue, 8 Aug 2023 13:50:49 +0800 Subject: [PATCH 05/11] refine fly.io deployment guide --- packages/doc/docs/deployment/flydotio.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/doc/docs/deployment/flydotio.mdx b/packages/doc/docs/deployment/flydotio.mdx index 334a6c5b..23c14657 100644 --- a/packages/doc/docs/deployment/flydotio.mdx +++ b/packages/doc/docs/deployment/flydotio.mdx @@ -176,4 +176,8 @@ Watch your app at https://fly.io/apps/xxxx/monitoring Visit your newly deployed app at https://xxxxx/ ``` +:::info +You can read more here regarding to [deployment via Dockerfile](https://fly.io/docs/languages-and-frameworks/dockerfile/). +::: + Congratulations! Now your VulcanSQL app is on the cloud and is ready to be shared to the world! \ No newline at end of file From 8a4dc1ef0af938be20d0214b3091072f3dec8adf Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Tue, 8 Aug 2023 15:28:50 +0800 Subject: [PATCH 06/11] rename file --- .../deployment/{gcp-cloudrun.mdx => gcp-cloud-run.mdx} | 0 packages/doc/drafts/deployment/gcp-app-engine.mdx | 1 + packages/doc/sidebars.js | 8 ++++++-- 3 files changed, 7 insertions(+), 2 deletions(-) rename packages/doc/docs/deployment/{gcp-cloudrun.mdx => gcp-cloud-run.mdx} (100%) create mode 100644 packages/doc/drafts/deployment/gcp-app-engine.mdx diff --git a/packages/doc/docs/deployment/gcp-cloudrun.mdx b/packages/doc/docs/deployment/gcp-cloud-run.mdx similarity index 100% rename from packages/doc/docs/deployment/gcp-cloudrun.mdx rename to packages/doc/docs/deployment/gcp-cloud-run.mdx diff --git a/packages/doc/drafts/deployment/gcp-app-engine.mdx b/packages/doc/drafts/deployment/gcp-app-engine.mdx new file mode 100644 index 00000000..ff6fa583 --- /dev/null +++ b/packages/doc/drafts/deployment/gcp-app-engine.mdx @@ -0,0 +1 @@ +# GCP: App Engine \ No newline at end of file diff --git a/packages/doc/sidebars.js b/packages/doc/sidebars.js index d2243bfb..ae5ac5c9 100644 --- a/packages/doc/sidebars.js +++ b/packages/doc/sidebars.js @@ -400,8 +400,12 @@ const sidebars = { }, { type: 'doc', - id: 'deployment/gcp-cloudrun', - } + id: 'deployment/gcp-cloud-run', + }, + // { + // type: 'doc', + // id: 'deployment/gcp-app-engine', + // } ], }, { From 8680327620061f164625f03674700a97a4728931 Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Tue, 8 Aug 2023 17:14:43 +0800 Subject: [PATCH 07/11] add gcp:app engine --- .../doc/docs/deployment/gcp-app-engine.mdx | 98 +++++++++++++++++++ .../doc/docs/deployment/gcp-cloud-run.mdx | 7 +- .../doc/drafts/deployment/gcp-app-engine.mdx | 1 - packages/doc/sidebars.js | 8 +- 4 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 packages/doc/docs/deployment/gcp-app-engine.mdx delete mode 100644 packages/doc/drafts/deployment/gcp-app-engine.mdx diff --git a/packages/doc/docs/deployment/gcp-app-engine.mdx b/packages/doc/docs/deployment/gcp-app-engine.mdx new file mode 100644 index 00000000..51944184 --- /dev/null +++ b/packages/doc/docs/deployment/gcp-app-engine.mdx @@ -0,0 +1,98 @@ +# GCP: App Engine + +In this step-by-step guide, we'll guide you how to deploy your VulcanSQL project to Google Cloud Platform(GCP) +using [App Engine](https://cloud.google.com/appengine). It's an application platform for developers to build monolithic +server-side rendered websites. + +:::info +For more detailed information of the deployment process, you can [read more here](https://cloud.google.com/appengine/docs/standard/nodejs/runtime). +::: + +## Step 1: Install and setup the Google Cloud CLI + +Before you begin to use Cloud Run on GCP, you need to do several things: +1. In the Google Cloud console, on the [project selector page](https://console.cloud.google.com/projectselector2/home/dashboard), select or create a Google Cloud project. +2. [Make sure the billing is enabled for your Google Cloud project.](https://cloud.google.com/billing/docs/how-to/verify-billing-enabled#console) +3. [Install](https://cloud.google.com/sdk/docs/install) the Google Cloud CLI. +4. Initialize the gcloud CLI with the following command: + ```shell + gcloud init + ``` +5. You can set the default project for your Cloud Run service with the following command: + ```shell + gcloud config set project [PROJECT_ID] + ``` + +For more detailed instructions on how to setup the environment, you can [read more here](https://cloud.google.com/appengine/docs/standard/nodejs/building-app/creating-project). + +## Step 2: Package your VulcanSQL project + +In this guide, we'll deploy your VulcanSQL project without Docker. So please execute the following command in the terminal: + +```bash +vulcan package --output node +``` + +After executing the command, you'll see a message shown like below and a new directory `dist` in the project directory. + +```bash +2023-08-08 08:59:27.666 INFO [CORE] Package successfully, you can go to "dist" folder and run "npm install && node index.js" to start the server +✔ Package successfully. +``` + +The directory structure of `dist` is as following: + +``` +dist +├── config.json +├── index.js +├── package.json +└── result.json +``` + +:::caution +External resources and configurations, such as `profiles.yaml`, are not copied to the `dist` folder. +You'll need to copy them manually. We strongly recommend using a separate profile instead of the one used for development. +::: + +## Step 3: Deploy to App Engine from source + +Now we need to do several things before deploying the app to App Engine: + +**1. Add `port:8080` to `config.json`** + +Since App Engine accepts network traffic with the [port 8080](https://cloud.google.com/appengine/docs/flexible/custom-runtimes/build#listening_to_port_8080). + +**2. Change the filename of `index.js` to `server.js` and also in `package.json`** + +Since App Engine recognizes [`server.js`](https://cloud.google.com/appengine/docs/standard/nodejs/building-app/writing-web-service#running_the_server_locally) as the entry file. + +**3. Create a new file `app.yaml` and fill in the following content** + +```yaml +runtime: nodejs +env: flex +runtime_config: + operating_system: "ubuntu22" + runtime_version: "18" +``` + +Finally, you can run the following command to deploy your app in the terminal: + +```shell +gcloud app deploy +``` + +After successfully deploying your VulcanSQL app, you'll see the similar message in the terminal: + +``` +Deployed service [default] to [https://cannerflow-286003.uw.r.appspot.com] + +You can stream logs from the command line by running: + $ gcloud app logs tail -s default + +To view your application in the web browser run: + $ gcloud app browse +``` + +Congratulations! Now your VulcanSQL app is on the cloud and is ready to be shared to the world! \ No newline at end of file diff --git a/packages/doc/docs/deployment/gcp-cloud-run.mdx b/packages/doc/docs/deployment/gcp-cloud-run.mdx index a579dfed..9ada1f62 100644 --- a/packages/doc/docs/deployment/gcp-cloud-run.mdx +++ b/packages/doc/docs/deployment/gcp-cloud-run.mdx @@ -14,7 +14,7 @@ Before you begin to use Cloud Run on GCP, you need to do several things: 1. In the Google Cloud console, on the [project selector page](https://console.cloud.google.com/projectselector2/home/dashboard), select or create a Google Cloud project. 2. [Make sure the billing is enabled for your Google Cloud project.](https://cloud.google.com/billing/docs/how-to/verify-billing-enabled#console) 3. [Install](https://cloud.google.com/sdk/docs/install) the Google Cloud CLI. -4. Initialize the gcloud CLI with the folowwing command: +4. Initialize the gcloud CLI with the following command: ```shell gcloud init ``` @@ -51,6 +51,11 @@ dist └── result.json ``` +:::caution +External resources and configurations, such as `profiles.yaml`, are not copied to the `dist` folder. +You'll need to copy them manually. We strongly recommend using a separate profile instead of the one used for development. +::: + ## Step 3: Deploy to Cloud Run from source Now you can deploy you VulcanSQL app to GCP with the following command: diff --git a/packages/doc/drafts/deployment/gcp-app-engine.mdx b/packages/doc/drafts/deployment/gcp-app-engine.mdx deleted file mode 100644 index ff6fa583..00000000 --- a/packages/doc/drafts/deployment/gcp-app-engine.mdx +++ /dev/null @@ -1 +0,0 @@ -# GCP: App Engine \ No newline at end of file diff --git a/packages/doc/sidebars.js b/packages/doc/sidebars.js index ae5ac5c9..ece855ec 100644 --- a/packages/doc/sidebars.js +++ b/packages/doc/sidebars.js @@ -402,10 +402,10 @@ const sidebars = { type: 'doc', id: 'deployment/gcp-cloud-run', }, - // { - // type: 'doc', - // id: 'deployment/gcp-app-engine', - // } + { + type: 'doc', + id: 'deployment/gcp-app-engine', + } ], }, { From e8eafb67acc02434ac6d0d32d659fef60ab0a234 Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Tue, 8 Aug 2023 17:45:47 +0800 Subject: [PATCH 08/11] fix missing words --- packages/doc/docs/deployment/flydotio.mdx | 3 ++- .../doc/docs/deployment/gcp-cloud-run.mdx | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/packages/doc/docs/deployment/flydotio.mdx b/packages/doc/docs/deployment/flydotio.mdx index 23c14657..36906524 100644 --- a/packages/doc/docs/deployment/flydotio.mdx +++ b/packages/doc/docs/deployment/flydotio.mdx @@ -115,7 +115,8 @@ ENV NODE_ENV production CMD [ "node", "index.js" ] ``` -**Notes: if you have [multiple profiles](../references/data-source-profile#define-profile-in-independent-yaml-files), you should copy them into the dist folder and add them all in the Dockerfile.** +**Notes: if you have [multiple profiles](../references/data-source-profile#define-profile-in-independent-yaml-files), +you should copy them into the dist folder and add them all in the Dockerfile.** ::: ## Step 4: Setup Fly.io deployment config diff --git a/packages/doc/docs/deployment/gcp-cloud-run.mdx b/packages/doc/docs/deployment/gcp-cloud-run.mdx index 9ada1f62..e935b4eb 100644 --- a/packages/doc/docs/deployment/gcp-cloud-run.mdx +++ b/packages/doc/docs/deployment/gcp-cloud-run.mdx @@ -54,6 +54,28 @@ dist :::caution External resources and configurations, such as `profiles.yaml`, are not copied to the `dist` folder. You'll need to copy them manually. We strongly recommend using a separate profile instead of the one used for development. + +After copying `profiles.yaml` into the `dist` folder, you should also add one line in `Dockerfile` as following: + +```shell +. +. +. +FROM node:16-bullseye-slim +WORKDIR /usr/app +COPY --from=build /usr/app /usr/app +COPY config.json . +COPY index.js . +COPY result.json . +# add the line below +COPY profiles.yaml . +ENV NODE_ENV production + +CMD [ "node", "index.js" ] +``` + +**Notes: if you have [multiple profiles](../references/data-source-profile#define-profile-in-independent-yaml-files), +you should copy them into the dist folder and add them all in the Dockerfile.** ::: ## Step 3: Deploy to Cloud Run from source From 16f00316c43f63aeedee5438a20557aab5f755b7 Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Tue, 8 Aug 2023 18:50:39 +0800 Subject: [PATCH 09/11] add clean up info --- packages/doc/docs/deployment/flydotio.mdx | 6 +++++- packages/doc/docs/deployment/gcp-app-engine.mdx | 6 +++++- packages/doc/docs/deployment/gcp-cloud-run.mdx | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/doc/docs/deployment/flydotio.mdx b/packages/doc/docs/deployment/flydotio.mdx index 36906524..48c7330c 100644 --- a/packages/doc/docs/deployment/flydotio.mdx +++ b/packages/doc/docs/deployment/flydotio.mdx @@ -181,4 +181,8 @@ Visit your newly deployed app at https://xxxxx/ You can read more here regarding to [deployment via Dockerfile](https://fly.io/docs/languages-and-frameworks/dockerfile/). ::: -Congratulations! Now your VulcanSQL app is on the cloud and is ready to be shared to the world! \ No newline at end of file +Congratulations! Now your VulcanSQL app is on the cloud and is ready to be shared to the world! + +:::info +If you need to clean up the resources on Fly.io, you can [read the documentation here](https://fly.io/docs/flyctl/destroy/). +::: \ No newline at end of file diff --git a/packages/doc/docs/deployment/gcp-app-engine.mdx b/packages/doc/docs/deployment/gcp-app-engine.mdx index 51944184..e20348be 100644 --- a/packages/doc/docs/deployment/gcp-app-engine.mdx +++ b/packages/doc/docs/deployment/gcp-app-engine.mdx @@ -95,4 +95,8 @@ To view your application in the web browser run: $ gcloud app browse ``` -Congratulations! Now your VulcanSQL app is on the cloud and is ready to be shared to the world! \ No newline at end of file +Congratulations! Now your VulcanSQL app is on the cloud and is ready to be shared to the world! + +:::info +If you need to clean up the resources on App Engine, you can [read the documentation here](https://cloud.google.com/appengine/docs/standard/python3/building-app/cleaning-up). +::: \ No newline at end of file diff --git a/packages/doc/docs/deployment/gcp-cloud-run.mdx b/packages/doc/docs/deployment/gcp-cloud-run.mdx index e935b4eb..6843c567 100644 --- a/packages/doc/docs/deployment/gcp-cloud-run.mdx +++ b/packages/doc/docs/deployment/gcp-cloud-run.mdx @@ -100,4 +100,8 @@ Service [vulcansql-project] revision [vulcansql-project-00001-mud] has been depl Service URL: https://vulcansql-project-ggcxvljfba-df.a.run.app ``` -Congratulations! Now your VulcanSQL app is on the cloud and is ready to be shared to the world! \ No newline at end of file +Congratulations! Now your VulcanSQL app is on the cloud and is ready to be shared to the world! + +:::info +If you need to clean up the resources on Cloud Run, you can [read the documentation here](https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-nodejs-service#clean-up). +::: \ No newline at end of file From dc9ebdad1f758a8b161f108f5f8f0ae0aada260e Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Thu, 10 Aug 2023 09:23:37 +0800 Subject: [PATCH 10/11] add catalog-server deployment guide --- packages/doc/docs/deployment/flydotio.mdx | 36 ++++++++++++-- .../doc/docs/deployment/gcp-app-engine.mdx | 47 +++++++++++++++++-- .../doc/docs/deployment/gcp-cloud-run.mdx | 31 ++++++++++-- 3 files changed, 103 insertions(+), 11 deletions(-) diff --git a/packages/doc/docs/deployment/flydotio.mdx b/packages/doc/docs/deployment/flydotio.mdx index 48c7330c..259f0a2a 100644 --- a/packages/doc/docs/deployment/flydotio.mdx +++ b/packages/doc/docs/deployment/flydotio.mdx @@ -66,12 +66,12 @@ successfully logged in as xxxxx@xxx For more detailed introduction on how to sign in, you can [read more here](https://fly.io/docs/hands-on/sign-in/). -## Step 3: Package your VulcanSQL project +## Step 3: Package your VulcanSQL API Server -In this guide, we'll deploy the Docker version of your VulcanSQL project. So please execute the following command in the terminal: +In this guide, we'll deploy the Docker version of your VulcanSQL API Server. So please execute the following command in the terminal: ```bash -vulcan package --output docker +vulcan package -o docker ``` After executing the command, you'll see a message shown like below and a new directory `dist` in the project directory. @@ -163,7 +163,7 @@ For more detailed introduction on how to launch your app, you can [read more her ## Step 5: Deploy to Fly.io -Finally, you can execute the following command in the terminal to deploy your VulcanSQL project and share it with the world! +Finally, you can execute the following command in the terminal to deploy your VulcanSQL API Server and share it with the world! ```shell fly deploy @@ -185,4 +185,30 @@ Congratulations! Now your VulcanSQL app is on the cloud and is ready to be share :::info If you need to clean up the resources on Fly.io, you can [read the documentation here](https://fly.io/docs/flyctl/destroy/). -::: \ No newline at end of file +::: + +## Step 6: (Optional) Deploy your VulcanSQL API Catalog Server + +If you need to deploy API Catalog Server, you should execute the following command in the terminal: + +```shell +vulcan package -t catalog-server -o docker +``` + +:::caution +The folder generated by the command is also called `dist`, so if you had executed the command of packaging +API server, you should rename the `dist` folder generated previously to prevent from being overwritten. +::: + +Then, you should modify `API_BASE_URL` to the URL of your VulcanSQL API Server you just deployed in Dockerfile: + +```dockerfile +ENV API_BASE_URL [URL of VulcanSQL API Server] +``` + +Finally, you execute the same Fly.io commands used in the step 4 and step 5 in the terminal, and change any configurations if you need: + +``` +fly launch +fly deploy +``` diff --git a/packages/doc/docs/deployment/gcp-app-engine.mdx b/packages/doc/docs/deployment/gcp-app-engine.mdx index e20348be..b2697e17 100644 --- a/packages/doc/docs/deployment/gcp-app-engine.mdx +++ b/packages/doc/docs/deployment/gcp-app-engine.mdx @@ -25,9 +25,9 @@ Before you begin to use Cloud Run on GCP, you need to do several things: For more detailed instructions on how to setup the environment, you can [read more here](https://cloud.google.com/appengine/docs/standard/nodejs/building-app/creating-project). -## Step 2: Package your VulcanSQL project +## Step 2: Package your VulcanSQL API Server -In this guide, we'll deploy your VulcanSQL project without Docker. So please execute the following command in the terminal: +In this guide, we'll deploy your VulcanSQL API Server without Docker. So please execute the following command in the terminal: ```bash vulcan package --output node @@ -99,4 +99,45 @@ Congratulations! Now your VulcanSQL app is on the cloud and is ready to be share :::info If you need to clean up the resources on App Engine, you can [read the documentation here](https://cloud.google.com/appengine/docs/standard/python3/building-app/cleaning-up). -::: \ No newline at end of file +::: + +## Step 4: (Optional) Deploy your VulcanSQL API Catalog Server + +If you need to deploy API Catalog Server, you should execute the following command in the terminal: + +```shell +vulcan package -t catalog-server +``` + +:::caution +The folder generated by the command is also called `dist`, so if you had executed the command of packaging +API server, you should rename the `dist` folder generated previously to prevent from being overwritten. +::: + +Now we need to do several things before deploying the app to App Engine: + +**1. Add `"config": {"port": 8080}` to `config.json`** + +Since App Engine accepts network traffic with the [port 8080](https://cloud.google.com/appengine/docs/flexible/custom-runtimes/build#listening_to_port_8080). + +**2. Change the filename of `index.js` to `server.js` and also in `package.json`** + +Since App Engine recognizes [`server.js`](https://cloud.google.com/appengine/docs/standard/nodejs/building-app/writing-web-service#running_the_server_locally) as the entry file. + +**3. Create a new file `app.yaml` and fill in the following content** + +```yaml +runtime: nodejs +env: flex +runtime_config: + operating_system: "ubuntu22" + runtime_version: "18" +env_variables: + VULCAN_SQL_HOST: [Your VulcanSQL API Server URL] +``` + +Finally, you execute the same Google Cloud CLI commands used in the step 3 in the terminal: + +``` +gcloud app deploy +``` diff --git a/packages/doc/docs/deployment/gcp-cloud-run.mdx b/packages/doc/docs/deployment/gcp-cloud-run.mdx index 6843c567..bd0c8877 100644 --- a/packages/doc/docs/deployment/gcp-cloud-run.mdx +++ b/packages/doc/docs/deployment/gcp-cloud-run.mdx @@ -25,9 +25,9 @@ Before you begin to use Cloud Run on GCP, you need to do several things: For more detailed instructions on how to setup the environment, you can [read more here](https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-nodejs-service#before-you-begin). -## Step 2: Package your VulcanSQL project +## Step 2: Package your VulcanSQL API Server -In this guide, we'll deploy the Docker version of your VulcanSQL project. So please execute the following command in the terminal: +In this guide, we'll deploy the Docker version of your VulcanSQL API Server. So please execute the following command in the terminal: ```bash vulcan package --output docker @@ -104,4 +104,29 @@ Congratulations! Now your VulcanSQL app is on the cloud and is ready to be share :::info If you need to clean up the resources on Cloud Run, you can [read the documentation here](https://cloud.google.com/run/docs/quickstarts/build-and-deploy/deploy-nodejs-service#clean-up). -::: \ No newline at end of file +::: + +## Step 4: (Optional) Deploy your VulcanSQL API Catalog Server + +If you need to deploy API Catalog Server, you should execute the following command in the terminal: + +```shell +vulcan package -t catalog-server -o docker +``` + +:::caution +The folder generated by the command is also called `dist`, so if you had executed the command of packaging +API server, you should rename the `dist` folder generated previously to prevent from being overwritten. +::: + +Then, you should modify `API_BASE_URL` to the URL of your VulcanSQL API Server you just deployed in Dockerfile: + +```dockerfile +ENV API_BASE_URL [URL of VulcanSQL API Server] +``` + +Finally, you execute the same Google Cloud CLI commands used in the step 3 in the terminal, and change any configurations if you need: + +``` +gloud run deploy [YOUR_CLOUDRUN_SERVICE_NAME] --port=4200 --allow-unauthenticated +``` From e3b2698f8eadacc2350a15a1a3877b8afcc5a3b3 Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Thu, 10 Aug 2023 09:51:01 +0800 Subject: [PATCH 11/11] remove redundant text --- packages/doc/docs/deployment/flydotio.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/doc/docs/deployment/flydotio.mdx b/packages/doc/docs/deployment/flydotio.mdx index 259f0a2a..4d49aa37 100644 --- a/packages/doc/docs/deployment/flydotio.mdx +++ b/packages/doc/docs/deployment/flydotio.mdx @@ -12,7 +12,7 @@ You should install the version that's appropriate for your operating system. After successfully installed `flyctl`, you should see the following message if you type `fly` in the terminal: ``` -cyyeh@JimmydeMBP vulcan-sql % fly +% fly This is flyctl, the Fly.io command line interface. Here's a few commands to get you started: