💎 🚀 TuskLang Ruby Deployment Guide

Ruby Documentation

🚀 TuskLang Ruby Deployment Guide

"We don't bow to any king" - Ruby Edition

Deploy TuskLang-powered Ruby applications with confidence. Learn best practices for Docker, cloud, and production environments.

🐳 Docker Deployment

1. Dockerfile Example

FROM ruby:3.2-alpine

RUN apk add --no-cache build-base postgresql-dev sqlite-dev redis RUN gem install tusklang

WORKDIR /app COPY Gemfile Gemfile.lock ./ RUN bundle install COPY . . EXPOSE 3000 CMD ["rails", "server", "-b", "0.0.0.0"]

2. Docker Compose

version: '3.8'
services:
  app:
    build: .
    ports:
      - "3000:3000"
    environment:
      - DATABASE_HOST=postgres
      - DATABASE_PORT=5432
      - DATABASE_NAME=myapp
      - DATABASE_USER=postgres
      - DATABASE_PASSWORD=secret
      - REDIS_HOST=redis
      - REDIS_PORT=6379
    depends_on:
      - postgres
      - redis
    volumes:
      - .:/app
      - bundle_cache:/usr/local/bundle
  postgres:
    image: postgres:15-alpine
    environment:
      - POSTGRES_DB=myapp
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=secret
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"
  redis:
    image: redis:7-alpine
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
volumes:
  postgres_data:
  redis_data:
  bundle_cache:

☁️ Cloud Deployment

1. Heroku

heroku create myapp
heroku addons:create heroku-postgresql:hobby-dev
heroku addons:create heroku-redis:hobby-dev
git push heroku main
heroku run rake db:migrate

2. AWS Elastic Beanstalk

eb init -p ruby myapp

Edit .elasticbeanstalk/config.yml as needed

eb create myapp-env eb deploy

3. Google Cloud Run

gcloud builds submit --tag gcr.io/[PROJECT-ID]/myapp
gcloud run deploy myapp --image gcr.io/[PROJECT-ID]/myapp --platform managed

🔒 Production Best Practices

- Use @env.secure for all secrets and credentials. - Enable SSL, HSTS, and security headers. - Monitor metrics and logs with @metrics and cloud tools. - Use connection pooling and caching for scalability. - Validate all configs before deploying. - Automate deployments with CI/CD pipelines.

🛠️ Ruby Integration Example

config/environments/production.tsk

$environment: "production" [server] host: "0.0.0.0" port: 3000 ssl: true workers: 4 [cache] driver: "redis" ttl: "5m" namespace: "myapp_prod" [security] cors_origins: ["https://myapp.com"] csrf_protection: true hsts: true

Ready to deploy at scale? Let's Tusk! 🚀