Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bend-sdk3

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bend-sdk3

Data-service for Bend API

  • 0.1.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Development

Steps for new developers to get up and running with the Bend data-service

Setting up the database
  1. Install Postgres
  2. Install diesel for Postres: cargo install diesel_cli --no-default-features --features postgres
  3. Copy example.env to .env (should just work with default local config)
  4. Run diesel setup
Run the app

cargo run

Publishing the Image

  1. Install Google Cloud SDK
  2. Ensure you have access to the Container Registrar service account in GCP IAM & Admin
  3. Run gcloud auth login using an account with access to the Container Registrar
  4. Run docker tag tcmoore/bend-api-service gcr.io/{PROJECT_ID}/api-service (You can find the project id here)
  5. Run docker push gcr.io/bend-330614/api-service

DB Connectivity

Note that bend-db indicates the Cloud SQL instance, while bend_db indicates the postgres database name

Setting up a new database

  1. Create a new Postgres instance in Cloud SQL and store the root password somewhere secure
  2. Wait for the instance to boot up, then connect:
  3. Run gcloud sql connect bend-db --user=postgres --project PROJECT_ID and enter your password
  4. You can now run diesel setup
  • Using: DATABASE_URL=postgres://postgres:{ROOT_PASSWORD}@{YOUR_DB_PUBLIC_IP}/bend_db

Running migrations

  1. Run gcloud sql connect bend-db --user=postgres --project PROJECT_ID and enter your password
  2. You can now run migrations for 5 minutes with Diesel with diesel migration run
  • Using: DATABASE_URL=postgres://postgres:{ROOT_PASSWORD}@{YOUR_DB_PUBLIC_IP}/bend-db

Connecting Cloud Run to Cloud SQL

Steps to connect to Cloud SQL from the api service in the cloud environment:

  1. Ensure that a service account exists with the Cloud SQL Client permissions
  2. Deploy a new revision of the Cloud Run instance with a Connection enabled (in the Connections tab) to the SQL instance
  3. In Cloud Run, the DATABASE_URL must take a slightly different form to support the unix socket path
  • postgres://{USER}:{PASSWORD}@?host=/cloudsql/{CLOUD_SQL_CONNECTION_NAME}&dbname=bend_db

See Official Docs for additional details.

FAQs

Package last updated on 28 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc