Code Monkey home page Code Monkey logo

deploystack-serverless-e2e-photo-sharing-app's Introduction

Build an serverless end-to-end photo sharing application with Google Cloud

This deploystack will help you create a scalable end-to-end photo-sharing application with 11 Google Cloud, Terraform, and Django.

Architecture

architecture

Components created:

  • Cloud Run - which will run the app as the main server.
  • Cloud SQL - To store relational database such as user info, posts.
  • Cloud Storage - To store non-relational database such as post media.
  • Cloud Load Balancer - To server traffic with multiple regions.
  • Cloud DNS - To map custom domain and handle requests from your local machines everytime you go to the url.
  • Cloud Build - apply DevOps CI/CD to automatically deploy your app from gcloud.
  • Secret Manager - To improve the security of the app.
  • Cloud VPC - To connect Cloud SQL with Cloud Run via private network.
  • Cloud DNS - to store static cache for faster connections.
  • Translation API - to translate the post caption if it is in another language.
  • Container Registry - to store, manage, and secure your Docker container images.

What you can do with this app:

  • Create post with media and caption
  • Search users
  • View newsfeed
  • Follow other users
  • Change profile picture
  • Translate the post caption to English

Install

You can install this application using the Open in Google Cloud Shell button below.

Open in Cloud Shell

Clicking this link will take you right to the DeployStack app, running in your Cloud Shell environment. It will walk you through setting up your architecture.

Cleanup

To remove all billing components from the project

  1. Remove componets with terraform apply -auto-approve -var=project=${PROJECT}
  2. Typing deploystack uninstall

How to run

1. Create project with billing enabled, and configure gcloud for that project

export PROJECT_ID=foobar
gcloud config set project $PROJECT_ID

2. Configure default credentials (allows Terraform to apply changes):

gcloud auth application-default login

To double check, run gcloud auth list To set active account, run gcloud config set account ACCOUNT

3. Enable base services:

gcloud services enable \
  cloudbuild.googleapis.com \
  run.googleapis.com \
  vpcaccess.googleapis.com

4. Build base image

gcloud builds submit

5. Run ./test

Check the output url from Cloud Run

Local deployment:

  1. Go to Cloud SQL to get your connection name. It should be in the format: {PROJECT_ID}:{SQL_INSTANCE_REGION}:{SQL_INSTANCE_NAME}
  2. In another terminal, run ./cloud_sql_proxy -instances={CONNECTION_NAME}=tcp:0.0.0.0:8002
  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.

Django models migration

  1. Follow steps in local deployment

  2. On your app's terminal, run**PRODUCTION_MODE="local" python3 manage.py migrate

  3. Build base image to push new changes to Container Registry

    gcloud builds submit
    
  4. Run ./test

    Check the output url from Cloud Run with new changes


Have issues or questions, visit Issues.

This is not an official Google product.

deploystack-serverless-e2e-photo-sharing-app's People

Contributors

chrislevn avatar tpryan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deploystack-serverless-e2e-photo-sharing-app's Issues

Security Policy violation Binary Artifacts

This issue was automatically created by Allstar.

Security Policy Violation
Project is out of compliance with Binary Artifacts policy: binaries present in source code

Rule Description
Binary Artifacts are an increased security risk in your repository. Binary artifacts cannot be reviewed, allowing the introduction of possibly obsolete or maliciously subverted executables. For more information see the Security Scorecards Documentation for Binary Artifacts.

Remediation Steps
To remediate, remove the generated executable artifacts from the repository.

First 10 Artifacts Found

  • core/pycache/init.cpython-310.pyc
  • core/pycache/init.cpython-37.pyc
  • core/pycache/init.cpython-39.pyc
  • core/pycache/admin.cpython-310.pyc
  • core/pycache/apps.cpython-310.pyc
  • core/pycache/models.cpython-310.pyc
  • core/pycache/urls.cpython-310.pyc
  • core/pycache/views.cpython-310.pyc
  • core/migrations/pycache/0001_initial.cpython-310.pyc
  • core/migrations/pycache/0002_comment_postgcp.cpython-310.pyc
  • Run a Scorecards scan to see full list.

Additional Information
This policy is drawn from Security Scorecards, which is a tool that scores a project's adherence to security best practices. You may wish to run a Scorecards scan directly on this repository for more details.


Allstar has been installed on all Google managed GitHub orgs. Policies are gradually being rolled out and enforced by the GOSST and OSPO teams. Learn more at http://go/allstar

This issue will auto resolve when the policy is in compliance.

Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.