Managing Dash Apps via Dokku instead of Official API

The SSH commands below are temporary workarounds for management actions not available in the Dash Enterprise GraphQL API.
They run against dokku, a core part of the technology stack in Dash Enterprise 4. Support for these commands may be dropped in the future.

This page applies to Dash Enterprise 4.

Prerequisites

List of Exposed Dash Enterprise Commands

All commands are performed using ssh dokku@your-dash-enterprise -p PORT command flags appname where
PORT is the SSH port for Dash Enterprise (usually 3022). Dash Enterprise will compare the private key supplied to the SSH command
and the public key uploaded to Dash Enterprise in order to authenticate the user initiating the request.

Note that using the same public key for multiple users on Dash Enterprise isn’t supported and will likely prevent it
from authenticating to the correct user.

These commands can only be run by the app-owner or an admin account.

Lock App

If you wish to disable deploying for a period of time, this can be
done via deploy locks. Normally, deploy locks exist only for the duration
of a deploy to prevent deploys from colliding, but a deploy lock can
be created at any time by running the apps:lock command.

Example:
ssh dokku@your-dash-enterprise -p PORT apps:lock my-dash-app

 

Unlock app

In some cases, it may be necessary to remove an existing deploy lock.
This can be performed via the apps:unlock command.

Warning: Removing the deploy lock will not stop in-progress deploys.
At this time, in-progress deploys will need to be manually terminated by
someone with access to the Dash Enterprise server console.

Example:

ssh dokku@your-dash-enterprise -p PORT apps:unlock my-dash-app

 

Get app logs

You can get logs of an app using the logs command:

Example:

ssh dokku@your-dash-enterprise -p PORT logs my-dash-app

logs also support following flags:

-n, --num NUM          # the number of lines to display
-p, --ps PS            # only display logs from the given process
-t, --tail             # continually stream logs
-q, --quiet            # display raw logs without colors, time and names

You can use these flags as follows:

ssh dokku@your-dash-enterprise -p PORT logs my-dash-app -t -p web

 

Get logs from failed deploy

In some cases, it may be useful to retrieve the logs from a previously failed deploy.
You can retrieve these logs with the logs:failed command.

Example:

ssh dokku@your-dash-enterprise -p PORT logs:failed my-dash-app

 

Rebuild an app’s environment

 

You can trigger an application to rebuild its environment using ps:rebuild.

Example:

ssh dokku@your-dash-enterprise -p PORT ps:rebuild my-dash-app

 

Get a report of your app’s status

 

This command displays a process report for one or more apps.

Example:

ssh dokku@your-dash-enterprise -p PORT ps:report my-dash-app

You can also retrieve a specific piece of service info via flags:

--processes         # Display only the number of running processes
--deployed          # Display only the deploy status i.e. true or false
--running           # Display the running status i.e. true or false
--restore           # Display the running status i.e. true or false
--restart-policy    # Display the restart policy for the app

ssh dokku@your-dash-enterprise -p PORT ps:report my-dash-app --processes

 

Restart an app

Applications can be restarted, which is functionally identical to releasing and deploying an application.

Example:

ssh dokku@your-dash-enterprise -p PORT ps:restart my-dash-app

 

Stop an app

Deployed applications can be stopped using the ps:stop command.
This turns off all running containers for an application, and will result in a 502 Bad Gateway response.

Example:

ssh dokku@your-dash-enterprise -p PORT ps:stop my-dash-app

 

Start an app

All stopped containers can be started using the ps:start command.

Example:

ssh dokku@your-dash-enterprise -p PORT ps:start my-dash-app

 

Clear app cache

Building containers with buildpacks results in a persistent cache directory between deploys of the same application. To clear this cache directory, run the following shell command:

Example:

ssh dokku@your-dash-enterprise -p PORT repo:purge-cache my-dash-app

 

These commands can only be run by the service-owner.

Redis

Export the contents of a Redis database

 

Export a dump of the Redis service database. By default, datastore output is exported to stdout:

Example:

ssh dokku@your-dash-enterprise -p PORT redis:export redis-db

You can redirect this output to a file:

ssh dokku@your-dash-enterprise -p PORT redis:export redis-db > db.dump

 

Upload an existing redis dump to Redis database

Import a datastore dump:

Example:

ssh dokku@your-dash-enterprise -p PORT redis:import redis-db < db.dump

 

Get connection info for a Redis service

Print the connection information. Get connection information as follows:

Example:

ssh dokku@your-dash-enterprise -p PORT redis:info redis-db

You can also retrieve a specific piece of service info via flags:

