Deployment Guide
Overview
The LinkedIn Interactions Pipeline is deployed as a Google Cloud Run service with automatic deployments via GitHub Actions.
Repository: credinvest/social_media_scrapers
Deployment Workflow: .github/workflows/deploy-brand-interactions.yaml
Cloud Run Services
The pipeline consists of the following Cloud Run services:
API Services (HTTP)
- Dev:
brand-interactions-pipeline-dev - Staging:
brand-interactions-pipeline-staging - Production:
brand-interactions-pipeline
Polling Jobs (Scheduled)
- Dev:
brand-interactions-polling-job-dev - Staging:
brand-interactions-polling-job-staging - Production:
brand-interactions-polling-job
Deployment Architecture
Environments
| Environment | API Service | Polling Job | Tracker Table | Branch | Auto-Deploy |
|---|---|---|---|---|---|
| Dev | brand-interactions-pipeline-dev |
brand-interactions-polling-job-dev |
ApifyInteractionsTrackerTableDev |
develop |
Yes |
| Staging | brand-interactions-pipeline-staging |
brand-interactions-polling-job-staging |
ApifyInteractionsTrackerTableStaging |
staging |
Yes |
| Production | brand-interactions-pipeline |
brand-interactions-polling-job |
ApifyInteractionsTrackerTable |
main |
Yes |
Components per Environment
Each environment deploys two services:
- API Service (Cloud Run - HTTP)
- Handles API requests
- Processes webhooks from Apify
- Writes data to BigQuery
-
Publicly accessible endpoint
-
Polling Job (Cloud Run Jobs - Scheduled)
- Runs hourly (
0 * * * *) - Catches missed webhook events
- Queries Apify and processes completed runs
Deployment Process
Automatic Deployment
Deployments happen automatically when code is pushed to the respective branches via GitHub Actions:
- Push to
develop→ Deploys to Dev environment - Push to
staging→ Deploys to Staging environment - Push to
main→ Deploys to Production environment
Environment Variables
Required for API Service
| Variable | Description | Example |
|---|---|---|
APIFY_TOKEN |
Apify API authentication token | Secret (from Secret Manager) |
GCP_PROJECT_ID |
Google Cloud project ID | cred-1556636033881 |
ENVIRONMENT |
Environment name | dev, staging, production |
BRAND_INTERACTIONS_WEBHOOK_URL |
Webhook URL for Apify callbacks | Auto-generated based on service URL |
Required for Polling Job
| Variable | Description | Example |
|---|---|---|
APIFY_TOKEN |
Apify API authentication token | Secret (from Secret Manager) |
GCP_PROJECT_ID |
Google Cloud project ID | cred-1556636033881 |
ENVIRONMENT |
Environment name | dev, staging, production |
Post-Deployment Verification
Health Check
# Dev
curl https://brand-interactions-pipeline-dev-691864719497.us-central1.run.app/health
# Staging
curl https://brand-interactions-pipeline-staging-691864719497.us-central1.run.app/health
# Production
curl https://brand-interactions-pipeline-691864719497.us-central1.run.app/health
Expected Response:
{
"status": "healthy",
"service": "brand-interactions-pipeline",
"environment": "dev"
}
Test Endpoint
curl -X POST https://brand-interactions-pipeline-dev-691864719497.us-central1.run.app/apify/linkedin/interactions \
-H "Content-Type: application/json" \
-d '{
"user_company_id": "test123",
"targets": [{"linkedin_handle": "microsoft", "entity": "COMPANY"}],
"max_posts": 2
}'
Feature Development Workflow
Recommended workflow:
- Create feature branch from
develop - Merge to
developand test in Dev environment - Merge
developtostagingand test in Staging environment - Open PR from
stagingtomainfor production deployment