/
upgrade-spec.coffee
214 lines (196 loc) · 6.21 KB
/
upgrade-spec.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
###
Define upgrades to projects.
###
# NOTE: This script ./upgrade-spec.coffee is copied into the Docker container
# in k8s/smc-project/manager/, so if you move or rename this script, you must
# also update that.
upgrades = exports.upgrades = {}
# these are the base quotas
exports.DEFAULT_QUOTAS =
disk_quota : 3000
req_cores : 0.01
req_memory : 160
cores : 1
memory : 1000
cpu_shares : 256
mintime : 3600 # hour
network : 0
member_host : 0
upgrades.max_per_project =
disk_quota : 50000
req_cores : 1
req_memory : 4000
memory : 8000
cores : 4
network : 1
cpu_shares : 2048
mintime : 24*3600*90
member_host : 1
# In the params listed below you *MUST* define all of display, display_unit,
# display_factor, pricing_unit, pricing_factor, input_type, and desc! This
# is assumed elsewhere.
upgrades.params =
disk_quota :
display : 'Disk space'
unit : 'MB'
display_unit : 'MB'
display_factor : 1
pricing_unit : 'GB'
pricing_factor : 1/1000
input_type : 'number'
desc : 'The maximum amount of disk space (in MB) that a project may use.'
memory :
display : 'Memory'
unit : 'MB'
display_unit : 'MB'
display_factor : 1
pricing_unit : 'GB'
pricing_factor : 1/1000
input_type : 'number'
desc : 'The maximum amount of memory that all processes in a project may use in total.'
cores :
display : 'CPU cores'
unit : 'core'
display_unit : 'core'
display_factor : 1
pricing_unit : 'core'
pricing_factor : 1
input_type : 'number'
desc : 'The maximum number of CPU cores that a project may use.'
cpu_shares :
display : 'CPU shares'
unit : 'share'
display_unit : 'share'
display_factor : 1/256
pricing_unit : 'share'
pricing_factor : 1/256
input_type : 'number'
desc : 'Relative priority of this project versus other projects running on the same computer.'
mintime :
display : 'Idle timeout'
unit : 'second'
display_unit : 'hour'
display_factor : 1/3600 # multiply internal by this to get what should be displayed
pricing_unit : 'day'
pricing_factor : 1/86400
input_type : 'number'
desc : 'If the project is not used for this long, then it will be automatically stopped.'
network :
display : 'Internet access'
unit : 'upgrade'
display_unit : 'upgrade'
display_factor : 1
pricing_unit : 'upgrade'
pricing_factor : 1
input_type : 'checkbox'
desc : 'Full internet access enables a project to connect to the computers outside of SageMathCloud, download software packages, etc.'
member_host :
display : 'Member hosting'
unit : 'upgrade'
display_unit : 'upgrade'
display_factor : 1
pricing_unit : 'upgrade'
pricing_factor : 1
input_type : 'checkbox'
desc : 'Moves this project to a members-only server, which has less competition for resources.'
upgrades.field_order = ['member_host', 'network', 'mintime', 'memory', 'disk_quota', 'cpu_shares', 'cores']
# live_subscriptions is an array of arrays. Each array should have length a divisor of 12.
# The subscriptions will be displayed one row at a time.
upgrades.live_subscriptions = [['standard', 'premium', 'professional'],
['small_course', 'medium_course', 'large_course']]
upgrades.period_names =
month : 'month'
year : 'year'
month4 : '4 months'
year1 : 'year'
# TODO: change from "membership" to "subscription".
membership = upgrades.membership = {}
membership.professional = # a user that has a professional membership
icon : 'battery-full'
price :
month : 99
year : 999
cancel_at_period_end : false
benefits :
cores : 5
cpu_shares : 128*20
disk_quota : 5000*20
member_host : 2*20
memory : 3000*20
mintime : 24*3600*20
network : 10*20
membership.premium = # a user that has a premium membership
icon : 'battery-three-quarters'
price :
month : 49
year : 499
cancel_at_period_end : false
benefits :
cores : 2
cpu_shares : 128*8
disk_quota : 5000*8
member_host : 2*8
memory : 3000*8
mintime : 24*3600*8
network : 10*8
membership.standard = # a user that has a standard membership
icon : 'battery-quarter'
price :
month : 7
year : 79
cancel_at_period_end : false
benefits :
cores : 0
cpu_shares : 128
disk_quota : 5000
member_host : 2
memory : 3000
mintime : 24*3600
network : 20
membership.large_course =
icon : 'battery-full'
price :
month4 : 999
year1 : 2499
cancel_at_period_end : true
benefits :
cores : 0
cpu_shares : 0
disk_quota : 0
member_host : 250
network : 500
membership.medium_course =
icon : 'battery-three-quarters'
price :
month4 : 399
year1 : 999
cancel_at_period_end : true
benefits :
cores : 0
cpu_shares : 0
disk_quota : 0
member_host : 70
network : 140
membership.small_course =
icon : 'battery-quarter'
price :
month4 : 199
year1 : 499
cancel_at_period_end : true
benefits :
cores : 0
cpu_shares : 0
disk_quota : 0
member_host : 25
network : 50
membership.student_course =
icon : 'graduation-cap'
price :
month4 : 9
cancel_at_period_end : true
benefits :
cores : 0
cpu_shares : 0
disk_quota : 0
member_host : 1
network : 1