This repository has been archived by the owner on Mar 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changes to allow multiple projects per snail instance
- Loading branch information
marcinbunsch
committed
Sep 21, 2009
1 parent
e0c0700
commit 77d1558
Showing
15 changed files
with
204 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
project_name: | ||
aws_key: YOUR_KEY | ||
aws_secret: YOUR_SECRET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
get '/' do | ||
redirect '/projects' | ||
end | ||
|
||
get '/projects' do | ||
erb :projects | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Security Groups | ||
|
||
get '/:project/groups' do | ||
@groups = @ec2.describe_security_groups | ||
erb :groups | ||
end | ||
|
||
get '/:project/group/:group_name/delete' do | ||
@ec2.delete_security_group(params[:group_name]) | ||
redirect '/groups' | ||
end | ||
|
||
get '/:project/group/:group_name/revoke' do | ||
if params[:group] | ||
@ec2.revoke_security_group_named_ingress(params[:group_name], params[:owner], params[:group]) | ||
else | ||
@ec2.revoke_security_group_IP_ingress(params[:group_name], params[:from], params[:to], params[:protocol], params[:ip]) | ||
end | ||
redirect '/groups' | ||
end | ||
|
||
post '/:project/group/:group_name/authorize' do | ||
@ec2.authorize_security_group_IP_ingress(params[:group_name], params[:from], params[:to], params[:protocol], params[:ip]) | ||
redirect '/groups' | ||
end | ||
|
||
post '/:project/group' do | ||
@ec2.create_security_group(params[:name], params[:description]) | ||
redirect '/groups' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Images | ||
|
||
get '/:project/images' do | ||
@@images ||= @ec2.describe_images.find_all{|x| x[:aws_image_type] == 'machine'} | ||
@i386 = @@images.find_all{|x| x[:aws_architecture] == 'i386'}.sort {|x,y| x[:aws_location] <=> y[:aws_location] } | ||
@x86_64 = @@images.find_all{|x| x[:aws_architecture] == 'x86_64'}.sort {|x,y| x[:aws_location] <=> y[:aws_location] } | ||
erb :images | ||
end | ||
|
||
get '/:project/images/:image_id/launch' do | ||
@ec2.launch_instances(params[:image_id], :group_ids => 'default', | ||
:user_data => "Woohoo!!!", | ||
:addressing_type => "public", | ||
:key_name => "default", | ||
:availability_zone => "us-east-1c") | ||
redirect '/instances' | ||
end | ||
|
||
get '/:project/images/search*' do | ||
params[:query] ||= request.path_info.split('/')[3] | ||
redirect '/images' if params[:query].empty? | ||
@i386 = @@images.find_all{|x| x[:aws_architecture] == 'i386' and x.inspect =~ /#{params[:query]}/i}.sort {|x,y| x[:aws_location] <=> y[:aws_location] } | ||
@x86_64 = @@images.find_all{|x| x[:aws_architecture] == 'x86_64' and x.inspect =~ /#{params[:query]}/i}.sort {|x,y| x[:aws_location] <=> y[:aws_location] } | ||
erb :images | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Instances | ||
|
||
get '/:project/instances' do | ||
@instances = @ec2.describe_instances.reverse | ||
erb :instances | ||
end | ||
|
||
get '/:project/instance/:instance_id/terminate' do | ||
@output = @ec2.terminate_instances(params[:instance_id]) | ||
redirect '/instances' | ||
end | ||
|
||
get '/:project/instance/:instance_id/output' do | ||
@output = @ec2.get_console_output(params[:instance_id]) | ||
erb :output | ||
end | ||
|
||
get '/:project/instance/:instance_id/reboot' do | ||
@ec2.reboot_instances([params[:instance_id]]) | ||
redirect '/instances' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Elastic IP addresses | ||
|
||
get '/:project/addresses' do | ||
@addresses = @ec2.describe_addresses | ||
@instances = @ec2.describe_instances.reverse | ||
erb :addresses | ||
end | ||
|
||
get '/:project/addresses/allocate' do | ||
@ec2.allocate_address | ||
redirect '/addresses' | ||
end | ||
|
||
get '/:project/address/*/release' do | ||
ip_address = request.path_info.split('/')[2] | ||
@ec2.release_address(ip_address) | ||
redirect '/addresses' | ||
end | ||
|
||
post '/:project/address/*/associate' do | ||
ip_address = request.path_info.split('/')[2] | ||
@ec2.associate_address(params[:instance_id], ip_address) | ||
redirect '/addresses' | ||
end | ||
|
||
get '/:project/address/*/disassociate' do | ||
ip_address = request.path_info.split('/')[2] | ||
@ec2.disassociate_address(ip_address) | ||
redirect '/addresses' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# SSH Key Pairs | ||
|
||
get '/:project/keys' do | ||
@keys = @ec2.describe_key_pairs | ||
erb :keys | ||
end | ||
|
||
get '/:project/key/:key_name/delete' do | ||
@ec2.delete_key_pair(params[:key_name]) | ||
redirect '/keys' | ||
end | ||
|
||
post '/:project/key' do | ||
output = @ec2.create_key_pair(params[:key_name]) | ||
"<pre>" + output[:aws_material] + "</pre>" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# S3 | ||
|
||
get '/:project/buckets' do | ||
@buckets = @s3.buckets.map{|b| b.name} | ||
erb :buckets | ||
end | ||
|
||
get '/:project/bucket/:bucket_name/keys' do | ||
@bucket = @s3.bucket(params[:bucket_name]) | ||
@keys = @bucket.keys | ||
erb :s3_keys | ||
end | ||
|
||
get '/:project/bucket/*/key/*' do | ||
bucket_name = request.path_info.split('/')[2] | ||
key_name = request.path_info.split('/')[4] | ||
@bucket = @s3.bucket(bucket_name) | ||
send_data(@bucket.get(key_name)) | ||
end |
Oops, something went wrong.