The deployment_type parameter determines how your application is deployed to the remote server. MetalDeploy supports three deployment types, each optimized for different use cases. By default, MetalDeploy uses baremetal deployment, which provides direct server deployment without containerization overhead.
Important: If you provide deploy_command, MetalDeploy will run that command first (in the repository directory) and skip the deployment-type-specific flow. This works for all deployment types, so you can override docker/k8s/baremetal behavior with a custom command when needed.
Baremetal deployment is the default deployment type and deploys your application directly to the server without Docker or Kubernetes. This is perfect for:
- Simple applications that don't require containerization
- Applications with system-level dependencies
- When you want full control over the deployment process
- Fast deployments without container overhead
- Legacy applications that aren't containerized
How it works:
- The action clones your repository to the remote server
- It then executes your deployment command in the repository directory
- The deployment command can be specified explicitly or auto-detected
Usage:
deployment_type: baremetal # This is the default, so you can omit it
deploy_command: make deploy # Optional: custom command to runDefault Behavior (Command Resolution Order):
- If
deploy_commandis specified, runs that exact command - Otherwise, looks for
deploy.shin the repository root and runs it (with execute permissions) - If no
deploy.shexists, looks forMakefileand runsmake {environment}(e.g.,make dev,make staging,make prod) - If none of the above are found, the deployment will fail with an error asking you to specify
deploy_command
Example with explicit command:
- name: Deploy with MetalDeploy
uses: OpsGuild/MetalDeploy@v1
with:
deployment_type: baremetal # Optional since it's the default
deploy_command: "npm install && npm run build && pm2 restart app"
environment: prodExample with auto-detection (using Makefile):
- name: Deploy with MetalDeploy
uses: OpsGuild/MetalDeploy@v1
with:
# deployment_type defaults to baremetal
environment: staging
# Will automatically run: make stagingExample with deploy.sh script:
- name: Deploy with MetalDeploy
uses: OpsGuild/MetalDeploy@v1
with:
environment: prod
# Will automatically run: ./deploy.shBest Practices:
- Create a
deploy.shscript for complex deployments with multiple steps - Use a
Makefileif you have multiple environments and want to keep commands organized - Use
deploy_commandfor simple one-off deployments or when you need dynamic commands
Docker deployment uses Docker Compose to deploy containerized applications. This is ideal for:
- Applications that are already containerized
- Multi-container applications (web, database, cache, etc.)
- Applications that need isolated environments
- Microservices architectures
- Applications requiring consistent runtime environments
How it works:
- The action automatically installs Docker and Docker Compose if not already present
- It clones your repository to the remote server
- It authenticates with your Docker registry (GHCR, Docker Hub, or ECR)
- It runs
docker compose up --build -dto build and start your containers - Optionally uses Docker Compose profiles to deploy specific service sets
Usage:
deployment_type: docker
profile: production # Optional: use Docker Compose profiles
registry_type: ghcr # or dockerhub, ecrExample with GitHub Container Registry (GHCR):
- name: Deploy with MetalDeploy
uses: OpsGuild/MetalDeploy@v1
with:
deployment_type: docker
git_token: ${{ secrets.GITHUB_TOKEN }}
git_user: ${{ github.actor }} # Default, can be omitted
registry_type: ghcr # Uses git_user and git_token for auth
profile: production # Optional: deploy only services with this profileExample with Docker Hub:
- name: Deploy with MetalDeploy
uses: OpsGuild/MetalDeploy@v1
with:
deployment_type: docker
registry_type: dockerhub
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_PASSWORD }}
profile: productionExample with AWS ECR:
- name: Deploy with MetalDeploy
uses: OpsGuild/MetalDeploy@v1
with:
deployment_type: docker
registry_type: ecr
aws_region: us-east-1
aws_account_id: ${{ secrets.AWS_ACCOUNT_ID }}
# Requires AWS credentials configured on the remote serverRequirements:
- Your repository must have a
docker-compose.yml,docker-compose.yaml,compose.yml, orcompose.yamlfile - Your Docker images must be available in the specified registry
- The remote server must have internet access to pull images
Docker Compose Profiles:
Profiles allow you to deploy specific subsets of services defined in your docker-compose.yml. For example:
services:
web:
profiles: ["production"]
worker:
profiles: ["production", "staging"]
dev-tools:
profiles: ["dev"]When you specify profile: production, only services with the production profile will be deployed.
Kubernetes deployment uses k3s (a lightweight Kubernetes distribution) to deploy containerized applications. This is ideal for:
- Production-grade container orchestration
- Applications requiring high availability and scaling
- Complex multi-service applications
- Applications that need service discovery and load balancing
- Teams familiar with Kubernetes
How it works:
- The action automatically installs k3s, kubectl, and helm if not already present
- It installs Docker (required by k3s for container runtime)
- It clones your repository to the remote server
- It authenticates with your Docker registry
- It creates the specified Kubernetes namespace (if it doesn't exist)
- It applies all Kubernetes manifests from the specified path
k3s Overview: k3s is a certified Kubernetes distribution designed for resource-constrained environments. It's perfect for:
- Single-node Kubernetes clusters
- Edge computing deployments
- Development and testing environments
- Small to medium production workloads
Usage:
deployment_type: k8s
k8s_manifest_path: k8s/ # Optional: auto-detected if not specified
k8s_namespace: production # Optional: defaults to 'default'
registry_type: ghcr # Required for pulling container imagesDefault Behavior (Manifest Path Resolution): The action will automatically search for Kubernetes manifests in this order:
- If
k8s_manifest_pathis specified, uses that path - Otherwise, looks for directories:
k8s/,manifests/, orkubernetes/ - If no directory found, looks for files:
k8s.yaml,k8s.yml,deployment.yaml, ordeployment.yml - If nothing is found, the deployment will fail with an error
Example with directory of manifests:
- name: Deploy with MetalDeploy
uses: OpsGuild/MetalDeploy@v1
with:
deployment_type: k8s
k8s_manifest_path: k8s/ # Directory containing YAML files
k8s_namespace: production
registry_type: ghcr
git_token: ${{ secrets.GITHUB_TOKEN }}Example with single manifest file:
- name: Deploy with MetalDeploy
uses: OpsGuild/MetalDeploy@v1
with:
deployment_type: k8s
k8s_manifest_path: deployment.yaml # Single file
k8s_namespace: stagingExample with auto-detection:
- name: Deploy with MetalDeploy
uses: OpsGuild/MetalDeploy@v1
with:
deployment_type: k8s
# Will automatically find k8s/, manifests/, or kubernetes/ directory
k8s_namespace: productionRequirements:
- Your repository should have Kubernetes manifest files (YAML) in a
k8s/,manifests/, orkubernetes/directory, or a single manifest file - Your container images must be available in the specified registry
- The remote server must have sufficient resources (RAM, CPU) for k3s and your workloads
- At least 512MB RAM recommended for k3s alone
Namespace Management:
- The action automatically creates the namespace if it doesn't exist
- All resources are deployed to the specified namespace
- Use different namespaces for different environments (dev, staging, prod)
k3s Configuration:
- k3s is installed with Traefik disabled (you can use your own ingress controller)
- kubeconfig is automatically configured at
/etc/rancher/k3s/k3s.yaml - The action sets
KUBECONFIGenvironment variable for kubectl commands
Uses git_user and git_token for authentication.
registry_type: ghcrRequires registry_username and registry_password.
registry_type: dockerhub
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_PASSWORD }}Requires aws_region and aws_account_id. The action will use AWS CLI to authenticate.
registry_type: ecr
aws_region: us-east-1
aws_account_id: 123456789012