Skip to content

Commit

Permalink
Postgres refused connection fix (#48)
Browse files Browse the repository at this point in the history
* feat: added postgres as user

* docs: added troubleshooting section
  • Loading branch information
miguel-merlin authored Feb 12, 2025
1 parent 6edbd1b commit 8c14f32
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
POSTGRES_USER=blueprint_admin_backend
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres
SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/postgres
SPRING_DATASOURCE_USERNAME=blueprint_admin_backend
SPRING_DATASOURCE_USERNAME=postgres
SPRING_DATASOURCE_PASSWORD=postgres
SPRING_PROFILES_ACTIVE=dev
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ You should see the following output in your terminal
```
o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path ''
com.sitblueprint.admin.BlueprintAdmin : Started BlueprintAdmin in 2.255 seconds (process running for 2.392)
```

You can also run the server directly from the terminal

## Troubleshooting
If you are having issues running the postgres db with Docker try the following
```bash
docker-compose down -v
rm -rf postgres-data
docker-compose up --build
```

## How to connect to database in Docker Container?
Start the docker container
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
postgres:
image: postgres:latest
image: postgres:10-alpine
restart: always
environment:
- POSTGRES_USER=${POSTGRES_USER}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.format_sql=true

spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/postgres}
spring.datasource.username=${SPRING_DATASOURCE_USERNAME:blueprint_admin_backend}
spring.datasource.username=${SPRING_DATASOURCE_USERNAME:postgres}
spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:postgres}

spring.profiles.active=${SPRING_PROFILES_ACTIVE:dev}
Expand Down

0 comments on commit 8c14f32

Please sign in to comment.