Managing the Server
How to use Ghostwriter CLI to monitor and manage your Ghostwriter installation
Using Ghostwriter CLI to Manage the Server
Ghostwriter CLI can handle just about anything you might need or want to do with your Ghostwriter installation. Running the tool with the help
command–or no command–will print the latest usage information.
The following sections explain some of the core functionality.
Managing Docker Containers
Ghostwriter CLI's containers
command contains the following subcommands:
build
: Rebuild the containers (not the data volumes)up
: Bring up Ghostwriter containersdown
: Bring down Ghostwriter containersstart
: Start all stopped services and restart any running servicesstop
: Stop all running servicedrestart
: Stop and restart all services
If you ever need to check which containers are running, issue the running
command. This command lists all running containers related to Ghostwriter. The output will look something like this (edited for easier display):
The Status
column shows the uptime and health of the service. If you see an unhealthy
status, that means that service failed a health check and it may not be working properly. Learn more about health checks here: Health Monitoring
You can use the logs
command to view a particular container's recent log events. The command requires the name of a running container. Valid container names are:
all
django
graphql
nginx
postgres
redis
Using all
for the container name will return logs from all running containers. By default, logs
will return up to 500 lines. You can use the --lines
flag to adjust how many lines you want to retrieve.
Creating and Managing Backups
Ghostwriter CLI (>=v0.2.12) includes backup
and restore
commands to help you create and manage backups of your PostgreSQL database.
The backup
command uses PostgreSQL's pg_dump
to dump the contents of the database. The resulting SQL file is gunzipped and stored in the production_postgres_data_backups
Docker volume. Each file is named with the current timestamp (e.g., backup_2023_05_23T15_54_19.sql.gz).
Use the --list
flag to list all available backup files stored in the volume.
The restore
command recreates the database using the specified backup file.
Last updated