Skip to content

bedrockio/bedrock-cli

Repository files navigation

Bedrock CLI

Run Tests

The Bedrock Command Line Interface can be used to manage Bedrock projects and deployments.

Installation

curl -s https://install.bedrock.io | bash

Create a New Project

bedrock create

Quick create:

bedrock create \
  --domain seltzerbox.com \
  --repository github.com/dominiek/seltzer-box \
  seltzer-box

Deploy your Project

To use the bedrock cloud commands, check the bedrock-core Deployment README.md, which includes: gcloud setup, deployment and provisioning.

Provisioning will allow new infrastructure to be created on Google Cloud using Terraform. CLI commands will also let you deploy and control a Kubernetes cluster.

Google Cloud Platform

Bedrock uses GCP as it's standard cloud solution for hosting and deploying Bedrock projects. Projects are built using docker and deployed with kubernetes.

Slack integration

The bedrock cloud deploy command supports posting message on a Slack channel when starting and finishing the deploy. This requires the following steps:

  • Create a new Slack App at api.slack.com for your workspace
  • Optional: Update your Slack with a nice Icon and description
  • Create incoming webhook. Select this feature in the menu, and hit Add New Webhook to Workspace. It will ask you to select the Slack channel in your workspace to post messages to.
  • Copy the generated Webhook URL, which includes the api token
  • Paste the Webhook URL in your project's deployment environment config.json (See Deployment README.md). Example deployment/environments/staging/config.json (replace webhook value with your own Webhook URL):
{
  "gcloud": {
    "envName": "staging",
    "bucketPrefix": "bedrock-foundation-staging",
    "project": "bedrock-foundation-staging",
    "computeZone": "us-east1-c",
    "kubernetes": {
      "clusterName": "cluster-2",
      "nodePoolCount": 1,
      "minNodeCount": 1,
      "maxNodeCount": 3,
      "machineType": "n2-standard-2"
    },
    "label": "app"
  },
  "slack": {
    "webhook": "https://hooks.slack.com/services/xxxxxxxx/xxxxxxxx"
  }
}

Each environment can use the same webhook for the same channel, or you can set up a different channel and webhook for each environment.

Authorization

  • Use gcloud auth login and gcloud auth application-default login to login to the right Google account, or bedrock cloud login
  • Use bedrock cloud authorize staging to get cluster credentials
  • If you've used gcloud auth with another account, run gcloud config set account <EMAIL> or bedrock cloud account <EMAIL>, then re-run bedrock cloud authorize.

If you get this error when trying to deploy:

unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials

Then do the following

gcloud auth configure-docker

or

gcloud docker --authorize-only

Remote Builds

The following commands will build a docker image locally:

  • bedrock cloud build
  • bedrock cloud deploy

There is also the option to build the image remotely using GCP Container Registry:

  • bedrock cloud build --remote
  • bedrock cloud deploy --remote

This may be advantageous as it requires less data to transfer (pushing a tarball of the source vs pushing up an entire docker image), also notably docker images take much longer to build on Apple Silicon as they must compile to x86 targets.

More

Use the help command for more information on CLI commands:

bedrock help

About

Bedrock CLI allows you to create and control Bedrock based deployments.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5