Open mojojojo94 opened 3 years ago
Hi, I know it's a spring boot course but it's also advertised as a full stack tutorial. The database set is a big part of the setup in to be able to move on. I've spent about 3 hours trying to get it work on my machine. I think this section can be made more clearer. Thanks.
totally agree, i had to spent lots of time finding right resource and instruction to get started with Docker desktop and Postgres setup on Docker...
docker create --name postgres-demo -e POSTGRES_PASSWORD=Welcome -p 5432:5432 postgres:11.5-alpine
docker start postgres-demo
docker stop postgres-demo
since you are trying to get it up and running, except you just want to test it out. Do good to get it up and running againdocker cp <create_tables.sql> postgres-demo:/create_tables.sql
. Where code in the <> should be replaced with the full path to the create_tables.sql filedocker exec -it postgres-demo psql -d conference_app -f create_tables.sql -U postgres
docker cp <insert_data.sql> postgres-demo:/insert_data.sql
. Don't forget the full path to the insert_data.sql filedocker exec -it postgres-demo psql -d conference_app -f insert_data.sql -U postgres
Good luck
I agree the steps to setup are vague. I couldn't work out where the .sql files are and how to execute them within Postgres so I just copied the whole script content and pasted it directly within Postgres.
Steps to get postgres working (Only tried this on Mac OS)
- Download Docker and install it, this step should be pretty straight forward
- Run
docker create --name postgres-demo -e POSTGRES_PASSWORD=Welcome -p 5432:5432 postgres:11.5-alpine
- Run
docker start postgres-demo
- You don't need to run
docker stop postgres-demo
since you are trying to get it up and running, except you just want to test it out. Do good to get it up and running again- Leave out the DB connection for now, that will be used in the Springboot application to connect to a running instance of Postgres
- Download the two .sql files (create_tables.sql and insert_data.sql) you will be needing them for the last steps
- Run
docker cp <create_tables.sql> postgres-demo:/create_tables.sql
. Where code in the <> should be replaced with the full path to the create_tables.sql file- Run
docker exec -it postgres-demo psql -d conference_app -f create_tables.sql -U postgres
- Run
docker cp <insert_data.sql> postgres-demo:/insert_data.sql
. Don't forget the full path to the insert_data.sql file- Run
docker exec -it postgres-demo psql -d conference_app -f insert_data.sql -U postgres
Good luck
Step 6. should be added to the readme or to the docker image root directory
getting syntax error while running command #8
getting syntax error while running command #8
Don't download the files by right clicking the hyperlinks. Clone the project and get the files from there.
Steps to get postgres working (Only tried this on Mac OS)
- Download Docker and install it, this step should be pretty straight forward
- Run
docker create --name postgres-demo -e POSTGRES_PASSWORD=Welcome -p 5432:5432 postgres:11.5-alpine
- Run
docker start postgres-demo
- You don't need to run
docker stop postgres-demo
since you are trying to get it up and running, except you just want to test it out. Do good to get it up and running again- Leave out the DB connection for now, that will be used in the Springboot application to connect to a running instance of Postgres
- Download the two .sql files (create_tables.sql and insert_data.sql) you will be needing them for the last steps
- Run
docker cp <create_tables.sql> postgres-demo:/create_tables.sql
. Where code in the <> should be replaced with the full path to the create_tables.sql file- Run
docker exec -it postgres-demo psql -d conference_app -f create_tables.sql -U postgres
- Run
docker cp <insert_data.sql> postgres-demo:/insert_data.sql
. Don't forget the full path to the insert_data.sql file- Run
docker exec -it postgres-demo psql -d conference_app -f insert_data.sql -U postgres
Good luck
Hi, I just wanna add that in step 8, if there's not a database ready (psql: FATAL: database "conference_app" does not exist) then creating the database can be done in two ways:
docker exec -it postgres-demo createdb conference_app -U postgres
.docker exec -it postgres-demo psql -U postgres
then inside PSQL: create database conference_app;
(as instructed in the README file)
Either way works.
Hi, I am trying to follow along with your pluralsight course https://app.pluralsight.com/library/courses/creating-first-spring-boot-application. I am getting stuck on setting up the postgres db.
For example, creating the the image for the postgres db and starting it stopping it is clear but what do I do with the connection info, where is that used? also the commands are not in order of how someone would execute them to get the db set up and running for the course.
Also under "Application Data Setup" - where are those commands supposed to be executed? inside the postgres cli? outside in a terminal or a shell?
You also just gloss over this big and important step in your pluralsight course even though this course is listed as beginner on pluralsight. In your course videos you do not go over how to install and setup docker or a local postgres instance or how to create and install data in tables as well. I know you might say the focus of this course is not to know docker or postgres since we are talking about spring boot but it seems like a big oversight since use those two technologies to set up your spring boot application.
Would like some clarification of these steps for myself and for future viewers of your course.
Thank you!