yc is the command-line interface (CLI) tool for deploying your serverless functions on Vivgrid. It provides a convenient way to manage your deployments and serverless instances globally.

Installation

To install yc, you can use the following command:

curl "https://bina.egoist.dev/vivgrid/yc" | sh

Usage

yc --help to see all sub-commands.

General Options:

  • --app-key: The application key of your Vivgrid project.
  • --app-secret: The application secret of your Vivgrid project.
  • --sfn-name: The name of your serverless function calling service.
  • --zipper: The URL of the Vivgrid Zipper Service endpoint, the default value is zipper.vivgrid.com.
  • --env: The environment variables for your serverless function. you can pass multiple --env options like yc deploy app.go --env OPENWEATHERMAP_API_KEY=token --env GITHUB_API_KEY=token.

You can create a yc.yml file in the root of your project to configure the deployment settings instead of passing the options every time.

yc deploy [FILE]…

This command will deploy your serverless function to Vivgrid hosting.

yc deploy app.go --env KEY=VALUE

Manage serverless deployment

Your serverless code will be uploaded to Vivgrid and compiled by yc upload command, after that, you can create the deployments by yc create command.

yc upload

This command will compile your serverless function after uploading to Vivgrid hosting.

yc upload app.go

yc create

This command will create the deployments.

yc create

yc remove

This command will delete the deployments.

yc remove

Manage serverless state

Once the deployment is created, you can manage the state of the deployments. yc start will start the serverless on all regions. Requests will be routed to the nearest region by Vivgrid Geo-distributed Network.

yc status

This command will show the status of the deployments.

yc status

yc start

This command will start serverless instances in all regions.

yc start

yc stop

This command will stop serverless instances in all regions.

yc stop

Observability

yc logs

This command will show the real-time logs of serverless instances across all regions.

yc logs

Terminate the logs by pressing Ctrl + C.

yc.yml Configuration File

You can create a yc.yml file in the root of your project to configure the deployment settings.

zipper: zipper.vivgrid.com:9000
app-key: <APP_KEY>
app-secret: <APP_SECRET>
sfn-name: your_function_name
  • zipper (optional): The URL of the Vivgrid Zipper Service endpoint, the default value is zipper.vivgrid.com:9000.
  • app-key: The application key of your Vivgrid project.
  • app-secret: The application secret of your Vivgrid project.
  • sfn-name: The name of your serverless function calling service.

Set Environment Variables

You can set environment variables for your serverless function by passing the --env option.

yc deploy app.go --env KEY1=VALUE1 --env KEY2=VALUE2