DEV: Use discourse image for postgres in GitHub Actions (#15291)

The discourse base image already contains a postgres installation, so pulling a separate postgres image is a little wasteful. Using the copy of Postgres in the discourse image saves about 20 seconds on every GitHub actions run.

This commit sets up Postgres with a few performance-improving flags, which we were already using for the `rake docker:test` task (used on our internal CI system).
This commit is contained in:
David Taylor
2021-12-14 17:20:06 +00:00
committed by GitHub
parent 031f4f06d5
commit 0e87f882a7
3 changed files with 37 additions and 27 deletions

View File

@ -102,16 +102,8 @@ task 'docker:test' do
puts "Starting background redis"
@redis_pid = Process.spawn('redis-server --dir tmp/test_data/redis')
@postgres_bin = "/usr/lib/postgresql/#{ENV['PG_MAJOR']}/bin/"
`#{@postgres_bin}initdb -D tmp/test_data/pg`
# speed up db, never do this in production mmmmk
`echo fsync = off >> tmp/test_data/pg/postgresql.conf`
`echo full_page_writes = off >> tmp/test_data/pg/postgresql.conf`
`echo shared_buffers = 500MB >> tmp/test_data/pg/postgresql.conf`
puts "Starting postgres"
@pg_pid = Process.spawn("#{@postgres_bin}postmaster -D tmp/test_data/pg")
@pg_pid = Process.spawn("script/start_test_db.rb --exec")
ENV["RAILS_ENV"] = "test"
# this shaves all the creation of the multisite db off