cuber 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30c9c8b1f15a09e900ce5cea93bba8978e582ef381e8aa514e8af4c8ab580b58
4
- data.tar.gz: 30cc2c0d6b9b4fa32ae69ce23c908362100316f0361b17c391fcb982e40e28f9
3
+ metadata.gz: 1090ea1922fcbe4ed561662d7b7a56a398c4294e711292a0cb619c513183cefb
4
+ data.tar.gz: d7e2540d769182d5547fd880025a11ed64c6aec28afb55354f4604282bd53993
5
5
  SHA512:
6
- metadata.gz: afdbc2117591a5a5aac01efa6d7317f7642e95cf86a22a854d412995c5dfcd07de6eb8d2c92e9eda9dfd746fb813fcb92b432e2070239452d2df2062fc8d33f9
7
- data.tar.gz: bd1320bed29a3a07ec92a71a8941f22c00e8db6dc1ea6abab347c347a17bcb7adcef3efc9c8a9a2b41f0660079cea55f7993ffe6967c09dbd1731f4bbe1ceb0c
6
+ metadata.gz: 1e464a199e4cc265252aec41be86153b00d335432bd59c030940921f272e06d51be96bbe4297e7e3769ca2e93ca2c064e3ea46a1a75293ae3702fef6d5e20d1a
7
+ data.tar.gz: f1ffd4482b1c2871a58c9dfe379b87335831920944ad481c145e3f0394bed4ced5ba75d6583ec5c7e9966c90600f579d19de4d7ce79aea664a4bcb223057eb41
data/LICENSE CHANGED
@@ -187,7 +187,7 @@
187
187
  same "printed page" as the copyright notice for easier
188
188
  identification within third-party archives.
189
189
 
190
- Copyright 2022 Cuber (AbstractBrain srls)
190
+ Copyright 2022-2026 Marco Colli (AbstractBrain srls)
191
191
 
192
192
  Licensed under the Apache License, Version 2.0 (the "License");
193
193
  you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -15,7 +15,7 @@ Unlike other tools that add more options and more complexity to Kubernetes, Cube
15
15
  You just need to create a `Cuberfile`, with ~10 lines of code, and then type `cuber deploy` to package and deploy your app on any Kubernetes cluster.
16
16
 
17
17
  Kubernetes is up to 80% cheaper compared to PaaS like Heroku and you can choose between different cloud providers (no lock-in).
18
- It is also reliable and it can scale applications of any size.
18
+ It is also reliable, it gives you more visibility and control on your application and it can scale applications of any size.
19
19
  The only downside is that it's complex and requires many steps and configurations, even if most applications share the same needs...
20
20
  Cuber makes Kubernetes simple and more concise.
21
21
  In this way you have the simplicity of a PaaS, at the cost of bare infrastructure.
