Frappe Server Management Commands

This document provides common commands for managing Frappe servers and services via Portainer or the DigitalOcean console. You can log in as either the frappe or extension user and perform service operations as needed.


1. Switching User

Before running any Frappe bench or service commands, switch to the appropriate system user. Depending on the setup, the user will be either frappe or extension.

# Switch to the extension user
su - extension

# Switch to the frappe user (if required)
su - frappe


2. Navigating to the Bench Directory

Change directory to the Frappe bench to access bench commands and application files.

cd ~/frappe-bench

Note: Adjust the path if your bench directory is located elsewhere.


3. Managing the Database Service (MariaDB)

If the internal server is down, or if you encounter issues related to database connectivity or Python report generation:

# Start the MariaDB service to ensure the database is running
sudo service mariadb start

# Stop the MariaDB service
sudo service mariadb stop

Common Use Cases: - Starting the database after a server reboot. - Restarting the database when encountering connection errors in reports.


4. Managing the Web Server (Nginx)

For HTTP errors such as 502 Bad Gateway or 504 Gateway Timeout, manage the Nginx service:

# Start the Nginx service
sudo service nginx start

# Stop the Nginx service
sudo service nginx stop

Common Use Cases: - Starting Nginx after configuration changes. - Stopping Nginx before editing config files or performing maintenance.


5. Adding Laptop Public Key to Server

To enable SSH access from your laptop to the server, follow these steps:

On Your Laptop:

# Display the public key
cat ~/.ssh/id_rsa.pub

On the Server:

# Navigate to the .ssh directory (for the relevant user)
cd ~/.ssh/

# Open the authorized_keys file
nano authorized_keys

# Paste the public key from your laptop into this file
# Save and exit (Ctrl + O, Enter, Ctrl + X)

Note: If authorized_keys doesn't exist, you can create it using touch authorized_keys.


6. Summary of Commands

Service/Action

Command

Switch to extension user

su - extension

Switch to frappe user

su - frappe

Change to bench directory

cd ~/frappe-bench

MariaDB (start)

sudo service mariadb start

MariaDB (stop)

sudo service mariadb stop

Nginx (start)

sudo service nginx start

Nginx (stop)

sudo service nginx stop

View laptop public key

cat ~/.ssh/id_rsa.pub (on laptop)

Open server auth keys file

nano ~/.ssh/authorized_keys (on server)


For additional Frappe bench commands and advanced server management, refer to the official Frappe documentation at https://frappeframework.com/docs.

On this page