-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PostreSQL password #22
Comments
You should be able to access PostgreSQL directly but if still didn't work, please check the environment variables exported within your dev container here. |
Hi @itsmechlark I had similar issue too. After setting up the postgresql service, I tried to login but got prompted for passoword. I tried Please do you mind telling me what I might not be doing well? My {
"features": {
"ghcr.io/itsmechlark/features/postgresql:1.5.0": {}
}
} |
This is what I later did. I had to modified the pg_hba.conf file
#!/usr/bin/env bash
# Get version number
major_version_number=$(psql --version | cut -d' ' -f3 | cut -d'.' -f1)
# Path to the pg_hba.conf file
PGHBA_CONF="/etc/postgresql/${major_version_number}/main/pg_hba.conf"
# Backup the original configuration file
cp $PGHBA_CONF ${PGHBA_CONF}.bak
# Modify the pg_hba.conf file to use 'trust' authentication
cat <<EOF > $PGHBA_CONF
# Database administrative login by Unix domain socket
local all all trust
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
EOF
# Restart PostgreSQL to apply changes
sudo service postgresql restart
echo "PostgreSQL configuration updated and service restarted."
{
"name": "PostgreSQL Playground",
"features": {
"ghcr.io/itsmechlark/features/postgresql:1.5.0": {}
},
"postCreateCommand": "sudo bash .devcontainer/setup-postgres.sh"
} |
After including an image in my {
"name": "PostgreSQL Dev Container Playground",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/itsmechlark/features/postgresql:1": {
"version": "latest"
}
}
} |
setup this repo to my github codespace in devcontainer.json, in features. Also restart postgresql service to run postgres. So, what the postgres user password? How can I manage it?
The text was updated successfully, but these errors were encountered: