Starting a bash shell
If Deskpro is already running
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 container
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 Utils
mysql-read and mysql-primary
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
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-var
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 files
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.
Cookbook
Start an interactive mysql client
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 query
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 tasks
Run the cron command in verbose mode like so:
dpv5/bin/cron --verbose copy
Manually run email collection
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 processing
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 admin
dpv5/bin/console dp:login-token john@example.com copy
Please log in or register to submit a comment.