Conseils de deploiement

Deploy InstaTunnel in production environments, CI/CD pipelines, and team workflows with these deployment strategies and best practices.

🚀 CI/CD Integration

GitHub Actions

# .github/workflows/preview.yml
name: Deploy Preview
on:
pull_request:
branches: [main]
jobs:
deploy-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install InstaTunnel
run: npm install -g instatunnel
- name: Build and Deploy Preview
env:
INSTATUNNEL_API_KEY: ${{ secrets.INSTATUNNEL_API_KEY }}
run: |
npm install && npm run build
npm start &
sleep 10
instatunnel 3000 --subdomain pr-${{ github.event.pull_request.number }} --background
echo "Preview: https://pr-${{ github.event.pull_request.number }}.instatunnel.my"

💡 Result: Every pull request gets a unique preview URL like https://pr-123.instatunnel.my for easy testing and review.

GitLab CI

# .gitlab-ci.yml
stages:
- build
- deploy-preview
deploy_preview:
stage: deploy-preview
image: node:18
script:
- npm install -g instatunnel
- npm install && npm run build
- npm start &
- sleep 15
- instatunnel 3000 --subdomain mr-$CI_MERGE_REQUEST_IID --background
- echo "Preview deployed to https://mr-$CI_MERGE_REQUEST_IID.instatunnel.my"
only:
- merge_requests
environment:
name: preview/mr-$CI_MERGE_REQUEST_IID
url: https://mr-$CI_MERGE_REQUEST_IID.instatunnel.my

Jenkins Pipeline

// Jenkinsfile
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'npm install'
sh 'npm run build'
}
}
stage('Deploy Preview') {
when { changeRequest() }
steps {
sh 'npm install -g instatunnel'
sh 'npm start &'
sh 'sleep 10'
sh "instatunnel 3000 --subdomain pr-${env.CHANGE_ID} --background"
}
}
}
}

🐳 Docker Integration

Docker Compose Setup

# docker-compose.yml
version: '3.8'
services:
app:
build: .
ports:
- "3000:3000"
environment:
- NODE_ENV=production
tunnel:
image: instatunnel/cli:latest
command: instatunnel 3000 --subdomain myapp-prod
environment:
- INSTATUNNEL_API_KEY=${INSTATUNNEL_API_KEY}
network_mode: host
depends_on:
- app
restart: unless-stopped
# Usage
$ docker-compose up -d
✅ App running at https://myapp-prod.instatunnel.my

Multi-Service Docker Setup

# docker-compose.prod.yml
services:
frontend:
build: ./frontend
ports: ["3000:3000"]
api:
build: ./api
ports: ["8000:8000"]
frontend-tunnel:
image: instatunnel/cli
command: instatunnel 3000 --subdomain myapp-frontend
environment:
- INSTATUNNEL_API_KEY
network_mode: host
api-tunnel:
image: instatunnel/cli
command: instatunnel 8000 --subdomain myapp-api
environment:
- INSTATUNNEL_API_KEY
network_mode: host

Kubernetes Deployment

# k8s-deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-with-tunnel
spec:
replicas: 1
template:
spec:
containers:
- name: app
image: myapp:latest
ports:
- containerPort: 3000
- name: tunnel
image: instatunnel/cli:latest
command: ["instatunnel", "3000", "--subdomain", "k8s-myapp"]
env:
- name: INSTATUNNEL_API_KEY
valueFrom:
secretKeyRef:
name: tunnel-secret
key: api-key

🔄 Environment Management

Multi-Environment Strategy

# Environment-specific subdomains
$ instatunnel 3000 --subdomain myapp-dev # Development
$ instatunnel 3000 --subdomain myapp-staging # Staging
$ instatunnel 3000 --subdomain myapp-prod # Production
# Branch-based deployments
$ BRANCH=$(git branch --show-current)
$ instatunnel 3000 --subdomain myapp-$BRANCH
Environment URLs:
  • Development: https://myapp-dev.instatunnel.my
  • Staging: https://myapp-staging.instatunnel.my
  • Production: https://myapp-prod.instatunnel.my
  • Feature branches: https://myapp-feature-auth.instatunnel.my