ssh dokku@your-dash-enterprise -p PORT redis:info redis-db --config-dir
ssh dokku@your-dash-enterprise -p PORT redis:info redis-db --data-dir
ssh dokku@your-dash-enterprise -p PORT redis:info redis-db --dsn
ssh dokku@your-dash-enterprise -p PORT redis:info redis-db --exposed-ports
ssh dokku@your-dash-enterprise -p PORT redis:info redis-db --id
ssh dokku@your-dash-enterprise -p PORT redis:info redis-db --internal-ip
ssh dokku@your-dash-enterprise -p PORT redis:info redis-db --links
ssh dokku@your-dash-enterprise -p PORT redis:info redis-db --service-root
ssh dokku@your-dash-enterprise -p PORT redis:info redis-db --status
ssh dokku@your-dash-enterprise -p PORT redis:info redis-db --version

 

Get Redis log

Print the most recent log(s) for this service.

Example:

ssh dokku@your-dash-enterprise -p PORT redis:logs redis-db

By default, logs will not be tailed, but you can do this with the –tail flag:

ssh dokku@your-dash-enterprise -p PORT redis:logs redis-db --tail

 

Restart a Redis service

Restart the service:

Example:

ssh dokku@your-dash-enterprise -p PORT redis:restart redis-db

 

Stop a Redis service

 

Stop the service:

Example:

ssh dokku@your-dash-enterprise -p PORT redis:stop redis-db

 

Start a stopped Redis service

Start the service:

Example:

ssh dokku@your-dash-enterprise -p PORT redis:start redis-db

 

Postgres

Export the contents of a Postgres database

Export a dump of the Postgres service database. By default, datastore output is exported to stdout:

Example:

ssh dokku@your-dash-enterprise -p PORT postgres:export postgres-db

You can redirect this output to a file:

ssh dokku@your-dash-enterprise -p PORT postgres:export postgres-db > db.dump

 

Upload an existing postgres dump to Postgres database

Import a datastore dump:

Example:

ssh dokku@your-dash-enterprise -p PORT postgres:import postgres-db < db.dump

 

Get connection info for a Postgres service

Print the connection information. Get connection information as follows:

Example:

ssh dokku@your-dash-enterprise -p PORT postgres:info postgres-db

You can also retrieve a specific piece of service info via flags:

ssh dokku@your-dash-enterprise -p PORT postgres:info postgres-db --config-dir
ssh dokku@your-dash-enterprise -p PORT postgres:info postgres-db --data-dir
ssh dokku@your-dash-enterprise -p PORT postgres:info postgres-db --dsn
ssh dokku@your-dash-enterprise -p PORT postgres:info postgres-db --exposed-ports
ssh dokku@your-dash-enterprise -p PORT postgres:info postgres-db --id
ssh dokku@your-dash-enterprise -p PORT postgres:info postgres-db --internal-ip
ssh dokku@your-dash-enterprise -p PORT postgres:info postgres-db --links
ssh dokku@your-dash-enterprise -p PORT postgres:info postgres-db --service-root
ssh dokku@your-dash-enterprise -p PORT postgres:info postgres-db --status
ssh dokku@your-dash-enterprise -p PORT postgres:info postgres-db --version

 

Get Postgres logs

Print the most recent log(s) for this service.

Example:

ssh dokku@your-dash-enterprise -p PORT postgres:logs postgres-db

By default, logs will not be tailed, but you can do this with the –tail flag:

ssh dokku@your-dash-enterprise -p PORT postgres:logs postgres-db --tail

 

Restart a Postgres service

Restart the service:

Example:

ssh dokku@your-dash-enterprise -p PORT postgres:restart postgres-db

 

Stop a Postgres service

Stop the service:

Example:

ssh dokku@your-dash-enterprise -p PORT postgres:stop postgres-db

 

Start a stopped Postgres service

Start the service:

Example:

ssh dokku@your-dash-enterprise -p PORT postgres:start postgres-db

 

Unsupported and Deprecated Commands

These dokku commands are no longer supported or recommended. Each of their recommended alternatives, respectively, are provided below.

Scale app process

Use the scaleProcesses GraphQL mutation instead
of the dokku ps:scale command.

Alternatively, provide a DOKKU_SCALE
file in your repository and redeploy.

List persistent storage directories

Use the mounts GraphQL query within an apps query instead
of the dokku storage:list command.

Creating & Linking Services (Postgres & Redis Databases)

Use the addService, deleteService, linkService, and unlinkService
GraphQL mutations instead of the dokku service commands.