@@ -74,9 +74,9 @@ Check out the [Cuberfile configuration](https://cuber.cloud/docs/cuberfile) and
74
74
 
75
75
  ## Production-ready
76
76
 
77
- 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.
77
+ We have built Cuber for scaling [Pushpad](https://pushpad.xyz). Cuber has been used in production for many years and it is stable and reliable. We successfully reached 100% uptime while saving 80% on cloud costs.
78
78
 
79
- Cuber is a mature project that has all the features needed for deploying applications on Kubernetes and it is used every day for several projects.
79
+ Cuber is a mature project that has all the features needed for deploying applications on Kubernetes and it is used every day for several projects (including [BuonMenu](https://buonmenu.com), [Newsletter.page](https://newsletter.page) and many others).
80
80
 
81
81
  ## License
82
82
 
data/lib/cuber/cli.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'optparse'
2
+ require 'tmpdir'
3
+ require 'tempfile'
2
4
  require 'fileutils'
3
5
  require 'open3'
4
6
  require 'erb'
@@ -7,6 +7,7 @@ module Cuber::Commands
7
7
  end
8
8
 
9
9
  def execute
10
+ mktmpdirs
10
11
  if @options[:release]
11
12
  print_step 'Deploying a past release'
12
13
  else
@@ -22,9 +23,21 @@ module Cuber::Commands
22
23
  configure
23
24
  apply
24
25
  rollout
26
+ ensure
27
+ rmtmpdirs
25
28
  end
26
29
 
27
30
  private
31
+
32
+ def mktmpdirs
33
+ @repo_tmpdir = Dir.mktmpdir
34
+ @kubernetes_tmpdir = Dir.mktmpdir
35
+ end
36
+
37
+ def rmtmpdirs
38
+ FileUtils.remove_entry @repo_tmpdir
39
+ FileUtils.remove_entry @kubernetes_tmpdir
40
+ end
28
41
 
29
42
  def print_step desc
30
43
  puts
@@ -33,17 +46,14 @@ module Cuber::Commands
33
46
 
34
47
  def checkout
35
48
  print_step 'Cloning Git repository'
36
- path = '.cuber/repo'
37
- FileUtils.mkdir_p path
38
- FileUtils.rm_rf path, secure: true
39
49
  cmd = ['git', 'clone']
40
50
  cmd += ['--branch', @options[:repo][:branch]] if @options[:repo][:branch]
41
- cmd += ['--depth', '1', @options[:repo][:url], path]
51
+ cmd += ['--depth', '1', @options[:repo][:url], @repo_tmpdir]
42
52
  system(*cmd) || abort('Cuber: git clone failed')
43
53
  end
44
54
 
45
55
  def commit_hash
46
- out, status = Open3.capture2 'git', 'rev-parse', '--short', 'HEAD', chdir: '.cuber/repo'
56
+ out, status = Open3.capture2 'git', 'rev-parse', '--short', 'HEAD', chdir: @repo_tmpdir
47
57
  abort 'Cuber: cannot get commit hash' unless status.success?
48
58
  out.strip
49
59
  end
@@ -57,7 +67,7 @@ module Cuber::Commands
57
67
  tag = "#{@options[:image]}:#{@options[:release]}"
58
68
  cmd = ['pack', 'build', tag, '--builder', @options[:buildpacks], '--publish']
59
69
  cmd += ['--pull-policy', 'always', '--clear-cache'] if @options[:cache] == false
60
- system(*cmd, chdir: '.cuber/repo') || abort('Cuber: pack build failed')
70
+ system(*cmd, chdir: @repo_tmpdir) || abort('Cuber: pack build failed')
61
71
  end
62
72
 
63
73
  def build
@@ -67,7 +77,7 @@ module Cuber::Commands
67
77
  cmd = ['docker', 'build']
68
78
  cmd += ['--pull', '--no-cache'] if @options[:cache] == false
69
79
  cmd += ['--platform', 'linux/amd64', '--progress', 'plain', '-f', dockerfile, '-t', tag, '.']
70
- system(*cmd, chdir: '.cuber/repo') || abort('Cuber: docker build failed')
80
+ system(*cmd, chdir: @repo_tmpdir) || abort('Cuber: docker build failed')
71
81
  end
72
82
 
73
83
  def push
@@ -80,13 +90,13 @@ module Cuber::Commands
80
90
  print_step 'Generating Kubernetes configuration'
81
91
  @options[:instance] = "#{@options[:app]}-#{Time.now.utc.iso8601.delete('^0-9')}"
82
92
  @options[:dockerconfigjson] = Base64.strict_encode64 File.read File.expand_path(@options[:dockerconfig] || '~/.docker/config.json')
83
- render 'deployment.yml', '.cuber/kubernetes/deployment.yml'
93
+ render 'deployment.yml', File.join(@kubernetes_tmpdir, 'deployment.yml')
84
94
  end
85
95
 
86
96
  def apply
87
97
  print_step 'Applying configuration to Kubernetes cluster'
88
98
  kubectl 'apply',
89
- '-f', '.cuber/kubernetes/deployment.yml',
99
+ '-f', File.join(@kubernetes_tmpdir, 'deployment.yml'),
90
100
  '--prune', '-l', "app.kubernetes.io/name=#{@options[:app]},app.kubernetes.io/managed-by=cuber"
91
101
  end
92
102
 
@@ -33,15 +33,15 @@ module Cuber::Commands
33
33
 
34
34
  def kubeexec command
35
35
  @options[:pod] = "pod-#{command.downcase.gsub(/[^a-z0-9]+/, '-')}-#{Time.now.utc.iso8601.delete('^0-9')}"
36
- path = ".cuber/kubernetes/#{@options[:pod]}.yml"
37
36
  full_command = command.shellsplit
38
37
  full_command.unshift 'launcher' unless @options[:buildpacks].to_s.strip.empty?
39
- render 'pod.yml', path
40
- kubectl 'apply', '-f', path
38
+ Tempfile.create(['pod', '.yml']) do |temp|
39
+ render 'pod.yml', temp.path
40
+ kubectl 'apply', '-f', temp.path
41
+ end
41
42
  kubectl 'wait', '--for', 'condition=ready', "pod/#{@options[:pod]}"
42
43
  kubectl 'exec', '-it', @options[:pod], '--', *full_command
43
44
  kubectl 'delete', 'pod', @options[:pod], '--wait=false'
44
- File.delete path
45
45
  end
46
46
 
47
47
  end
data/lib/cuber/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cuber
2
- VERSION = '1.13.0'.freeze
2
+ VERSION = '1.14.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuber
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cuber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-02 00:00:00.000000000 Z
11
+ date: 2026-04-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: