Intermediate
30 mins

Continuous Deployment

Automate your deployment process with Symbiosis.host's continuous deployment features. Learn how to set up automated builds, testing, and deployments triggered by Git changes.

Prerequisites

  • A Symbiosis.host account
  • Git repository with your application code
  • Basic understanding of CI/CD concepts
  • Completed the Quick Start Guide

CD Workflow Overview

Continuous Deployment Workflow

Visual representation of the continuous deployment workflow from code commit to production.

1

Connect Your Repository

First, connect your Git repository to enable automated deployments:

# Using the CLI
symbiosis git connect

# Or connect through the dashboard:
# 1. Go to Project Settings
# 2. Select Git Integration
# 3. Choose your Git provider
# 4. Select your repository
2

Configure Build Settings

Set up your build configuration in symbiosis.config.js:

export default {
  name: 'my-application',
  build: {
    command: 'npm run build',
    output: 'dist',
    node_version: '18'
  },
  branches: {
    main: {
      autodeploy: true,
      environment: 'production'
    },
    staging: {
      autodeploy: true,
      environment: 'staging'
    }
  }
}
3

Set Up Environment Variables

Configure environment variables for different deployment environments:

# Production environment
symbiosis env set NODE_ENV=production --env production

# Staging environment
symbiosis env set NODE_ENV=staging --env staging

# View current environment variables
symbiosis env list
4

Configure Build Hooks

Add build hooks to customize the deployment process:

export default {
  hooks: {
    // Run before build
    prebuild: 'npm run lint',
    
    // Run after successful build
    postbuild: 'npm run test',
    
    // Run before deployment
    predeploy: './scripts/notify-team.sh',
    
    // Run after successful deployment
    postdeploy: './scripts/run-smoke-tests.sh'
  }
}
5

Set Up Notifications

Configure deployment notifications:

# Using the CLI
symbiosis notifications add slack --webhook-url=https://hooks.slack.com/...

# Or in symbiosis.config.js
export default {
  notifications: {
    slack: {
      webhook_url: 'https://hooks.slack.com/...',
      events: ['deploy.success', 'deploy.failure']
    }
  }
}

Best Practices

Branch Protection

Enable branch protection rules to ensure code quality:

  • Require pull request reviews
  • Require status checks to pass
  • Prevent force pushes
  • Automatically resolve conflicts

Testing Strategy

Implement comprehensive testing in your CI pipeline:

  • Unit tests must pass
  • Integration tests validation
  • End-to-end testing
  • Performance benchmarks

Rollback Strategy

Plan for deployment failures:

  • Automatic rollback on failure
  • Version your deployments
  • Keep deployment history
  • Monitor post-deployment metrics

Troubleshooting

Build Failures

If your build fails, check:

  • Build logs for specific errors
  • Environment variables are correctly set
  • Dependencies are properly specified
  • Build command is correct

Deployment Issues

For deployment problems:

  • Verify branch configurations
  • Check deployment logs
  • Confirm environment settings
  • Test deployment locally first

Next Steps

Now that you've set up continuous deployment, explore these related topics: