Skip to content

FAQ for Dassie Docker Test App

E. Lynette Rayle edited this page Apr 27, 2021 · 37 revisions

Frequently Asked Questions

Prerequisites:

Start/Stop Hyrax:

Hyrax in the Browser:

Testing and Debugging Hyrax:

Debugging Docker:


What are the prerequisites?

For Mac & Windows:

  • (recommended) For Mac & Windows, installing Docker Desktop will install the required Docker Engine and Docker Compose. It provides a Dashboard UI where you can view the state of each container, view of logs for each container, start/restart/stop each container, and more. You can install Docker Engine and Docker Compose individually if you prefer. See the links below for other systems.

For other systems:

All systems:

  • (required) Clone hyrax from GitHub.

How do I start the test app?

The images must be built first. This is done the first time you use a container and again if major changes are made and you want to update the container. To do this, execute the following from the root of the hyrax app...

docker compose build

To start the services defined in docker-compose.yml, execute the following from the root of the hyrax app...

docker compose up

How do I stop the test app?

To stop the services defined in docker-compose.yml, execute the following from the root of the hyrax app...

docker compose down

How can I test Hyrax in my browser?

http://localhost:3000


How can I log in as an admin user?

There is a predefined admin user:


How can I log in as a basic user?

There are two predefined basic users:


How do I set a breakpoint in the application?

TBD


How can I view the application log?

TBD


How do I connect to the application container?

TBD


How do I connect to the database?

Execute the following to connect to the container hosting the database. Once connected you use the postgres CLI to explore the database.

docker-compose run postgres bash

When done, use <CTRL><C> to exit the connection to the container.


How can I tell if all the containers are running?

NOTE: hyrax_3_0_db_migrate_1 and hyrax_3_0_sidekiq_1 will show EXITED (0). These are used for initial migration and then stop.

In Docker Desktop:

  • Go to Containers/Apps (left side menu)
  • expand hyrax_3_0 (main content area) - This lists all the containers and their state (e.g. RUNNING, EXITED)

Using the Command Line The following command will list all containers started as services by docker compose. It will list the state of each service (e.g. Up, Exit).

docker-compose ps

How can I view the logs for a container?

In Docker Desktop: Go to Containers/Apps (left side menu) expand hyrax_3_0 (main content area). This will list all the containers and show the state of each.


What to try if the test app doesn't fully start?

Sometimes all the various containers and services do not fully start and connections between containers fail. If this happens, you can try the following in increasing levels of time required for the step to complete. You may not need to do all of this to make your system happy again.

Generally, after trying each step, start the services back up and see if the problem is fixed.

After each step, start services with:

docker compose up

NOTE: The following lists commands to execute in the terminal from the root of hyrax. There are ways to do most of this through Docker Desktop that are not described here.

restart docker compose

docker compose down
docker compose up

restart docker

Easiest way is through the Docker Desktop Dashboard.

  • Click the troubleshooting bug in the banner bar of the Desktop app.
  • Click Restart button next to Restart Docker Desktop.

Most of the time, this is sufficient to get things working again.

prune containers

If all your containers were created by docker compose for hyrax, then there won't be any running after executing the docker compose down command. But if you use docker for other projects, there may be some hanging around that you don't need.

NOTE: This will delete all stopped containers for all projects, so exercise some caution.

docker compose down
docker container prune

remove images

List images:

docker image ls

This will list all images. If a container does not start, you can remove the image for that container. Copy the image ID from the listing and use it in place of IMAGE_ID in the following command.

docker image remove _IMAGE_ID_ .

If the image is a public image from Docker Hub, then it will be downloaded again when you run docker compose up. If you needed to remove the image for the Hyrax app, then you will need to rebuild the image first using docker compose build.

Remove Networks

WARNING! This will remove:

  • all stopped containers
  • all networks not used by at least one container
  • all dangling images
  • all dangling build cache
docker compose down
docker system prune

Last Resort - kill everything

WARNING! This is a last resort.

  • Pruning docker volumes will reset all data that generally is persisted when taking the system down and back up.
  • Pruning images will require all images to be down loaded or rebuilt which is time consuming.
docker compose down
docker container prune
docker volume prune
docker image prune -a 
docker system prune

Perform the steps in How do I start the test app? to start fresh.


How do I connect to the database?

Execute the following to connect to the container hosting the database. Once connected you use the postgres CLI to explore the database.

docker-compose run postgres bash

When done, use <CTRL><C> to exit the connection to the container.


Clone this wiki locally