Tutor makes it easy to get the logs for all connected services by using a wrapper for docker-compose logs.
user@edx:~$ tutor local logs -h
Usage: tutor local logs [OPTIONS] [SERVICE]...
View output from containers. This is a wrapper around `docker-compose logs`.
Options:
-f, --follow Follow log output
--tail INTEGER Number of lines to show from each container
-h, --help Show this message and exit.
user@edx:~$
Tip: Reference the docker-compse.yml
file to get a list of all servicesless "$(tutor config printroot)"/env/local/docker-compose.yml
Get the last 50 logs for all services.
tutor local logs --tail 50
Save the last 300 logs for all services to a text file.
tutor local logs --tail 300 > logs.txt
Get the last 50 logs from lms
and mysql
.
tutor local logs --tail 50 lms
tutor local logs --tail 50 mysql
Sometimes, you might want to save all service logs (or all logs) to a text file.
The operation can result in very large files! The operation below resulted in a 500MB file from only 5 days of usage.
tutor local logs lms > lms-logs.txt
There are times when it is necessary to enter a running container using docker exec, such as interacting with the database during runtime.
First, get the list of running containers
docker ps
CONTAINER ID IMAGE ... NAMES
fe019ddc6ca5 overhangio/openedx:... tutor_local_cms-worker_1
6e79a248fd95 overhangio/openedx:... tutor_local_cms_1
913ed0e2cbc1 overhangio/openedx:... tutor_local_lms-worker_1
b8755e708e80 overhangio/openedx:... tutor_local_lms_1
2a80d6444b0d overhangio/openedx-... tutor_local_notes_1
035e620b9177 nginx:1.19.9 ... tutor_local_nginx_1
f1a441551356 overhangio/openedx-... tutor_local_forum_1
de7aaa40edc6 mongo:4.0.25 ... tutor_local_mongodb_1
fe848de7dd53 mysql:5.7.33 ... tutor_local_mysql_1
3e2a5111c9d0 redis:6.2.1 ... tutor_local_redis_1
238b5eefef2d elasticsearch:7.8.1... tutor_local_elasticsearch_1
ff0fca1d5910 namshi/smtp:latest ... tutor_local_smtp_1
f748f6a6e214 caddy:2.3.0 ... tutor_local_caddy_1
Then, get a root prompt in a container (this example uses MongoDB).
docker exec -it tutor_local_mongodb_1 /bin/bash
Or, you can enter the MongoDB shell directly.
docker exec -it tutor_local_mongodb_1 mongo
Powered by Grav + with by Trilby Media.
© Copyright 2021, EKTU EdTech | CC BY 4.0 | Licensed under the Creative Commons Attribution 4.0 International license