Automated Deploys
It’s fairly straightforward to setup automation for deploying your code to Beam. At a high level, the following steps are all you need:
curl https://raw.githubusercontent.com/slai-labs/get-beam/main/get-beam.sh -sSfL | sh
pip3 install --upgrade pip
pip3 install beam-sdk
beam configure --clientId=$BEAM_CLIENT_ID --clientSecret=$BEAM_CLIENT_SECRET --profile=$PROFILE
beam deploy app.py --$PROFILE
Authentication
You can initialize Beam with inline credentials using the beam configure
command.
You can also add an optional field --profileName
to override the default profile. For example, you might want separate dev, staging, and prod profiles.
beam configure --clientId="MY_CLIENT_ID" --clientSecret="MY_CLIENT_SECRET" --profileName="staging"
Example: Deploy on Github Commit
You can setup a Github workflow to deploy your code whenever a new commit is made to your Git repo. Here’s an example workflow:
name: deploy-beam
on:
push:
branches:
- master
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v3
- name: Authenticate Beam and Deploy
env:
BEAM_CLIENT_ID: ${{ secrets.BEAM_CLIENT_ID }}
BEAM_CLIENT_SECRET: ${{ secrets.BEAM_CLIENT_SECRET }}
PROFILE: ${{ secrets.BEAM_PROFILE }}
run: |
curl https://raw.githubusercontent.com/slai-labs/get-beam/main/get-beam.sh -sSfL | sh
pip3 install --upgrade pip
pip3 install beam-sdk
beam configure --clientId=$BEAM_CLIENT_ID --clientSecret=$BEAM_CLIENT_SECRET
beam deploy app.py