pfab 0.47.0 → 0.47.1
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 +4 -4
- data/README.markdown +130 -11
- data/lib/pfab/cli.rb +2 -4
- data/lib/pfab/version.rb +1 -1
- data/pfab.gemspec +28 -14
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbb68461622144901fb5d3ccb9a2b7b61d4ed6f0ff84ac3e5c460bb71da57c50
|
4
|
+
data.tar.gz: ded9c69475e17fc6372929e4d8ba15a9a44658465c3bf540acbe5a969cf0ab47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0eb4a105bddccb81cd41aff0a3f8a7d1823bfce820e7e96e396815fb99d4b083330838c4ce5f41a767889122fbad585301ccd404f2e079d1910e5b03329b0a13
|
7
|
+
data.tar.gz: c3051634c832771bcc004d78188c8aaf31cfafd8a8b81db84539895e6dc41c99b314743cad87d54be1fac9e41618a328d0b98ef7e4bd74fd9a1627f45052031e
|
data/README.markdown
CHANGED
@@ -1,8 +1,128 @@
|
|
1
1
|
pfab
|
2
2
|
===================
|
3
3
|
|
4
|
-
The missing
|
4
|
+
The missing kubernetes deployer / utility
|
5
5
|
|
6
|
+
## Why?
|
7
|
+
pfab's goal is to let you write a clear, concise `application.yaml` and then "just work".
|
8
|
+
If you have a kubernetes cluster, a functioning local application and CI, you should be able to create your first deployment done
|
9
|
+
in 5 minutes.
|
10
|
+
|
11
|
+
pfab is designed to support strong opinions, but you're free to have whatever opinion you like by having your own deployable types.
|
12
|
+
|
13
|
+
This is what we use to deploy [Prefab](https://prefab.cloud/).
|
14
|
+
|
15
|
+
## Example
|
16
|
+
|
17
|
+
This is an example of a simple application.yaml that we hope is self explanatory.
|
18
|
+
|
19
|
+
```yaml
|
20
|
+
# application.yaml
|
21
|
+
name: myapp
|
22
|
+
|
23
|
+
deployables:
|
24
|
+
dbmigrate:
|
25
|
+
type: job
|
26
|
+
command: bundle exec rake db:migrate
|
27
|
+
upsert-usage-logs:
|
28
|
+
type: cron
|
29
|
+
schedule: 2 6 * * *
|
30
|
+
command: bundle exec rake upsert-logs
|
31
|
+
application:
|
32
|
+
type: web
|
33
|
+
command: bundle exec rails server
|
34
|
+
staging:
|
35
|
+
host: api.staginghost.com
|
36
|
+
replicas: 1
|
37
|
+
production:
|
38
|
+
host: api.host.com
|
39
|
+
replicas: 2
|
40
|
+
|
41
|
+
staging:
|
42
|
+
environment:
|
43
|
+
RAILS_ENV: "staging"
|
44
|
+
production:
|
45
|
+
environment:
|
46
|
+
RAILS_ENV: "production"
|
47
|
+
```
|
48
|
+
Given an `application.yaml` like this we can run:
|
49
|
+
```bash
|
50
|
+
~/Documents/workspace/myapp (main) $ pfab shipit
|
51
|
+
# Check image repository for an image or build and push one
|
52
|
+
# Generate kubernetes yaml
|
53
|
+
# Apply kubernetes yaml
|
54
|
+
|
55
|
+
# Now we can quickly check the status
|
56
|
+
~/Documents/workspace/myapp (main) $ pfab status
|
57
|
+
kubectl config use-context staging
|
58
|
+
Switched to context "staging".
|
59
|
+
kubectl get ingresses,jobs,services,cronjobs,deployments,pods -l application=myapp --namespace=myapp
|
60
|
+
NAME CLASS HOSTS ADDRESS PORTS AGE
|
61
|
+
ingress.networking.k8s.io/ingress-myapp-web-web <none> api.staginghost.com 80, 443 224d
|
62
|
+
|
63
|
+
NAME COMPLETIONS DURATION AGE
|
64
|
+
job.batch/job-myapp-job-dbmigrate-7854c854 1/1 3m34s 205d
|
65
|
+
|
66
|
+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
67
|
+
service/myapp-web-web ClusterIP 10.1.1.1 <none> 80/TCP 224d
|
68
|
+
|
69
|
+
NAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE
|
70
|
+
cronjob.batch/myapp-cron-upsert-usage-logs-92d90b8e 2 6 * * * False 0 <none> 62m
|
71
|
+
|
72
|
+
NAME READY UP-TO-DATE AVAILABLE AGE
|
73
|
+
deployment.apps/myapp-web-web 1/1 1 1 224d
|
74
|
+
|
75
|
+
NAME READY STATUS RESTARTS AGE
|
76
|
+
pod/myapp-web-web-8678649967-fqfgb 1/1 Running 0 42h
|
77
|
+
|
78
|
+
# or tail the logs
|
79
|
+
~/Documents/workspace/myapp (master) $ pfab logs
|
80
|
+
kubectl config use-context prefab-cloud-staging
|
81
|
+
Switched to context "prefab-cloud-staging".
|
82
|
+
which app?
|
83
|
+
1. myapp-job-dbmigrate
|
84
|
+
2. myapp-web-web
|
85
|
+
3. myapp-cron-upsert-usage-logs
|
86
|
+
? 2
|
87
|
+
kubectl logs -f myapp-web-web-8678649967-fqfgb --namespace=myapp
|
88
|
+
=> Booting Puma
|
89
|
+
=> Rails 5.1.7 application starting in staging
|
90
|
+
...
|
91
|
+
|
92
|
+
# or exec into a pod
|
93
|
+
~/Documents/workspace/myapp (master) $ pfab exec
|
94
|
+
kubectl config use-context staging
|
95
|
+
Switched to context "staging".
|
96
|
+
which app?
|
97
|
+
1. myapp-web-web
|
98
|
+
? 1
|
99
|
+
kubectl exec -it myapp-web-web-8678649967-fqfgb --namespace=myapp -- /bin/sh
|
100
|
+
# _
|
101
|
+
|
102
|
+
```
|
103
|
+
|
104
|
+
## Deployable Types
|
105
|
+
pfab supports `web`, `job`, `cron`, and `daemon` deployables. Each deployable type is just a ruby file that outputs json. To add your own you could simply create / modify the `web.rb`. Best practice is to put as much messy, boiler plate as possible into the templates and keep the `application.yaml` as clean as possible. An example of a deployable is [cron.rb](https://github.com/prefab-cloud/pfab/blob/main/lib/pfab/templates/cron.rb).
|
106
|
+
|
107
|
+
|
108
|
+
## What it Does
|
109
|
+
```
|
110
|
+
COMMANDS:
|
111
|
+
|
112
|
+
apply kubectl apply
|
113
|
+
build build image
|
114
|
+
clean clean up pods
|
115
|
+
exec kubectl exec into a pod
|
116
|
+
generate_yaml build k8s yaml from application.yaml
|
117
|
+
logs tail logs
|
118
|
+
restart rolling restart of a deployment
|
119
|
+
run_local run an app locally
|
120
|
+
shipit build, generate, apply
|
121
|
+
status status of an app
|
122
|
+
```
|
123
|
+
|
124
|
+
## Project Status
|
125
|
+
This is very much an internal tool today. It would be worth having a conversation before using it yourself. You may want to just fork it and have it your way.
|
6
126
|
|
7
127
|
## Setup
|
8
128
|
|
@@ -19,6 +139,15 @@ envs:
|
|
19
139
|
```
|
20
140
|
|
21
141
|
# application.yaml
|
142
|
+
Supported Features (see examples below)
|
143
|
+
- Env Vars & env specific env vars
|
144
|
+
- Secrets from k8s secrets
|
145
|
+
- Config Maps & env_from
|
146
|
+
- Custom probes
|
147
|
+
- cpu/memory limits
|
148
|
+
- TLS certs
|
149
|
+
- GRPC / h2c
|
150
|
+
|
22
151
|
```$yaml
|
23
152
|
name: myapp
|
24
153
|
prebuild: "mvn -T 4 clean package"
|
@@ -80,16 +209,6 @@ environment:
|
|
80
209
|
```
|
81
210
|
|
82
211
|
|
83
|
-
|
84
|
-
# Profit
|
85
|
-
```
|
86
|
-
pfab shipit
|
87
|
-
pfab status
|
88
|
-
pfab logs
|
89
|
-
pfab exec
|
90
|
-
pfab run_local
|
91
|
-
```
|
92
|
-
|
93
212
|
Contributing to pfab
|
94
213
|
------------------------------------------
|
95
214
|
|
data/lib/pfab/cli.rb
CHANGED
@@ -211,11 +211,9 @@ module Pfab
|
|
211
211
|
kubectl("apply -f .application-k8s-#{$env}-#{app_name}.yaml")
|
212
212
|
puts_and_system("git tag release-#{$env}-#{app_name}-#{Time.now.strftime("%Y-%m-%d-%H-%M-%S")} HEAD")
|
213
213
|
puts_and_system("git push origin --tags")
|
214
|
-
|
215
|
-
# watch
|
216
|
-
selector = "application=#{@application_yaml['name']}"
|
217
|
-
kubectl "get pods -l #{selector} -w"
|
218
214
|
end
|
215
|
+
selector = "application=#{@application_yaml['name']}"
|
216
|
+
kubectl "get pods -l #{selector} -w"
|
219
217
|
end
|
220
218
|
|
221
219
|
def image_exists?(full_image_name)
|
data/lib/pfab/version.rb
CHANGED
data/pfab.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: pfab 0.47.
|
5
|
+
# stub: pfab 0.47.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "pfab".freeze
|
9
|
-
s.version = "0.47.
|
9
|
+
s.version = "0.47.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Jeff Dwyer".freeze]
|
14
|
-
s.date = "2023-
|
14
|
+
s.date = "2023-12-19"
|
15
15
|
s.description = "k8s helper".freeze
|
16
16
|
s.email = "jdwyer@prefab.cloud".freeze
|
17
17
|
s.executables = ["pfab".freeze]
|
@@ -44,19 +44,33 @@ Gem::Specification.new do |s|
|
|
44
44
|
]
|
45
45
|
s.homepage = "http://github.com/prefab-cloud/pfab".freeze
|
46
46
|
s.licenses = ["MIT".freeze]
|
47
|
-
s.rubygems_version = "3.
|
47
|
+
s.rubygems_version = "3.3.7".freeze
|
48
48
|
s.summary = "helper gem".freeze
|
49
49
|
|
50
|
-
s.specification_version
|
50
|
+
if s.respond_to? :specification_version then
|
51
|
+
s.specification_version = 4
|
52
|
+
end
|
51
53
|
|
52
|
-
s.add_runtime_dependency
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
54
|
+
if s.respond_to? :add_runtime_dependency then
|
55
|
+
s.add_runtime_dependency(%q<commander>.freeze, [">= 0"])
|
56
|
+
s.add_runtime_dependency(%q<activesupport>.freeze, [">= 0"])
|
57
|
+
s.add_runtime_dependency(%q<pry-byebug>.freeze, [">= 0"])
|
58
|
+
s.add_runtime_dependency(%q<styled_yaml>.freeze, ["~> 0.0.1"])
|
59
|
+
s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
60
|
+
s.add_development_dependency(%q<bundler>.freeze, ["~> 2.3"])
|
61
|
+
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.4.9"])
|
62
|
+
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<test-unit>.freeze, [">= 0"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<commander>.freeze, [">= 0"])
|
66
|
+
s.add_dependency(%q<activesupport>.freeze, [">= 0"])
|
67
|
+
s.add_dependency(%q<pry-byebug>.freeze, [">= 0"])
|
68
|
+
s.add_dependency(%q<styled_yaml>.freeze, ["~> 0.0.1"])
|
69
|
+
s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
70
|
+
s.add_dependency(%q<bundler>.freeze, ["~> 2.3"])
|
71
|
+
s.add_dependency(%q<juwelier>.freeze, ["~> 2.4.9"])
|
72
|
+
s.add_dependency(%q<simplecov>.freeze, [">= 0"])
|
73
|
+
s.add_dependency(%q<test-unit>.freeze, [">= 0"])
|
74
|
+
end
|
61
75
|
end
|
62
76
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pfab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.47.
|
4
|
+
version: 0.47.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Dwyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '0'
|
187
187
|
requirements: []
|
188
|
-
rubygems_version: 3.
|
188
|
+
rubygems_version: 3.3.7
|
189
189
|
signing_key:
|
190
190
|
specification_version: 4
|
191
191
|
summary: helper gem
|