fix: pg pass printed by docker container (#1382)

* fix: pg pass printed by docker container (#1371)

The "POSTGRES_PASSWORD" variable setting inside the entrypoint script
of the rails docker container was printed in the logs when the
container was run using docker compose.

Fixed this by removing this password being set in this script.
Added env file from root directory to the container
Updated the tailwind evrsion in yarn lock

* fix: moved pg database url check in the entrypoint to another helper

created a new helper docker/entrypoints/helpers/pg_database_url.sh
to parse the databse url and export the postgres host, user and
port.

With this the pg is_ready check falls to a common format rather
than two formats depending on DATABASE_URL env variable is
present or not.

* fix: rename pg ready variable in rails entrypoint
This commit is contained in:
Sony Mathew 2020-11-06 00:06:07 +05:30 committed by GitHub
parent afa234a207
commit 39c2270227
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 8 deletions

View file

@ -35,6 +35,7 @@ services:
- sidekiq
ports:
- 3000:3000
env_file: .env
environment:
- WEBPACKER_DEV_SERVER_HOST=webpack
- NODE_ENV=development

View file

@ -0,0 +1,10 @@
#!/usr/bin/env ruby
require 'uri'
# Let DATABASE_URL env take presedence over individual connection params.
if !ENV['DATABASE_URL'].nil? && ENV['DATABASE_URL'] != ''
uri = URI(ENV['DATABASE_URL'])
puts "export POSTGRES_HOST=#{uri.host} POSTGRES_PORT=#{uri.port} POSTGRES_USERNAME=#{uri.user}"
else
puts "export POSTGRES_PORT=5432"
end

View file

@ -9,14 +9,11 @@ rm -rf /app/tmp/cache/*
echo "Waiting for postgres to become ready...."
# Let DATABASE_URL env take presedence over individual connection params.
if [ -z "$DATABASE_URL" ]; then
PGPASSWORD=$POSTGRES_PASSWORD
PSQL="pg_isready -h $POSTGRES_HOST -p 5432 -U $POSTGRES_USERNAME"
else
PSQL="pg_isready -d $DATABASE_URL"
fi
# This is done to avoid printing the DATABASE_URL in the logs
$(docker/entrypoints/helpers/pg_database_url.sh)
PG_READY="pg_isready -h $POSTGRES_HOST -p $POSTGRES_PORT -U $POSTGRES_USERNAME"
until $PSQL
until $PG_READY
do
sleep 2;
done

View file

@ -10422,7 +10422,7 @@ table@^5.2.3:
slice-ansi "^2.1.0"
string-width "^3.0.0"
tailwindcss@^1.8.3:
tailwindcss@^1.9.6:
version "1.9.6"
resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-1.9.6.tgz#0c5089911d24e1e98e592a31bfdb3d8f34ecf1a0"
integrity sha512-nY8WYM/RLPqGsPEGEV2z63riyQPcHYZUJpAwdyBzVpxQHOHqHE+F/fvbCeXhdF1+TA5l72vSkZrtYCB9hRcwkQ==