gleam-deployment
Guides Claude through deploying Gleam applications to production on Fly.io, Docker, or other platforms. Use when setting up deployment pipelines, configuring environments, or troubleshooting production issues.
What this skill does
# Gleam Deployment Skill
This skill guides Claude Code through deploying Gleam applications to production.
## Primary Sources
1. **[Deploying to Fly.io](https://gleam.run/deployment/fly/)** - Official Fly.io deployment guide
2. **[Gleam Export Command](https://gleam.run/writing-gleam/)** - Building releases
3. **[Docker Best Practices](https://docs.docker.com/develop/dev-best-practices/)** - Container optimization
4. **[Envoy Documentation](https://hexdocs.pm/envoy/)** - Environment configuration
5. **[Gleam FAQ - Production](https://gleam.run/frequently-asked-questions/)** - Production readiness
## Deployment Targets
### Fly.io (Official Guide)
Complete step-by-step guide:
**[Gleam on Fly.io](https://gleam.run/deployment/fly/)**
Key points:
- Listen on `0.0.0.0` (use `mist.bind("0.0.0.0")`)
- Use multi-stage Docker builds
- Configure fly.toml
- Deploy with `flyctl deploy`
### Other Platforms
Gleam apps can deploy to any platform supporting:
- **Docker containers**: AWS ECS, Google Cloud Run, Azure Container Instances
- **Erlang releases**: Any server with Erlang/OTP installed
- **JavaScript**: Node.js hosting (Vercel, Netlify, etc.)
## Building for Production
### Erlang Target
Build optimized Erlang release:
```bash
gleam export erlang-shipment
```
This creates a standalone release in `build/erlang-shipment/`.
See: [gleam.run/writing-gleam](https://gleam.run/writing-gleam/)
### JavaScript Target
Build JavaScript bundle:
```bash
gleam build --target javascript
```
Output in `build/dev/javascript/`.
## Docker Configuration
### Multi-Stage Build Pattern
Example from Fly.io guide:
```dockerfile
# Stage 1: Build
FROM ghcr.io/gleam-lang/gleam:v1.10.0-erlang-alpine AS builder
WORKDIR /app
COPY . .
RUN gleam export erlang-shipment
# Stage 2: Runtime
FROM erlang:27.1.1.0-alpine
WORKDIR /app
COPY --from=builder /app/build/erlang-shipment /app
RUN adduser -D webapp
USER webapp
ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["run"]
```
See complete example: [Fly.io Deployment Guide](https://gleam.run/deployment/fly/)
### Docker Optimization
Best practices:
- Use multi-stage builds (smaller images)
- Run as non-root user (security)
- Use .dockerignore (faster builds)
- Layer caching (faster rebuilds)
## Configuration Management
### Environment Variables
Use Envoy for environment configuration:
```gleam
import envoy
pub fn main() {
let assert Ok(port) = envoy.get("PORT")
|> result.then(int.parse)
let assert Ok(db_url) = envoy.get("DATABASE_URL")
start_server(port, db_url)
}
```
See: [Envoy Documentation](https://hexdocs.pm/envoy/)
### Configuration Files
For complex configuration, consider:
- TOML: [Tom parser](https://hexdocs.pm/tom/)
- JSON: [gleam_json](https://hexdocs.pm/gleam_json/)
- Environment-specific configs
## Security Considerations
### Secrets Management
- **Never commit secrets** to version control
- Use platform secret managers (Fly.io Secrets, AWS Secrets Manager, etc.)
- Inject secrets as environment variables
- Rotate secrets regularly
### Network Security
- Use HTTPS in production (platforms usually provide this)
- Configure CORS appropriately
- Validate all inputs
- Rate limit API endpoints
See: [Wisp Security](https://hexdocs.pm/wisp/)
## Database Deployment
### Connection Pooling
Use connection pools for databases:
- **Pog** has built-in pooling
- Configure pool size based on load
### Migrations
Patterns for database migrations:
1. Run migrations in startup script
2. Use dedicated migration tool (e.g., cigogne for Postgres)
3. Manual migration management
See: [Cigogne](https://hexdocs.pm/cigogne/) - Postgres migrations in Gleam
## Monitoring and Logging
### Logging
Production logging strategies:
- Use structured logging: [Palabres](https://hexdocs.pm/palabres/)
- Log to stdout/stderr (captured by platforms)
- Use appropriate log levels
- Include request IDs for tracing
### Monitoring
BEAM/OTP monitoring:
- Built-in Erlang tools (`:observer`, `:recon`)
- Platform monitoring (Fly.io metrics, CloudWatch, etc.)
- Custom telemetry
- Health check endpoints
### Health Checks
Implement health check endpoints:
```gleam
fn handle_request(req: Request) -> Response {
case wisp.path_segments(req) {
["health"] -> wisp.response(200)
|> wisp.set_body(wisp.Text("OK"))
// other routes...
}
}
```
## Performance Optimization
### Erlang Release Optimization
- Use `gleam export erlang-shipment` for optimized builds
- Configure BEAM flags in entrypoint
- Tune garbage collection settings
### Caching Strategies
- ETS tables (Erlang)
- External caching (Redis, Memcached)
- CDN for static assets
- HTTP caching headers
### Load Balancing
- Platform load balancing (Fly.io, AWS ALB)
- Multiple instances for scaling
- Health checks for routing
## CI/CD Pipelines
### GitHub Actions Example
```yaml
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Gleam
uses: erlef/setup-beam@v1
with:
gleam-version: "1.10.0"
- name: Run tests
run: gleam test
- name: Deploy to Fly.io
uses: superfly/flyctl-actions@master
with:
args: "deploy"
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
```
## Platform-Specific Guides
### Fly.io
**[Official Guide](https://gleam.run/deployment/fly/)**
### AWS
- ECS with Docker
- Lambda (JavaScript target)
- Elastic Beanstalk (Docker)
### Google Cloud
- Cloud Run (Docker)
- GKE (Kubernetes)
- App Engine (JavaScript)
### Azure
- Container Instances (Docker)
- AKS (Kubernetes)
- App Service (Docker)
### Vercel/Netlify (JavaScript Target)
- Build JavaScript target
- Configure build commands
- Deploy via CLI or Git integration
## Troubleshooting
### Common Issues
**Port binding**: Ensure listening on `0.0.0.0`, not `localhost`
**Environment variables**: Verify all required vars are set in platform
**File permissions**: Run as non-root user, check file ownership
**Build failures**: Check Dockerfile layer caching, dependencies
### Debugging Production
- Check platform logs
- Use remote Erlang console (if available)
- Enable debug logging temporarily
- Monitor resource usage
## Rollback Strategies
- Keep previous release artifacts
- Use platform rollback features (Fly.io, AWS, etc.)
- Database migration rollback plan
- Feature flags for gradual rollout
## Scaling Considerations
### Vertical Scaling
- Increase instance size
- Adjust BEAM settings
- Optimize resource usage
### Horizontal Scaling
- Add more instances
- Configure load balancing
- Ensure stateless design or shared state storage
### Database Scaling
- Read replicas
- Connection pooling
- Query optimization
- Caching layer
## Zero-Downtime Deployment
Strategies:
- Blue-green deployment
- Rolling updates
- Feature flags
- Health check integration
---
**Remember**: Gleam compiles to mature, battle-tested runtimes (BEAM, JavaScript). Focus on platform-specific deployment concerns.
See: [Gleam FAQ - Production](https://gleam.run/frequently-asked-questions/)
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.