Last active
August 29, 2015 14:21
-
-
Save fancyremarker/35a654d6205d728a2b0e to your computer and use it in GitHub Desktop.
[:octopus:] Create an internal VHOST on Aptible
This file contains hidden or 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
require 'aptible/auth' | |
require 'aptible/api' | |
token = Aptible::Auth::Token.create( | |
email: EMAIL, | |
password: PASSWORD | |
) | |
app = Aptible::Service.find(APP_ID, token: token) | |
service = app.services.find { |s| s.process_type == PROCESS_TYPE } | |
vhost = service.create_vhost!( | |
type: 'http_proxy_protocol', | |
virtual_domain: VIRTUAL_DOMAIN, | |
private_key: File.read(PRIVATE_KEY_FILE), | |
certificate: File.read(CERTIFICATE_FILE), | |
internal: true | |
) | |
provision = vhost.create_operation!(type: 'provision') | |
sleep 1 until provision.reload.status == 'succeeded' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Set the following variables:
EMAIL
PASSWORD
APP_ID
PROCESS_TYPE
(usually"web"
)VIRTUAL_DOMAIN
PRIVATE_KEY_FILE
CERTIFICATE_FILE