Fc Scripts
Helper scripts to be run on Frappe sites
- Author: frappe
- Repository: https://github.com/frappe/fc-scripts
- GitHub stars: 16
- Forks: 9
- License: GPL-3.0
- Category: Developer Tools
- Maintenance: Actively Maintained
- Frappe versions: develop
Install Fc Scripts
bench get-app https://github.com/frappe/fc-scripts
Add the Frappe Gems badge to your README
Maintain Fc Scripts? Paste this into your README:
[](https://frappegems.com/gems/apps/frappe/fc-scripts)
About Fc Scripts
fc-scripts
Helper scripts to be run on Frappe Cloud sites
Available Scripts
- Script to delete all files from the database and file system. attachment_delete.py
- Read the deadlocks from mariadb error log analyze_deadlocks.py
- Check corruption in MariaDB tables and fix them checkdbtables.sh
- On premises failover manager setup script press-on-prem-failover.sh
Usage -
Deadlock Analyzer
Usage -
python ./analyze_deadlocks.py ./mysql-error.log --days 1
usage: analyze_deadlocks.py [-h] [--database DATABASE] [--days DAYS] [--start START] [--end END] [--max-lines MAX_LINES] [--output-file OUTPUT_FILE] [--format FORMAT] logfile
Find deadlocks in MySQL error logs
positional arguments:
logfile Path to MySQL error log file
options:
-h, --help show this help message and exit
--database DATABASE Database Name (optional)
--days DAYS Only consider entries from the last N days
--start START Only consider entries after this date (YYYY-MM-DD)
--end END Only consider entries before this date (YYYY-MM-DD)
--max-lines MAX_LINES
Maximum number of lines to read from log file
--output-file OUTPUT_FILE
Path of file to store result
--format FORMAT csv / json / table (default: table)
MariaDB Table Checker
Need to run as root user
./check_db_tables.sh
MariaDB IO Monitor Installation
Run this as root user
curl -fsSL https://raw.githubusercontent.com/frappe/fc-scripts/refs/heads/develop/mariadb_io_monitor/install.sh | bash -
MariaDB Monitor Installation
Run this as root user
curl -fsSL https://raw.githubusercontent.com/frappe/fc-scripts/refs/heads/develop/mariadb_monitor/install.sh | bash -
FC On Prem Failover Setup
Run this as root user
For first time setup
curl -fsSL https://raw.githubusercontent.com/frappe/fc-scripts/refs/heads/develop/press-on-prem-failover.sh -o press-on-prem-failover.sh && chmod +x ./press-on-prem-failover.sh && ./press-on-prem-failover.sh
For triggering another setup (for password updates etc.)
curl -fsSL https://raw.githubusercontent.com/frappe/fc-scripts/refs/heads/develop/press-on-prem-failover.sh -o press-on-prem-failover.sh && chmod +x ./press-on-prem-failover.sh && ./press-on-prem-failover.sh setup
Data Recovery
Setup Necessary Tools
# Install tools
apt install unzip
# Install mariadb
apt-key add <(curl -fsSL https://mariadb.org/mariadb_release_signing_key.pgp)
DISTRO=$(lsb_release -cs)
echo "deb https://mirror.rackspace.com/mariadb/repo/10.6/ubuntu ${DISTRO} main" | \
tee /etc/apt/sources.list.d/mariadb.list
apt update
apt install -y mariadb-server mariadb-client libmariadbclient18
systemctl disable mariadb
systemctl stop mariadb || true
ARCH=$(uname -m)
if [[ "$ARCH" == "x86_64" ]]; then
URL="https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"
elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then
URL="https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
curl "${URL}" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install
Recover
curl https://raw.githubusercontent.com/frappe/fc-scripts/refs/heads/develop/data_recovery/recover.py -o recover.py
For database,
export AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxx
export AWS_DEFAULT_REGION=ap-south-1
python3 recover.py --mode db --data /opt/volumes/benches/xxxxx --bucket bahrain-data-recovery --prefix xxx-bahrain.frappe.cloud --db-pass xxxxxxxxxxxxxxxx
Related Developer Tools apps for Frappe & ERPNext
- Frappe — Low code web framework for real world applications, in Python and Javascript
- Frappe Docker — Docker environment for developing, deploying, and running Frappe applications (ERPNext and custom apps) in production and development
- Builder — Craft beautiful websites effortlessly with an intuitive visual builder and publish them instantly
- Bench — CLI to manage Multi-tenant deployments for Frappe apps
- Frappe Ui — A set of components and utilities for rapid UI development
- Press — Full service cloud hosting for the Frappe stack - powers Frappe Cloud
- Gameplan — Open Source Discussions Platform for Remote Teams
- Doppio — A Frappe app (CLI) to magically setup single page applications and Vue/React powered desk pages on your custom Frappe apps.