Compare commits

..

3 Commits
v0.1.3 ... main

Author SHA1 Message Date
8e9a37b477
v0.1.4
All checks were successful
Gitea Actions Demo / lint (push) Successful in 24s
Gitea Actions Demo / test (push) Successful in 15s
Gitea Actions Demo / docker (push) Successful in 2m18s
2025-04-03 22:59:31 -05:00
7831c5da16
/pid route should return JSON
All checks were successful
Gitea Actions Demo / lint (push) Successful in 50s
Gitea Actions Demo / test (push) Successful in 17s
Gitea Actions Demo / docker (push) Successful in 2m6s
2025-04-03 20:52:32 -05:00
8667d0571f
have Puma set the PID of the master process 2025-04-03 20:52:32 -05:00
4 changed files with 11 additions and 20 deletions

24
app.rb
View File

@ -21,7 +21,7 @@ $LOAD_PATH.unshift File.dirname(__FILE__) + "/lib"
require "config" require "config"
VERSION = "0.1.3" VERSION = "0.1.4"
CHUNK_SIZE = 1024**2 CHUNK_SIZE = 1024**2
SESSION_SECRET_HEX_LENGTH = 64 SESSION_SECRET_HEX_LENGTH = 64
@ -117,7 +117,6 @@ class TickTock
def initialize def initialize
@pid = ppid @pid = ppid
@procfs_f = format "/proc/%s/stat", @pid @procfs_f = format "/proc/%s/stat", @pid
puts @pid
end end
def uptime def uptime
@ -185,20 +184,11 @@ class Sleep
end end
def ppid def ppid
pid = Process.pid pid = ENV.fetch "PUMA_PID", Process.pid
# self begin
ps = File.open "/proc/#{pid}/stat", &:readline Integer pid
ps = ps.split(" ") rescue ArgumentError
ppid = Integer(ps[3]) -1
# ppid
ps = File.open "/proc/#{ppid}/stat", &:readline
ps = ps.split(" ")
if ps[1].include? "ruby"
ppid
else
pid
end end
end end
@ -384,7 +374,7 @@ post "/halt" do
nil nil
end end
get "/pid" do get "/pid", provides: "json" do
pretty = params.key? :pretty pretty = params.key? :pretty
jsonify({ppid: ppid, pid: Process.pid}, pretty:) jsonify({ppid: ppid, pid: Process.pid}, pretty:)

View File

@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.3 version: 0.1.4
# This is the version number of the application being deployed. This version number should be # This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to # incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using. # follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes. # It is recommended to use it with quotes.
appVersion: "0.1.3" appVersion: "0.1.4"

1
config/puma.rb Normal file
View File

@ -0,0 +1 @@
ENV["PUMA_PID"] = Process.pid.to_s

View File

@ -16,7 +16,7 @@ spec:
spec: spec:
containers: containers:
- name: kubernaut - name: kubernaut
image: git.kill0.net/ryanc/kubernaut:0.1.3 image: git.kill0.net/ryanc/kubernaut:0.1.4
imagePullPolicy: Always imagePullPolicy: Always
ports: ports:
- name: sinatra-web - name: sinatra-web