Asteroid

Gem Version

Asteroid is a server management framework built in Ruby. It is heavily inspired by Fucking Shell Scripts.

Creating a new Project

gem install asteroid
asteroid new <project_name>

Things you need to edit

  • secrets/providers.rb contains the file that loads providers
  • secrets/secrets.yml is a place to store secrets used elsewhere

Create a new Server

To create a server, create a .yml file in asteroid/servers. Create one named web.yml that looks like this:

name: web

instance_options:
  size_id: 61               # DigitalOcean 1gb
  region_id: 12             # DigitalOcean NYC2
  ssh_key_ids: [1123232]

commands:
  after-create:
    - configure

  configure:
    - exec apt-get upgrade

To create an instance

Run this in your project root

asteroid server create web

If everything is configured you should have a new server in the cloud.

Environments

Environments are like Rails environments. They allow you to define different settings for your server files depending on what "environment" you are using. The default environment is development.

name: web

environments:

  development:
    provider:
      virtual_box:

    # we may want to use VirtualBox locally to 
    # test our setup scripts

  production:
    provider:
      digital_ocean:
        size_id: 61               # DigitalOcean 1gb



Namespaces

Namespaces are a way of using one DigitalOcean account to support multiple Asteroid projects. For instance, having a namespace of client-1 would allow you use an Asteroid project for that client and not conflict with your other servers.

config/asteroid.rb should looks like this if you want to use a namespace:


Asteroid::Config.configure(Asteroid.root) do |c|
  # This line configures a namespace for your servers
  c.namespace = "my-app"
end