Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ $ cuber info

Check out the [Cuberfile configuration](https://cuber.cloud/docs/cuberfile) and the [Cuber CLI commands](https://cuber.cloud/docs/cli) for more information.

## Node Pool Keys
GKE: cloud.google.com/gke-nodepool
Digital Ocean: doks.digitalocean.com/node-pool

## Production-ready

We have built Cuber for scaling [Pushpad](https://pushpad.xyz). Cuber has been used in production for over a year and it is stable and reliable. We had 100% uptime and we saved 80% on cloud costs.
Expand All @@ -85,4 +89,3 @@ Cuber is released under the [Apache-2.0 license](https://opensource.org/licenses
## Learn more

You can find more information and documentation on [cuber.cloud](https://cuber.cloud).

10 changes: 6 additions & 4 deletions lib/cuber/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ module Cuber
class CLI

def initialize
file_path = ARGV[1] || 'Cuberfile'

@options = {}
parse_command!
parse_cuberfile
parse_cuberfile(file_path)
validate_cuberfile
execute
end
Expand All @@ -26,9 +28,9 @@ def parse_command!
@options[:cmd] = ARGV.shift&.to_sym
end

def parse_cuberfile
abort 'Cuberfile not found in current directory' unless File.exist? 'Cuberfile'
content = File.read 'Cuberfile'
def parse_cuberfile(file_path)
abort 'Cuberfile not found in current directory' unless File.exist? file_path
content = File.read file_path
parser = CuberfileParser.new
parser.instance_eval(content)
cuberfile_options = parser.instance_variables.map do |name|
Expand Down
4 changes: 2 additions & 2 deletions lib/cuber/cuberfile_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def migrate cmd, check: nil
@migrate = { cmd: cmd, check: check }
end

def proc name, cmd, scale: 1, cpu: nil, ram: nil, term: 60, env: {}
@procs[name] = { cmd: cmd, scale: scale, cpu: cpu, ram: ram, term: term, env: env }
def proc name, cmd, scale: 1, cpu: nil, ram: nil, term: 60, env: {}, node_pool_key: nil, node_pool_name: nil
@procs[name] = { cmd: cmd, scale: scale, cpu: cpu, ram: ram, term: term, env: env, node_pool_key: node_pool_key, node_pool_name: node_pool_name }
end

def cron name, schedule, cmd
Expand Down
4 changes: 4 additions & 0 deletions lib/cuber/templates/deployment.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ spec:
app.kubernetes.io/managed-by: cuber
app: <%= procname %>-proc
spec:
<%- if proc[:node_pool_key] && proc[:node_pool_name] -%>
nodeSelector:
<%= proc[:node_pool_key] %>: <%= proc[:node_pool_name]%>
<%- end -%>
containers:
- name: <%= procname %>-proc
image: <%= @options[:image] %>:<%= @options[:release] %>
Expand Down