Configuration Management

# Environment-specific config files
.instatunnel.development.yml
.instatunnel.staging.yml
.instatunnel.production.yml
# Usage with NODE_ENV
$ instatunnel --config .instatunnel.$NODE_ENV.yml
# Environment variables override
$ export INSTATUNNEL_CONFIG=production
$ instatunnel 3000 # Uses production config

🔧 Production Best Practices

High Availability Setup

# Multiple tunnel instances for redundancy
$ instatunnel 3000 --subdomain myapp --region us-east --auto-restart &
$ instatunnel 3000 --subdomain myapp --region us-west --auto-restart &
# Health checks and monitoring
$ instatunnel 3000 --health-check /health --health-interval 30s \
--alert-webhook https://monitoring.myapp.com/tunnel-alert
# Process management with PM2
$ pm2 start "instatunnel 3000 --subdomain myapp-prod" --name tunnel

Security for Production

# Production security configuration
$ instatunnel 3000 --subdomain myapp-prod \
--auth admin:$SECURE_PASSWORD \
--allow-ips 203.0.113.0/24 \
--force-https \
--log-level info \
--log-file /var/log/tunnel.log \
--alert-failed-attempts 5
Production Security Checklist:
  • ✅ Strong authentication enabled
  • ✅ IP whitelisting configured
  • ✅ HTTPS enforcement active
  • ✅ Request logging enabled
  • ✅ Failed attempt monitoring
  • ✅ Regular credential rotation

Monitoring & Alerting

# Comprehensive monitoring setup
$ instatunnel 3000 --subdomain myapp-prod \
--analytics detailed \
--alert-webhook https://alerts.myapp.com/tunnel \
--alert-requests 1000/hour \
--alert-errors 10/hour \
--alert-latency 2000ms \
--datadog-api-key $DATADOG_API_KEY

👥 Team Workflows

Collaborative Development

# Shared team configuration
# .instatunnel.team.yml
team_name: "frontend-team"
subdomain_prefix: "team-frontend"
shared_auth:
username: "team"
password: "${TEAM_PASSWORD}"
allowed_members:
- "alice@company.com"
- "bob@company.com"
analytics:
shared_dashboard: true
# Usage by team members
$ instatunnel 3000 --config .instatunnel.team.yml --user alice

Review Process Integration

# Automated review deployment script
#!/bin/bash
# deploy-review.sh
PR_NUMBER=$1
SUBDOMAIN="review-pr-$PR_NUMBER"
echo "Deploying review app for PR #$PR_NUMBER"
npm install && npm run build
npm start &
sleep 10
instatunnel 3000 --subdomain $SUBDOMAIN \
--auth review:$REVIEW_PASSWORD \
--background
echo "✅ Review app: https://$SUBDOMAIN.instatunnel.my"
echo "👤 Login: review / $REVIEW_PASSWORD"

⚡ Performance Optimization

Production Performance Tuning

# Optimized production configuration
$ instatunnel 3000 --subdomain myapp-prod \
--compress \
--connections 20 \
--keep-alive 60s \
--timeout 120s \
--region auto \
--log-level warn

Scaling Considerations

  • Load balancing: Use multiple tunnel instances with the same subdomain
  • Regional distribution: Deploy tunnels in multiple regions for global users
  • Connection pooling: Increase concurrent connections for high-traffic apps
  • Compression: Enable gzip compression for bandwidth optimization
  • Caching: Implement application-level caching to reduce response times
  • Monitoring: Use detailed analytics to identify performance bottlenecks

🚀 Deployment Tip: For production deployments, always use --auto-restart --health-check /health --alert-webhook https://yourmonitoring.com/alerts to ensure maximum uptime and immediate notification of issues.

Besoin d un chemin rapide ?

Consultez les offres puis suivez un guide de demarrage.

For MCP endpoints on Pro/Business, use instatunnel 8787 --mcp.

Documentation | InstaTunnel