Gjallarhorn
Multi-cloud deployment guardian as legendary as Heimdall's horn.
A Ruby gem that sounds across all cloud realms with secure, API-first deployments beyond SSH. Currently supporting AWS with additional providers planned for future releases.
Features
Phase 1 (0.1.0) - AWS Foundation:
- ✅ AWS SSM-based deployments (no SSH required)
- ✅ Thor-based CLI with comprehensive commands
- ✅ YAML configuration system
- ✅ Comprehensive test coverage
- ✅ Complete YARD documentation
Future Phases:
- Google Cloud Platform (Compute Engine API)
- Microsoft Azure (Run Command API)
- Self-hosted Docker (Docker API)
- Kubernetes (API)
- Hybrid/Multi-cloud deployments
Installation
Install the gem and add to the application's Gemfile by executing:
bundle add gjallarhorn
If bundler is not being used to manage dependencies, install the gem by executing:
gem install gjallarhorn
Usage
Configuration
Create a deploy.yml
file in your project root:
production:
provider: aws
region: us-west-2
services:
- name: web
ports: ["80:8080"]
env:
RAILS_ENV: production
DATABASE_URL: postgresql://user:pass@host/db
staging:
provider: aws
region: us-west-2
services:
- name: web
ports: ["80:8080"]
env:
RAILS_ENV: staging
CLI Commands
Deploy to an environment:
gjallarhorn deploy production myapp:v1.2.3
Check deployment status:
gjallarhorn status production
Rollback to previous version:
gjallarhorn rollback production v1.2.2
View configuration:
gjallarhorn config
Show version:
gjallarhorn version
AWS Prerequisites
Ensure your EC2 instances have:
- SSM Agent installed and running
- Appropriate IAM roles for SSM access
- Tags:
Environment
(e.g., "production") andRole
(e.g., "web", "app") - Docker installed and running
Required IAM Permissions
Your EC2 instances need an IAM role with the following permissions:
For SSM access:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:UpdateInstanceInformation",
"ssmmessages:CreateControlChannel",
"ssmmessages:CreateDataChannel",
"ssmmessages:OpenControlChannel",
"ssmmessages:OpenDataChannel"
],
"Resource": "*"
}
]
}
For ECR access (when deploying from ECR):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage"
],
"Resource": "*"
}
]
}
You can use the AWS managed policy AmazonSSMManagedInstanceCore
for SSM access, and create a custom policy for ECR access.
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/kanutocd/gjallarhorn. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Gjallarhorn project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.