Skip to main content

Debugging / Troubleshooting

in Deskpro container image
Authors list
Published: 31 Jul 2023|Last updated: 18 Aug 2023

Starting a bash shellCopy link to Starting a bash shell to clipboard

If Deskpro is already runningCopy link to If Deskpro is already running to clipboard

If you already have an existing Deskpro container running, then you can get a bash shell or run one-off commands on that already-running container.

First, you need the container name or ID which you can get by looking at running containers:

docker ps
copy

Once you have the name (or ID if you didn't name the container) you can use docker run to open a bash shell:

# Get a bash shell on the running container docker exec -it NAME_OR_ID bash
copy

In a new isolated containerCopy link to In a new isolated container to clipboard

If Deskpro isn't running or if you want a totally isolated environment for whatever reason, then you can use the bash run mode to boot to a bash shell, or use exec to boot and run a one-off command.

# e.g. run a new container that will boot into bash docker run \ --env-file "config.env" \ -it --rm \ deskpro/deskpro-product:$DPVERSION-onprem \ bash
copy

The -it flag enables interactive and tty emuluation (so it will behave like a regular terminal) and --rm will make docker clean-up (delete) the container when it's done.

Container UtilsCopy link to Container Utils to clipboard

mysql-read and mysql-primaryCopy link to mysql-read and mysql-primary to clipboard

These helpers make it easier to run mysql client commands without having to supply server info or credentials. They behave exactly like the normal mysql client would except you don't need to supply credentials. (Indeed, these utils are simple wrappers around the default mysql client).

# Instead of this... mysql -hmyhost -umyuser -p mydb # You can simply do mysql-read # Or if you want to be able to perform writes (e.g. UPDATE/DELETE queries) # you should use the primary: mysql-primary
copy
Note

It's recommended to use the mysql-read connection unless you know you need to make changes. mysql-read will use your defined read connection if set. If you don't have a read connection, then it will attempt to make the connection readonly.

container-varCopy link to container-var to clipboard

Deskpro config environment variables are unset when the container starts to avoid having possibly sensitive variables in the environment. If you need to access the value of a config variable at run time (e.g. debugging/troubleshooting), use the container-var utility to print the value to stdout.

For example, in a bash shell you might do something like this:

db_pass=$(container-var DESKPRO_DB_PASS) echo "The database password is: $db_pass"
copy

Raw log filesCopy link to Raw log files to clipboard

Raw log files for all services are generally written to /var/logs. You usually consume logs by using normalized logs provides by vector (see Logging), so the only reason to inspect the raw log files is if there is a problem with vector or if vector isn't running at all.

CookbookCopy link to Cookbook to clipboard

Start an interactive mysql clientCopy link to Start an interactive mysql client to clipboard

Use the mysql-read or mysql-primary utils. Just type the name of the utility at the command prompt and it will use the same database credentials as Deskpro uses.

Run a MySQL queryCopy link to Run a MySQL query to clipboard

Similar to above but just pass an extra -e YOUR_QUERY. This will run your query instead of starting an interactive client.

# e.g. running a select query mysql-read -e 'SELECT * FROM people WHERE is_agent=1'
copy

Manually run scheduled tasksCopy link to Manually run scheduled tasks to clipboard

Run the cron command in verbose mode like so:

dpv5/bin/cron --verbose
copy

Manually run email collectionCopy link to Manually run email collection to clipboard

Run the email collection command in verbose mode like so:

# run collection for about a minute services/email-processing/artisan email:collect-queue --max-time=60 --verbose
copy

Manually run email processingCopy link to Manually run email processing to clipboard

Run the email processing command in verbose mode like so:

# run processing for about a minute or until no messages remain services/email-processing/artisan email:process-queue --max-time=60 --stop-when-empty --verbose
copy

Get a login token for an agent or adminCopy link to Get a login token for an agent or admin to clipboard

dpv5/bin/console dp:login-token john@example.com
copy
HelpfulUnhelpful
next pageOperating the HTTP service
previous pageLogging

Please log in or register to submit a comment.