cancel
Showing results for 
Search instead for 
Did you mean: 
vhoebel
Mission Specialist
Mission Specialist
  • 851 Views

DO180, OCP 4.6, Chapter 7 todoapi pod throws error

DO180, OCP 4.6, Chapter 7, guided exercise where mysql and todoapi pods are started with run.sh

When trying to curl the todoapi pod as stated in the guided exervice ( curl -w "\n"  http://127.0.0.1:30080/todo/api/items/1), curl is "stuck" and nothing happens.

podman logs -f todoapi shows a long error. The main message of this error is:

Unhandled rejection SequelizeDatabaseError: No database selected

I checked the mysql pod - the database is there and populated.

In the ENV of the todoapi pod, the env var MYSQL_DATABASE is set to "items".

 

 

Labels (3)
0 Kudos
1 Reply
Tracy_Baker
Starfighter Starfighter
Starfighter
  • 828 Views

What was the return from this command in Step 9? This command won't work if the todoapi container didn't start: podman exec -it todoapi env

In the output, you should see MYSQL_DATABASE=items

You can narrow the output with: podman exec -it todoapi env | grep DATABASE

If you do not (or the container did not start, you need to go back and check step 6.2 (the second command you add to the run.sh script file):

podman run -d --name todoapi -e MYSQL_DATABASE=items -e MYSQL_USER=user1 \
-e MYSQL_PASSWORD=mypa55 -p 30080:30080 do180/todonodejs

Also, it says to add a sleep 9 command after -- it is in the Note section

Of course, if you make changes to run.sh, you'll have to remove the existing containers before executing the script again -- as they'll have the same names: todoapi and mysql

Program Lead at Arizona's first Red Hat Academy, est. 2005
Estrella Mountain Community College
0 Kudos
Join the discussion
You must log in to join this conversation.