diff --git a/config.rb b/config.rb index d1db590da..610445c81 100644 --- a/config.rb +++ b/config.rb @@ -147,9 +147,9 @@ def self.e2e_test? # Lantern override :lantern_top_domain, "db.lantern.dev", string override :lantern_dns_email, "varik@lantern.dev", string - override :lantern_default_version, "0.3.1", string + override :lantern_default_version, "0.3.3", string override :lantern_extras_default_version, "0.2.3", string - override :lantern_minor_default_version, "2", string + override :lantern_minor_default_version, "1", string override :lantern_backup_bucket, "walg-dev-backups" override :e2e_test, "0" override :backup_retention_days, 7, int diff --git a/model/lantern/lantern_server.rb b/model/lantern/lantern_server.rb index 2280ca240..bb744f320 100644 --- a/model/lantern/lantern_server.rb +++ b/model/lantern/lantern_server.rb @@ -61,7 +61,7 @@ def connection_string(port: 6432) end def run_query(query, db: "postgres", user: "postgres") - vm.sshable.cmd("sudo docker compose -f #{Config.compose_file} exec -T postgresql psql -q -U #{user} -t --csv #{db}", stdin: query).chomp + vm.sshable.cmd("sudo docker compose -f #{Config.compose_file} exec -T postgresql psql -q -U #{user} -p6432 -t --csv #{db}", stdin: query).chomp end def run_query_all(query) @@ -242,7 +242,7 @@ def prewarm_indexes_query end def list_all_databases - vm.sshable.cmd("sudo docker compose -f #{Config.compose_file} exec postgresql psql -U postgres -P \"footer=off\" -c 'SELECT datname from pg_database' | tail -n +3 | grep -v 'template0' | grep -v 'template1'") + vm.sshable.cmd("sudo docker compose -f #{Config.compose_file} exec postgresql psql -p6432 -U postgres -P \"footer=off\" -c 'SELECT datname from pg_database' | tail -n +3 | grep -v 'template0' | grep -v 'template1'") .chomp .strip .split("\n") diff --git a/rhizome/lantern/bin/doctor/run_query b/rhizome/lantern/bin/doctor/run_query index 449e298ee..729467925 100755 --- a/rhizome/lantern/bin/doctor/run_query +++ b/rhizome/lantern/bin/doctor/run_query @@ -10,7 +10,7 @@ $configure_hash = JSON.parse($stdin.read) dbs = $configure_hash["dbs"] def exec_sql(sql, user: "postgres", db: "postgres") - r("docker compose -f #{$compose_file} exec -T postgresql psql -q -U #{user} -t --csv #{db}", stdin: sql).chomp.strip + r("docker compose -f #{$compose_file} exec -T postgresql psql -q -U #{user} -p6432 -t --csv #{db}", stdin: sql).chomp.strip end def run_for_db(db) diff --git a/rhizome/lantern/bin/exec b/rhizome/lantern/bin/exec index 48a839bce..119293195 100755 --- a/rhizome/lantern/bin/exec +++ b/rhizome/lantern/bin/exec @@ -6,4 +6,4 @@ require "yaml" require_relative "../../common/lib/util" require_relative "../lib/common" -$stdout.puts r "docker compose -f #{$compose_file} exec -T postgresql psql -U postgres -t --csv", stdin: $stdin +$stdout.puts r "docker compose -f #{$compose_file} exec -T postgresql psql -p6432 -U postgres -t --csv", stdin: $stdin diff --git a/rhizome/lantern/bin/exec_all b/rhizome/lantern/bin/exec_all index 514a9c4a5..32a003330 100755 --- a/rhizome/lantern/bin/exec_all +++ b/rhizome/lantern/bin/exec_all @@ -6,7 +6,7 @@ require "yaml" require_relative "../../common/lib/util" require_relative "../lib/common" -all_dbs = (r "docker compose -f #{$compose_file} exec postgresql psql -U postgres -P \"footer=off\" -c 'SELECT datname from pg_database' | tail -n +3 | grep -v 'template0' | grep -v 'template1'").strip!.split("\n") +all_dbs = (r "docker compose -f #{$compose_file} exec postgresql psql -U postgres -p6432 -P \"footer=off\" -c 'SELECT datname from pg_database' | tail -n +3 | grep -v 'template0' | grep -v 'template1'").strip!.split("\n") all_dbs.each do |db| - $stdout.puts r "docker compose -f #{$compose_file} exec -T postgresql psql -U postgres -t --csv #{db}", stdin: $stdin + $stdout.puts r "docker compose -f #{$compose_file} exec -T postgresql psql -p6432 -U postgres -t --csv #{db}", stdin: $stdin end diff --git a/spec/model/lantern/lantern_server_spec.rb b/spec/model/lantern/lantern_server_spec.rb index cadebde21..b51d928a0 100644 --- a/spec/model/lantern/lantern_server_spec.rb +++ b/spec/model/lantern/lantern_server_spec.rb @@ -146,19 +146,19 @@ end it "runs query on vm" do - expect(lantern_server.vm.sshable).to receive(:cmd).with("sudo docker compose -f /var/lib/lantern/docker-compose.yaml exec -T postgresql psql -q -U postgres -t --csv postgres", stdin: "SELECT 1").and_return("1\n") + expect(lantern_server.vm.sshable).to receive(:cmd).with("sudo docker compose -f /var/lib/lantern/docker-compose.yaml exec -T postgresql psql -q -U postgres -p6432 -t --csv postgres", stdin: "SELECT 1").and_return("1\n") expect(lantern_server.run_query("SELECT 1")).to eq("1") end it "runs query on vm with different user and db" do - expect(lantern_server.vm.sshable).to receive(:cmd).with("sudo docker compose -f /var/lib/lantern/docker-compose.yaml exec -T postgresql psql -q -U lantern -t --csv db2", stdin: "SELECT 1").and_return("1\n") + expect(lantern_server.vm.sshable).to receive(:cmd).with("sudo docker compose -f /var/lib/lantern/docker-compose.yaml exec -T postgresql psql -q -U lantern -p6432 -t --csv db2", stdin: "SELECT 1").and_return("1\n") expect(lantern_server.run_query("SELECT 1", db: "db2", user: "lantern")).to eq("1") end it "runs query on vm for all databases" do expect(lantern_server).to receive(:list_all_databases).and_return(["postgres", "db2"]) - expect(lantern_server.vm.sshable).to receive(:cmd).with("sudo docker compose -f /var/lib/lantern/docker-compose.yaml exec -T postgresql psql -q -U postgres -t --csv postgres", stdin: "SELECT 1").and_return("1\n") - expect(lantern_server.vm.sshable).to receive(:cmd).with("sudo docker compose -f /var/lib/lantern/docker-compose.yaml exec -T postgresql psql -q -U postgres -t --csv db2", stdin: "SELECT 1").and_return("2\n") + expect(lantern_server.vm.sshable).to receive(:cmd).with("sudo docker compose -f /var/lib/lantern/docker-compose.yaml exec -T postgresql psql -q -U postgres -p6432 -t --csv postgres", stdin: "SELECT 1").and_return("1\n") + expect(lantern_server.vm.sshable).to receive(:cmd).with("sudo docker compose -f /var/lib/lantern/docker-compose.yaml exec -T postgresql psql -q -U postgres -p6432 -t --csv db2", stdin: "SELECT 1").and_return("2\n") expect(lantern_server.run_query_all("SELECT 1")).to eq( [ ["postgres", "1"], @@ -691,7 +691,7 @@ describe "#list_all_databases" do it "returns list of all databases" do - expect(lantern_server.vm.sshable).to receive(:cmd).with("sudo docker compose -f /var/lib/lantern/docker-compose.yaml exec postgresql psql -U postgres -P \"footer=off\" -c 'SELECT datname from pg_database' | tail -n +3 | grep -v 'template0' | grep -v 'template1'").and_return("postgres\ndb2\n") + expect(lantern_server.vm.sshable).to receive(:cmd).with("sudo docker compose -f /var/lib/lantern/docker-compose.yaml exec postgresql psql -p6432 -U postgres -P \"footer=off\" -c 'SELECT datname from pg_database' | tail -n +3 | grep -v 'template0' | grep -v 'template1'").and_return("postgres\ndb2\n") expect(lantern_server.list_all_databases).to eq(["postgres", "db2"]) end end