Skip to content

Commit 8680327

Browse files
committed
add gcp:app engine
1 parent 8a4dc1e commit 8680327

4 files changed

Lines changed: 108 additions & 6 deletions

File tree

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# GCP: App Engine
2+
3+
In this step-by-step guide, we'll guide you how to deploy your VulcanSQL project to Google Cloud Platform(GCP)
4+
using [App Engine](https://cloud.google.com/appengine). It's an application platform for developers to build monolithic
5+
server-side rendered websites.
6+
7+
:::info
8+
For more detailed information of the deployment process, you can [read more here](https://cloud.google.com/appengine/docs/standard/nodejs/runtime).
9+
:::
10+
11+
## Step 1: Install and setup the Google Cloud CLI
12+
13+
Before you begin to use Cloud Run on GCP, you need to do several things:
14+
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.
15+
2. [Make sure the billing is enabled for your Google Cloud project.](https://cloud.google.com/billing/docs/how-to/verify-billing-enabled#console)
16+
3. [Install](https://cloud.google.com/sdk/docs/install) the Google Cloud CLI.
17+
4. Initialize the gcloud CLI with the following command:
18+
```shell
19+
gcloud init
20+
```
21+
5. You can set the default project for your Cloud Run service with the following command:
22+
```shell
23+
gcloud config set project [PROJECT_ID]
24+
```
25+
26+
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).
27+
28+
## Step 2: Package your VulcanSQL project
29+
30+
In this guide, we'll deploy your VulcanSQL project without Docker. So please execute the following command in the terminal:
31+
32+
```bash
33+
vulcan package --output node
34+
```
35+
36+
After executing the command, you'll see a message shown like below and a new directory `dist` in the project directory.
37+
38+
```bash
39+
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
40+
✔ Package successfully.
41+
```
42+
43+
The directory structure of `dist` is as following:
44+
45+
```
46+
dist
47+
├── config.json
48+
├── index.js
49+
├── package.json
50+
└── result.json
51+
```
52+
53+
:::caution
54+
External resources and configurations, such as `profiles.yaml`, are not copied to the `dist` folder.
55+
You'll need to copy them manually. We strongly recommend using a separate profile instead of the one used for development.
56+
:::
57+
58+
## Step 3: Deploy to App Engine from source
59+
60+
Now we need to do several things before deploying the app to App Engine:
61+
62+
**1. Add `port:8080` to `config.json`**
63+
64+
Since App Engine accepts network traffic with the [port 8080](https://cloud.google.com/appengine/docs/flexible/custom-runtimes/build#listening_to_port_8080).
65+
66+
**2. Change the filename of `index.js` to `server.js` and also in `package.json`**
67+
68+
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.
69+
70+
**3. Create a new file `app.yaml` and fill in the following content**
71+
72+
```yaml
73+
runtime: nodejs
74+
env: flex
75+
runtime_config:
76+
operating_system: "ubuntu22"
77+
runtime_version: "18"
78+
```
79+
80+
Finally, you can run the following command to deploy your app in the terminal:
81+
82+
```shell
83+
gcloud app deploy
84+
```
85+
86+
After successfully deploying your VulcanSQL app, you'll see the similar message in the terminal:
87+
88+
```
89+
Deployed service [default] to [https://cannerflow-286003.uw.r.appspot.com]
90+
91+
You can stream logs from the command line by running:
92+
$ gcloud app logs tail -s default
93+
94+
To view your application in the web browser run:
95+
$ gcloud app browse
96+
```
97+
98+
Congratulations! Now your VulcanSQL app is on the cloud and is ready to be shared to the world!

packages/doc/docs/deployment/gcp-cloud-run.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Before you begin to use Cloud Run on GCP, you need to do several things:
1414
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.
1515
2. [Make sure the billing is enabled for your Google Cloud project.](https://cloud.google.com/billing/docs/how-to/verify-billing-enabled#console)
1616
3. [Install](https://cloud.google.com/sdk/docs/install) the Google Cloud CLI.
17-
4. Initialize the gcloud CLI with the folowwing command:
17+
4. Initialize the gcloud CLI with the following command:
1818
```shell
1919
gcloud init
2020
```
@@ -51,6 +51,11 @@ dist
5151
└── result.json
5252
```
5353

54+
:::caution
55+
External resources and configurations, such as `profiles.yaml`, are not copied to the `dist` folder.
56+
You'll need to copy them manually. We strongly recommend using a separate profile instead of the one used for development.
57+
:::
58+
5459
## Step 3: Deploy to Cloud Run from source
5560

5661
Now you can deploy you VulcanSQL app to GCP with the following command:

packages/doc/drafts/deployment/gcp-app-engine.mdx

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/doc/sidebars.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,10 @@ const sidebars = {
402402
type: 'doc',
403403
id: 'deployment/gcp-cloud-run',
404404
},
405-
// {
406-
// type: 'doc',
407-
// id: 'deployment/gcp-app-engine',
408-
// }
405+
{
406+
type: 'doc',
407+
id: 'deployment/gcp-app-engine',
408+
}
409409
],
410410
},
411411
{

0 commit comments

Comments
 (0)