项目作者: haggishunk

项目描述 :
Just testing out dokku on a digital ocean droplet... using terraform
高级语言: HCL
项目地址: git://github.com/haggishunk/proj_mypaas.git
创建时间: 2017-10-06T22:48:47Z
项目社区:https://github.com/haggishunk/proj_mypaas

开源协议:

下载


MyPaaS: A Simple Framework for Automating the Deployment of a Roll-Your-Own PaaS

This project uses terraform to provision a virtual machine and install Dokkuas a PaaS host. I chose to use DigitalOcean for their cheap droplets/VMs and GoogleCloud’s DNS for it’s resilience. This is by no means the only viable provider schema; I consciously used two different providers to play with a frankencloud model.

Credentials

You will notice several references to credentials, most of which are specific to the cloud provider being used (ie. GCP, Digitalocean). See terraform’s documentation for help on accessing and working with your provider of choice.

TLDR

  1. Create a terraform.tfvars file to override some of the defaults set in variables.tf
    • ssh_id: MD5 fingerprint of ssh key on DigitalOcean
    • ssh_prikey: Specify the path to the ssh private key (optional)
    • domain: Your TLD or subdomain thereof
    • email: Your email, for Let’s Encrypt
    • region: The DigitalOcean region to deploy into (optional)
    • size: The RAM of the droplet (optional)
    • appname: name for app to be deployed (optional)
    • gitname: source repo for app to be deployed (optional)
  2. Save DigitalOcean token in ~/.creds/do_token
  3. Save Google Cloud json credential in ~/.creds/gcp_credentials.json
  4. Save Google Cloud project id in ~/.creds/gcp_project_id

Init

After cloning this repository, initialize terraform plugins like so:

  1. terraform init

You will have to do these each time you add new providers to the .tf files.

Standup PaaS

Simply type:

  1. terraform plan

to see what resources will be deployed.

This command sets it all in motion:

  1. terraform apply

Spin Down PaaS

This command takes it all down. No more charges to your account :)

  1. terrafom destroy

More at

blog.pantageo.us

Next steps:

  • Allow any number of machines to be deployed
  • Segment machines by role
  • Add etcd interface
  • Develop a better app to deploy than the sample ruby app from Heroku