The Bedrock Command Line Interface can be used to manage Bedrock projects and deployments.
curl -s https://install.bedrock.io | bashbedrock createQuick create:
bedrock create \
--domain seltzerbox.com \
--repository github.com/dominiek/seltzer-box \
seltzer-boxTo 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.
Bedrock uses GCP as it's standard cloud solution for hosting and deploying Bedrock projects. Projects are built using docker and deployed with kubernetes.
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 hitAdd 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). Exampledeployment/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.
- Use
gcloud auth loginandgcloud auth application-default loginto login to the right Google account, orbedrock cloud login - Use
bedrock cloud authorize stagingto get cluster credentials - If you've used
gcloud authwith another account, rungcloud config set account <EMAIL>orbedrock cloud account <EMAIL>, then re-runbedrock 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
The following commands will build a docker image locally:
bedrock cloud buildbedrock cloud deploy
There is also the option to build the image remotely using GCP Container Registry:
bedrock cloud build --remotebedrock 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.
Use the help command for more information on CLI commands:
bedrock help