Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.

Commit 5c1cb18

Browse files
author
devrim yasar
committed
delete arrayproto.coffee -> stick it to config.coffee for now since it's included on all workers
1 parent 6543555 commit 5c1cb18

5 files changed

Lines changed: 28 additions & 69 deletions

File tree

config/main.prod.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ Configuration = (options={}) ->
226226
if str
227227
_b64 = new Buffer(str)
228228
_b64 = zlib.compress _b64 if compress
229-
log "[b64z] before #{str.length} after #{_b64.length}"
229+
# log "[b64z] before #{str.length} after #{_b64.length}"
230230
return _b64.toString('base64')
231231
else
232232
if strict

deploy.coffee

Lines changed: 19 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ semver = require 'semver'
1616
request = require 'request'
1717
ec2 = new AWS.EC2()
1818
elb = new AWS.ELB()
19+
runAfter = (time,fn) ->
20+
setTimeout fn,time
1921

2022

2123
class Release
@@ -62,7 +64,7 @@ class Release
6264

6365
@registerInstancesWithPrefix = (prefix, callback)->
6466
fetchInstancesWithPrefix prefix, (err,instances)->
65-
# log instances
67+
log instances
6668
elb.registerInstancesWithLoadBalancer
6769
Instances : instances
6870
LoadBalancerName : "koding-prod-deployment"
@@ -164,7 +166,6 @@ class Deploy
164166
callback null
165167

166168
@createInstances = (options={}, callback) ->
167-
log 'yo'
168169
params = options.params
169170

170171
iamcalledonce = 0
@@ -192,51 +193,6 @@ class Deploy
192193

193194
callback null, data
194195

195-
# data.Instances.forEach (instance)->
196-
# log instance.InstanceId
197-
198-
# Deploy.tagInstances data,(err,res)->
199-
200-
# instanceIds = (InstanceId for InstanceId in data.Instances)
201-
# log "instanceIds:",InstanceIds
202-
# params =
203-
# InstanceIds : InstanceIds
204-
205-
206-
# timer = setInterval ->
207-
208-
# ec2.describeInstanceStatus params,(err,data)->
209-
# if err then log err
210-
# else
211-
# states.instanceState = data?.InstanceStatuses?[0]?.InstanceState?.Name
212-
# states.reachability = data?.InstanceStatuses?[0]?.InstanceStatus?.Details?[0]?.Status
213-
214-
# ec2.describeInstances params,(err,data)->
215-
# if err then log err
216-
# else
217-
# states.initialState = data?.Reservations?[0]?.Instances?[0]?.State?.Name
218-
# states.final = data?.Reservations?[0]?.Instances?[0]
219-
# else
220-
# log "instance is now running with IP:", IP = states.final.PublicIpAddress
221-
# clearInterval timer
222-
# ,5000
223-
224-
# @deployAndConfigure = (options,callback)->
225-
226-
227-
# Deploy.createInstance options,(err,result) ->
228-
# deployStart = new Date()
229-
# {conn} = result
230-
231-
# conn.exec options.buildScript, (err, stream) ->
232-
# throw err if err
233-
# conn.listen "[configuring #{result.instanceName}]", stream,->
234-
# throw err if err
235-
# # delete result.conn
236-
# # log result.instanceData
237-
# log "Deployment of #{result.instanceName} took: #{timethat.calc deployStart,new Date()}"
238-
# conn.end()
239-
# callback null, result
240196

241197
@deployTest = (options,callback)->
242198

@@ -308,8 +264,8 @@ if argv.deploy
308264

309265

310266
options =
311-
boxes : argv.boxes or 5
312-
boxtype : argv.boxtype or "t2.medium"
267+
boxes : argv.boxes or 2
268+
boxtype : argv.boxtype or "t2.micro"
313269
versiontype : argv.versiontype or "patch" # available options major, premajor, minor, preminor, patch, prepatch, or prerelease
314270
config : argv.config or "prod" # prod | staging | sandbox
315271
version : argv.version or version
@@ -326,12 +282,12 @@ if argv.deploy
326282

327283
UserData = new Buffer(KONFIG.runFile).toString('base64')
328284

329-
options =
285+
deployOptions =
330286
params :
331287
ImageId : "ami-864d84ee" # Amazon ubuntu 14.04 "ami-1624987f" # Amazon Linux AMI x86_64 EBS
332288
InstanceType : options.boxtype
333-
MinCount : 2
334-
MaxCount : 2
289+
MinCount : options.boxes
290+
MaxCount : options.boxes
335291
SubnetId : "subnet-b47692ed"
336292
KeyName : "koding-prod-deployment"
337293
UserData : UserData
@@ -343,9 +299,18 @@ if argv.deploy
343299

344300

345301

346-
Deploy.createInstances options,(err,res)->
302+
Deploy.createInstances deployOptions,(err,res)->
303+
304+
runAfter 5,Release.registerInstancesWithPrefix options.hostname,(err,res)->
305+
log "------------------------------------------------------------------"
306+
log "Deployment complete, give it 5 minutes... (depends on the boxtype)"
307+
log "------------------------------------------------------------------"
308+
log "ELB: koding-prod-deployment-109498171.us-east-1.elb.amazonaws.com "
309+
log "------------------------------------------------------------------"
310+
log "URL: https://koding.io "
311+
log "------------------------------------------------------------------"
347312

348-
log JSON.stringify res,null,2
313+
# log JSON.stringify res,null,2
349314

350315
# res.Instances.forEach (instance)->
351316
# IP = instance.PublicIpAddress

node_modules_koding/koding-config-manager/config.coffee

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
fs = require 'fs'
66
{extend} = require 'underscore'
77

8+
do ->
9+
unless 'first' of Array.prototype
10+
Object.defineProperty Array.prototype, 'first',
11+
get : -> this[0]
12+
unless 'last' of Array.prototype
13+
Object.defineProperty Array.prototype, 'last',
14+
get : -> this[this.length-1]
15+
816

917
class Config
1018
@load: (name)->

server/lib/server/arrayproto.coffee

Lines changed: 0 additions & 7 deletions
This file was deleted.

workers/arrayproto.coffee

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)