Automate your Edge Compute deployments with continuous integration and delivery pipelines. This guide covers integration with popular CI/CD platforms.
Overview
The deployment workflow:
- Push code to your repository
- CI runs tests and builds your function
- Deploy to Telnyx using the CLI
- Verify deployment with health checks
Authentication
CI/CD pipelines need a Telnyx API key to deploy functions. Create a deployment key in the Telnyx Portal with Edge Compute permissions.
Store your API key as a secret in your CI/CD platform. Never commit API keys to your repository.
GitHub Actions
Deploy on every push to main:
# .github/workflows/deploy.yml
name: Deploy Edge Function
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Telnyx CLI
run: |
# Download from https://github.com/team-telnyx/edge-compute/releases
wget -qO- https://github.com/team-telnyx/edge-compute/releases/latest/download/telnyx-edge-linux-amd64.tar.gz | tar xz
sudo mv telnyx-edge /usr/local/bin/
echo "$HOME/.telnyx/bin" >> $GITHUB_PATH
- name: Deploy function
env:
TELNYX_API_KEY: ${{ secrets.TELNYX_API_KEY }}
run: telnyx-edge ship
With Tests
Run tests before deploying:
name: Test and Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
run: pytest tests/
deploy:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Telnyx CLI
run: |
# Download from https://github.com/team-telnyx/edge-compute/releases
wget -qO- https://github.com/team-telnyx/edge-compute/releases/latest/download/telnyx-edge-linux-amd64.tar.gz | tar xz
sudo mv telnyx-edge /usr/local/bin/
echo "$HOME/.telnyx/bin" >> $GITHUB_PATH
- name: Deploy
env:
TELNYX_API_KEY: ${{ secrets.TELNYX_API_KEY }}
run: telnyx-edge ship
Multi-Language Examples
JavaScript
Go
Python
Java
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Install Telnyx CLI
run: |
# Download from https://github.com/team-telnyx/edge-compute/releases
wget -qO- https://github.com/team-telnyx/edge-compute/releases/latest/download/telnyx-edge-linux-amd64.tar.gz | tar xz
sudo mv telnyx-edge /usr/local/bin/
echo "$HOME/.telnyx/bin" >> $GITHUB_PATH
- name: Deploy
env:
TELNYX_API_KEY: ${{ secrets.TELNYX_API_KEY }}
run: telnyx-edge ship
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Run tests
run: go test ./...
- name: Install Telnyx CLI
run: |
# Download from https://github.com/team-telnyx/edge-compute/releases
wget -qO- https://github.com/team-telnyx/edge-compute/releases/latest/download/telnyx-edge-linux-amd64.tar.gz | tar xz
sudo mv telnyx-edge /usr/local/bin/
echo "$HOME/.telnyx/bin" >> $GITHUB_PATH
- name: Deploy
env:
TELNYX_API_KEY: ${{ secrets.TELNYX_API_KEY }}
run: telnyx-edge ship
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
run: pytest
- name: Install Telnyx CLI
run: |
# Download from https://github.com/team-telnyx/edge-compute/releases
wget -qO- https://github.com/team-telnyx/edge-compute/releases/latest/download/telnyx-edge-linux-amd64.tar.gz | tar xz
sudo mv telnyx-edge /usr/local/bin/
echo "$HOME/.telnyx/bin" >> $GITHUB_PATH
- name: Deploy
env:
TELNYX_API_KEY: ${{ secrets.TELNYX_API_KEY }}
run: telnyx-edge ship
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Build and test
run: mvn verify
- name: Install Telnyx CLI
run: |
# Download from https://github.com/team-telnyx/edge-compute/releases
wget -qO- https://github.com/team-telnyx/edge-compute/releases/latest/download/telnyx-edge-linux-amd64.tar.gz | tar xz
sudo mv telnyx-edge /usr/local/bin/
echo "$HOME/.telnyx/bin" >> $GITHUB_PATH
- name: Deploy
env:
TELNYX_API_KEY: ${{ secrets.TELNYX_API_KEY }}
run: telnyx-edge ship
GitLab CI
# .gitlab-ci.yml
stages:
- test
- deploy
test:
stage: test
image: python:3.11
script:
- pip install -r requirements.txt
- pytest tests/
deploy:
stage: deploy
image: ubuntu:latest
only:
- main
script:
- # Download from https://github.com/team-telnyx/edge-compute/releases
wget -qO- https://github.com/team-telnyx/edge-compute/releases/latest/download/telnyx-edge-linux-amd64.tar.gz | tar xz
sudo mv telnyx-edge /usr/local/bin/
- export PATH="$HOME/.telnyx/bin:$PATH"
- telnyx-edge ship
variables:
TELNYX_API_KEY: $TELNYX_API_KEY
CircleCI
# .circleci/config.yml
version: 2.1
jobs:
test:
docker:
- image: cimg/python:3.11
steps:
- checkout
- run:
name: Install dependencies
command: pip install -r requirements.txt
- run:
name: Run tests
command: pytest
deploy:
docker:
- image: cimg/base:current
steps:
- checkout
- run:
name: Install Telnyx CLI
command: |
# Download from https://github.com/team-telnyx/edge-compute/releases
wget -qO- https://github.com/team-telnyx/edge-compute/releases/latest/download/telnyx-edge-linux-amd64.tar.gz | tar xz
sudo mv telnyx-edge /usr/local/bin/
echo 'export PATH="$HOME/.telnyx/bin:$PATH"' >> $BASH_ENV
- run:
name: Deploy
command: telnyx-edge ship
workflows:
test-and-deploy:
jobs:
- test
- deploy:
requires:
- test
filters:
branches:
only: main
Deploy to different environments (staging, production) using branches or tags:
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main, staging]
tags: ['v*']
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Telnyx CLI
run: |
# Download from https://github.com/team-telnyx/edge-compute/releases
wget -qO- https://github.com/team-telnyx/edge-compute/releases/latest/download/telnyx-edge-linux-amd64.tar.gz | tar xz
sudo mv telnyx-edge /usr/local/bin/
echo "$HOME/.telnyx/bin" >> $GITHUB_PATH
- name: Deploy to dev
if: github.ref == 'refs/heads/staging'
env:
TELNYX_API_KEY: ${{ secrets.TELNYX_API_KEY_DEV }}
run: telnyx-edge ship --env dev
- name: Deploy to production
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
env:
TELNYX_API_KEY: ${{ secrets.TELNYX_API_KEY_PRODUCTION }}
run: telnyx-edge ship --env prod
Rollbacks
To roll back a deployment, redeploy a previous Git commit:
# Revert to previous commit
git revert HEAD
git push origin main
# Or checkout and deploy a specific commit
git checkout <previous-commit-sha>
telnyx-edge ship
git checkout main
Version history and CLI rollback commands are coming soon. For now, use Git-based rollbacks as shown above.
Health Checks
Add health checks to detect issues after deployment:
- name: Deploy
run: telnyx-edge ship
- name: Health check
run: |
sleep 10 # Wait for deployment to propagate
STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://my-function-abc123.telnyxcompute.com/health)
if [ "$STATUS" != "200" ]; then
echo "Health check failed!"
exit 1
fi
If the health check fails, manually revert and redeploy:
git revert HEAD
git push origin main # Triggers new deployment
Secrets Management
GitHub Actions Secrets
- Go to Settings → Secrets and variables → Actions
- Click New repository secret
- Add
TELNYX_API_KEY with your API key
GitLab CI Variables
- Go to Settings → CI/CD → Variables
- Add
TELNYX_API_KEY as a masked variable
Environment-Specific Secrets
Use different API keys per environment:
env:
TELNYX_API_KEY: ${{ github.ref == 'refs/heads/main'
&& secrets.TELNYX_API_KEY_PROD
|| secrets.TELNYX_API_KEY_STAGING }}
Deployment Notifications
Slack Notification
- name: Notify Slack
if: always()
uses: slackapi/slack-github-action@v1
with:
payload: |
{
"text": "Deployment ${{ job.status }}: ${{ github.repository }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*${{ github.repository }}* deployment ${{ job.status }}\nCommit: `${{ github.sha }}`\nBranch: `${{ github.ref_name }}`"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
Best Practices
Branch Protection
Require CI to pass before merging:
- Enable required status checks on
main branch
- Require pull request reviews
- Run tests on all pull requests
Deployment Frequency
- Development: Deploy on every commit to feature branches
- Staging: Deploy on merge to
staging branch
- Production: Deploy on merge to
main or version tags
Monitoring Deployments
After deployment, monitor:
- Function invocation metrics
- Error rates
- Response latency
- Cold start frequency
See Observability for monitoring setup.
Troubleshooting
Authentication Errors
- Verify
TELNYX_API_KEY secret is set correctly
- Check API key has Edge Compute permissions
- Ensure secret name matches workflow variable
Build Failures
- Check your
func.toml configuration is valid
- Verify dependencies are correctly specified
- Check dependency versions match CI environment
- Verify
func.toml configuration
Deployment Timeouts
Error: Deployment timed out
- Check function size is within limits
- Verify network connectivity from CI runner
- Retry with
--verbose flag for details