Giter Club home page Giter Club logo

sample-functions-mysql's Introduction

Sample Function: MySQL

Introduction

This repository contains a sample function that lets you connect to a MySQL instance and demonstrates performing some queries on it like creating a table and doing some selects. You can deploy it on DigitalOcean's AppPlatform as a Serverless Function component. You can optionally add your app as a trusted source to a DO Managed DBaaS instance and have the App connect to it securely.

Documentation is available at https://docs.digitalocean.com/products/functions

Requirements

  • You need a DigitalOcean account. If you don't already have one, you can sign up at https://cloud.digitalocean.com/registrations/new.
  • You need to have a MySQL database that the function can connect to. You can create a MySQL cluster on DO managed DBaaS
  • You need to provide the database connection string of the form mysql://{user}:{password}@{db_fqdn}:25060/{db_name}?ssl-mode=REQUIRED in the DATABASE_URL variable in the .env file.
  • To deploy from the command line, you will need the DigitalOcean doctl CLI.

Deploying the Function

# clone this repo
git clone [email protected]:digitalocean/sample-functions-mysql.git
# deploy the project, using a remote build so that compiled executable matched runtime environment
> doctl serverless deploy sample-functions-mysql --remote-build --env sample-functions-mysql/packages/ts/hello/.env
Deploying 'sample-functions-mysql'
  to namespace 'fn-...'
  on host 'https://faas-...'
Submitted action 'ts/hello' for remote building and deployment in runtime go:default (id: 7f947f1f0050461a947f1f0050261a5f)
Processing of action 'ts/hello' is still running remotely ...
Deployment status recorded in 'sample-functions-mysql/.deployed'

Deployed functions ('doctl sbx fn get <funcName> --url' for URL):
  - ts/hello

Learn More

You can learn more about Functions and App Platform integration in the official App Platform Documentation.

sample-functions-mysql's People

Contributors

piyush0101 avatar

Watchers

 avatar

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.