Skip to content

Instantly share code, notes, and snippets.

@agritheory
Last active May 21, 2018 17:51
Show Gist options
  • Save agritheory/e7a1930de58afa8118459129addf1056 to your computer and use it in GitHub Desktop.
Save agritheory/e7a1930de58afa8118459129addf1056 to your computer and use it in GitHub Desktop.
Bench and setup commands to remember
# Manual Install:
git clone https://github.com/frappe/bench bench-repo
pip install --user -e bench-repo
#delete existing site databases if reinstalling:
sudo mysql -u root - p # then it expects root MySQL password
show databases;
drop database alskjdfhalsdfhasldfj;
# name the bench based on client or workflow desired eg "Evaqua" or frappe-bench-backup
bench init evaqua --python python2.7 --verbose
# create a database specific to this bench/client
# actually the --db-name flag in the new-site command allows you toe specifiy the db name - it does not need to be built beforehand
"bench new-site evaqua.local --db-name evaqua..." # see below
# mysql -u root -p
# SQL$> create database evaqua;
# SQL$> exit;
# manually set up a new site
bench new-site evaqua.local --db-name evaqua --mariadb-root-username root --mariadb-root-password admin --verbose --force
# get apps and migrate
bench get-app frappe
bench install-app frappe
bench get-app erpnext
bench install-app erpnext
bench update --patch
bench migrate
# manaully make and move conf files. sudo chown tyler . may be required - repeat per-bench
bench setup procfile
bench setup nginx
sudo ln -s /config/nginx.conf /etc/nginx/sites-enabled/evaqua.conf
bench setup supervisor
sudo ln -s /config/supervisor.conf /etc/supervisor/conf.d/evaqua.conf
bench setup redis
bench start
# complete setup wizard before continuing even if you think it shouldn't matter
# install 3rd party apps
bench get-app transportation
bench install-app transportation
bench migrate
# if redis is running on start or when switching benches
sudo supervisorctl stop all
# if ENOSPC error
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
sysctl --system
# push db from local machine to remote server
scp 20180424_000000-site1_local-database.sql.gz [email protected]:/home/frappe/frappe-bench
# database restore (bench restore typically times out)
# database name == evaqua
mysql -u root -p --verbose evaqua < 20180509_085532-site1_local-database.sql
# after import
bench migrate
bench update --patch
# pin to version 10.1.25
# frappe
git fetch depth=30 # as of 5/10/18
git checkout ab6c3b5dadbc4f057eceb1eceba7217a28a74d83 .
# erpnext
git fetch depth=30
git checkout ede0af97cdeddc902a89c63dae85e7481cc790ba .
# alias to change from home folder to bench, stop all other supervisors, and start bench
alias evaqua="sudo supervisorctl stop all && cd evaqua && bench start"
@agritheory
Copy link
Author

agritheory commented May 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment