Git Product home page Git Product logo

cloudlify's Introduction

Cloudlify

The simple cloud infrastructure launcher using Handlebars for template processing.

NOTE: Stack template examples will be posted shortly!

Use the Cloudlify npm module to compile yaml templates and execute cloud service provider commands.

Cloudlify uses Handlebars for merging the JSON formatted configuration file into the final template.

Currently we have AWS as a provider.

Install

npm install --save cloudlify

Requirements

Depending on the provider, which currently is only AWS, you will need the AWS CLI tools installed.

  • AWS CLI tools - https://aws.amazon.com/cli/
  • Amazon account with proper IAM roles/policies to access all the services you are deploying
  • AWS Access Key: IAM > User > Security Credentials > Access Keys ( Create Access Key )
  • AWS CLI Credentials locally - Create a folder under your profile for aws credentials ~/.aws ( MacOS )

Multiple AWS Profile Examples

~/.aws/config

[default]
output = text
region = us-east-1
[profile other]
region = us-west-2

~/.aws/credentials

[default]
aws_access_key_id = 
aws_secret_access_key = 
[other]
aws_access_key_id = 
aws_secret_access_key = 

Usage Example

./app.js

const Cloudlify = require( 'cloudlify' ),
	yaml = require( 'yamljs' );
	
var configuration = yaml.load( './config/common.yaml' );

var cloudlify = new Cloudlify( configuration, '{ optional non default aws profile name for aws cli }' );

cloudlify.create();

Configuration Example

./config/common.yaml

# AWS Cloud Configuration
# Required: ./templates/master.yaml ( Handlebars template )

Stack:
  Name: my-stack-prod

Build:
  Template: master
  Environment: development

Provider:
  Name: AWS
  Region: us-east-1
  Bucket: my-deploy-bucket

SecurityGroups:
  PublicCidr: 0.0.0.0/0

VPC:
  Id: vpc-someidhere
  SubnetId: subnet-someidhere
  OpenPorts:
    - 80
    - 443
    - 22
    - 3306

Host:
  ID: MyHostID
  KeyName: myawskey
  InstanceType: t3.micro
  ElasticIPAllocationId: eipalloc-someidhereifyouhaveone

Service:
  Name: MyServiceName
  Containers:
    - Name: Web
      Image: wordpress:latest
      Host: www.domain.com
    - Name: DB
      Image: mariadb:latest
    - Name: Proxy
      Image: jwilder/nginx-proxy
    - Name: LetsEncrypt
      Image: jrcs/letsencrypt-nginx-proxy-companion

Logs:
  RetentionInDays: 1

Environment Vars

Environment variables placed in a .env file can be used with the yaml configuration. If you pass a configuration yaml path to Cloudlify it will pre-process it with Handlebars and make ENV.MY_VAR substitutions before loading the it as a JSON object.

.env

MY_VAR = 1234

./config.yaml

Service:
  Name: Testing
  ID: {{ENV.MY_VAR}}

Folders

Cloudlify uses the following folders relative to where the package is called.

  • Configurations: ./config
  • Master templates: ./templates
  • Partial templates: ./partials
  • Build output: ./build
  • Compiled output: ./dist

Roadmap

  • Full example project with templates
  • Test library
  • Linting
  • Convert to TypeScript
  • Add more Providers
  • Kubernetes ready
  • Refactoring

Contributions

All contributions welcome! Branch off master and submit a pull request for review.

History

  • 0.0.7 - Allow option to pass a yaml config path to Cloudlify. It will be pre-processed for ENV vars by Handlebars.
  • 0.0.6 - Move force update of services to update() function
  • 0.0.5 - Update example to use yaml for configuration. It's just better ;)
  • 0.0.4 - Check if multiple host services are configured when running an updateService command.
  • 0.0.3 - Refactor AWS commands and configuration structure.
  • 0.0.1 - Initialize!

cloudlify's People

Stargazers

Tyler Bailey avatar

Watchers

Chris Murphy avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.