stampeded 0.3.1 → 0.3.2

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: 662d823a0b9ccdc994a154d1d88fe0c687caec91ac5d154b752addefb34f569d
4
- data.tar.gz: 16dc7a04b4b341e578b5d8f4d22a6a68abfec9789a1326db604985963158cae3
3
+ metadata.gz: a50b1c2cae8717087b4e44f994f1cc0291f3697f4d7e83e00645e4dd7ab3606b
4
+ data.tar.gz: a2ec4b8049253aacb16cd388915eb4d58521bbfcb17754ab2a4cd65b359f96b5
5
5
  SHA512:
6
- metadata.gz: 17a5c16f58a274f8d1767bf2801a6bac7541ef339d57b5ff227fb5007b2ee90a4f22cd0ddae555752b39588d375bd94a4ae58270ccb3d0e1a39c4e41cdc0253f
7
- data.tar.gz: 286dd6f4b6840454529bdb53f5c0be1a352011dfeb43a129dcdf5080c2f018cb6f0756ba806163a5b450270c1f97c70295dceaf3e9e0427c55f7c0d89e0b0aa5
6
+ metadata.gz: 23c572d3df98d6fd785694ca5dbad18ead88bc5b934fd65a83e35d6833122ba4b806ce7426e1c8be6814e1d921056027ef30355958d5ae2bc3aa09e8a92a53f9
7
+ data.tar.gz: 144d968a12f04ff3e094bddeefb3835e168bd4b03b46501692a86259d6dd809f2dbedb352135c26ee28993fbbea2d707553022a0ca4e52dc7629dca25f399acd
data/README.md CHANGED
@@ -25,6 +25,14 @@ scheduler, reaper, pruner, expirer, health checks, HTTP API and dashboard. It
25
25
  never runs a job itself. Without the daemon, jobs still run, but there is no
26
26
  cron, no recovery of jobs from dead workers, no retention and no dashboard.
27
27
 
28
+ The daemon gets the database URL through its environment, never its command
29
+ line. Extra flags go in `STAMPEDED_ARGS`, which `ps` shows to everyone on the
30
+ host, so the dashboard token goes in `STAMPEDED_DASHBOARD_TOKEN` instead:
31
+
32
+ ```bash
33
+ STAMPEDED_DASHBOARD_TOKEN=... STAMPEDED_ARGS="--http 127.0.0.1:7878" bin/rails stampeded:daemon
34
+ ```
35
+
28
36
  ## Transactional enqueue
29
37
 
30
38
  ```ruby
@@ -44,8 +44,9 @@ module Stampeded
44
44
  false
45
45
  end
46
46
 
47
- def exec!(*args)
48
- Kernel.exec(executable, *args)
47
+ def exec!(*args, env: {})
48
+ path = executable
49
+ Kernel.exec(env, [path, path], *args)
49
50
  end
50
51
  end
51
52
  end
@@ -9,7 +9,7 @@ module Stampeded
9
9
  def root
10
10
  candidates = [
11
11
  File.expand_path("../../schema", __dir__),
12
- File.expand_path("../../../schema", __dir__)
12
+ File.expand_path("../../../crates/stampeded/schema", __dir__)
13
13
  ]
14
14
  candidates.find { |d| File.directory?(d) } ||
15
15
  raise(Error, "cannot find schema/*.sql (looked in #{candidates.join(", ")})")
@@ -25,8 +25,7 @@ namespace :stampeded do
25
25
  desc "Run the daemon (scheduler, reaper, pruner, dashboard). Not the worker."
26
26
  task daemon: :environment do
27
27
  require "stampeded/daemon"
28
- args = ["--database-url", Stampeded.database_url_for_daemon, "--no-worker"]
29
- args += ENV["STAMPEDED_ARGS"].to_s.split
30
- Stampeded::Daemon.exec!(*args)
28
+ args = ["--no-worker", *ENV["STAMPEDED_ARGS"].to_s.split]
29
+ Stampeded::Daemon.exec!(*args, env: { "STAMPEDED_DATABASE_URL" => Stampeded.database_url_for_daemon })
31
30
  end
32
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stampeded
4
- VERSION = "0.3.1" # x-release-please-version
4
+ VERSION = "0.3.2" # x-release-please-version
5
5
  end
data/lib/stampeded.rb CHANGED
@@ -50,9 +50,14 @@ module Stampeded
50
50
  params = Connection.connection_params
51
51
  return params if params.is_a?(String)
52
52
 
53
- user = [params[:user], params[:password]].compact.join(":")
54
- host = [params[:host], params[:port]].compact.join(":")
55
- "postgres://#{user}#{"@" unless user.empty?}#{host}/#{params[:dbname]}"
53
+ userinfo = URI.encode_uri_component(params[:user].to_s)
54
+ userinfo += ":#{URI.encode_uri_component(params[:password].to_s)}" if params[:password]
55
+ host = params[:host].to_s
56
+ host = host.include?(":") ? "[#{host}]" : URI.encode_uri_component(host)
57
+ host += ":#{params[:port]}" if params[:port]
58
+ url = "postgres://#{userinfo}#{"@" unless userinfo.empty?}#{host}/#{URI.encode_uri_component(params[:dbname].to_s)}"
59
+ tls = params.slice(*Connection::TLS_KEYS).map { |key, value| "#{key}=#{URI.encode_uri_component(value.to_s)}" }
60
+ tls.empty? ? url : "#{url}?#{tls.join("&")}"
56
61
  end
57
62
 
58
63
  def create_queue(name)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stampeded
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih