Skip to content

Commit a1fb76b

Browse files
authored
Update README.md
1 parent 61b2889 commit a1fb76b

1 file changed

Lines changed: 40 additions & 25 deletions

File tree

README.md

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
# Build an serverless end-to-end photo sharing application with Google Cloud
22

3-
This repo will help you create an end-to-end social media web app with Google Cloud and Terraform
3+
This deploystack will help you create a scalable end-to-end photo-sharing application with 11 Google Cloud, Terraform, and Django.
4+
5+
## Architecture
6+
47
![architecture](architecture.png)
58

6-
Components created:
7-
* Cloud Run - which will run the app as the main server
8-
* Cloud SQL - To store relational database such as user info, posts
9-
* Cloud Storage - To store non-relational database such as post media
10-
* Cloud Load Balancer - To server traffic with multiple regions
11-
* Cloud DNS - To map custom domain
12-
* Cloud Build - To automatically deploy your app from gcloud
13-
* Secret Manager - To improve the security of the app
14-
* Cloud VPC - To connect Cloud SQL with Cloud Run via Private improve
15-
* Cloud DNS - to store static cache for faster connections
16-
* Translation API - to translate the post caption if it is in another language
17-
18-
What you can do with this app:
9+
**Components created:**
10+
* Cloud Run - which will run the app as the main server.
11+
* Cloud SQL - To store relational database such as user info, posts.
12+
* Cloud Storage - To store non-relational database such as post media.
13+
* Cloud Load Balancer - To server traffic with multiple regions.
14+
* Cloud DNS - To map custom domain and handle requests from your local machines everytime you go to the url.
15+
* Cloud Build - apply DevOps CI/CD to automatically deploy your app from gcloud.
16+
* Secret Manager - To improve the security of the app.
17+
* Cloud VPC - To connect Cloud SQL with Cloud Run via private network.
18+
* Cloud DNS - to store static cache for faster connections.
19+
* Translation API - to translate the post caption if it is in another language.
20+
* Container Registry - to store, manage, and secure your Docker container images.
21+
22+
**What you can do with this app:**
1923
* Create post with media and caption
2024
* Search users
2125
* View newsfeed
@@ -40,14 +44,14 @@ To remove all billing components from the project
4044
2. Typing `deploystack uninstall`
4145

4246
## How to run
43-
1. Create project with billing enabled, and configure gcloud for that project
47+
**1. Create project with billing enabled, and configure gcloud for that project**
4448

4549
```
4650
export PROJECT_ID=foobar
4751
gcloud config set project $PROJECT_ID
4852
```
4953

50-
2. Configure default credentials (allows Terraform to apply changes):
54+
**2. Configure default credentials (allows Terraform to apply changes):**
5155

5256
```
5357
gcloud auth application-default login
@@ -56,7 +60,7 @@ To remove all billing components from the project
5660
To double check, run ```gcloud auth list```
5761
To set active account, run gcloud config set account `ACCOUNT`
5862

59-
3. Enable base services:
63+
**3. Enable base services:**
6064

6165
```
6266
gcloud services enable \
@@ -65,25 +69,36 @@ To remove all billing components from the project
6569
vpcaccess.googleapis.com
6670
```
6771

68-
4. Build base image
72+
**4. Build base image**
6973

7074
```
7175
gcloud builds submit
7276
```
7377

74-
5. Run ```./test```
78+
**5. Run** ```./test```
7579

7680
Check the output url from Cloud Run
7781

78-
## Migrate your models:
79-
* Go to Cloud SQL to get your connection name. It should be in the format: {PROJECT_ID}:{SQL_INSTANCE_REGION}:{SQL_INSTANCE_NAME}.
80-
* Run ```PRODUCTION_MODE="local" python3 manage.py runserver --insecure 0.0.0.0:8080``` to test if the app can be run locally and connected to Cloud SQL.
82+
## Local deployment:
83+
1. Go to Cloud SQL to get your connection name. It should be in the format: ```{PROJECT_ID}:{SQL_INSTANCE_REGION}:{SQL_INSTANCE_NAME}```
84+
2. In another terminal, run ```./cloud_sql_proxy -instances={CONNECTION_NAME}=tcp:0.0.0.0:8002```
85+
3. Run ```PRODUCTION_MODE="local" python3 manage.py runserver --insecure 0.0.0.0:8080``` to run the app locally and connect to Cloud SQL.
86+
87+
### Django models migration
88+
1. Follow steps in **local deployment**
89+
2. On your app's terminal, run**```PRODUCTION_MODE="local" python3 manage.py migrate```
90+
3. Build base image to push new changes to Container Registry
91+
92+
```
93+
gcloud builds submit
94+
```
95+
96+
4. Run ```./test```
8197

82-
* In another terminal, run ```./cloud_sql_proxy -instances={CONNECTION_NAME}=tcp:0.0.0.0:8002```
83-
* On your app's terminal, run ```PRODUCTION_MODE="local" python3 manage.py migrate```
98+
Check the output url from Cloud Run with new changes
8499

85-
* Run step 4 and step 5 in *How to run* again to apply new changes on server.
86100

101+
---
87102
Have issues or questions, visit [Issues](https://github.com/GoogleCloudPlatform/deploystack-serverless-e2e-photo-sharing-app/issues).
88103

89104
This is not an official Google product.

0 commit comments

Comments
 (0)