updated dbench and docs

This commit is contained in:
chabad360 2018-08-02 19:24:22 -07:00
parent 89f30954c8
commit 9a974b0c9f

32
dbench
View file

@ -1,19 +1,20 @@
#!/bin/bash #!/bin/bash
function usage { function usage {
echo "Usage: dbench [ --setup [-d] | --init [-med] [sitename] | " echo "Usage: $(basename "$0") [ --setup [-u] | --init [-m -e -d] [sitename] | --start [-b] | -h (--help) | -d (--developer) [sitename] | -a (--add) | -c \"Command to be sent to Frappe Bench on Docker\""
echo '' echo ''
echo 'where:' echo 'where:'
echo ' -h show this help text' echo ' dbench loads up container'
echo ' -c command send a command to bench in the container' echo ' -c "command" send a command to bench in the container'
echo ' -d sitename enables developer mode for specified site' echo ' -h | --help show this help text'
echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' echo ' -d | --developer [sitename] enables developer mode for "sitename" (if not specified, it will default to site1.local)'
echo ' -a | --add adds site-names to /etc/hosts file in the container to facilitate multisite access'
echo ' --setup [-u] builds docker containers, NOTE: assumes you have docker installed' echo ' --setup [-u] builds docker containers, NOTE: assumes you have docker installed'
echo ' -u start up docker containers as well' echo ' -u start up docker containers as well'
echo ' --init [-m -e -d] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)'
echo ' -e initializes frappe-bench and installs erpnext'
echo ' --start [-b] starts frappe docker' echo ' --start [-b] starts frappe docker'
echo ' -b starts bench as well' echo ' -b starts bench as well'
echo ' --init [-e] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)'
echo ' -e initializes frappe-bench and installs erpnext'
} }
function frappe_installer { function frappe_installer {
@ -45,6 +46,11 @@ cmd=0
positional=() positional=()
if ! $key1; then
docker exec -it frappe bash
exit 0
fi
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
key="$1" key="$1"
@ -140,6 +146,7 @@ if [ $start == 1 ]; then
if [ $bench == 1 ]; then if [ $bench == 1 ]; then
docker exec -it frappe bash -c "bench start" docker exec -it frappe bash -c "bench start"
fi fi
exit 0
fi fi
if [ $dev == 1 ]; then if [ $dev == 1 ]; then
@ -160,6 +167,13 @@ if [ $add == 1 ]; then
echo "$result" echo "$result"
docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts" docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts"
docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe"
exit 0
fi fi
if $*; then
echo "Incorrect option $*, please make sure you are entering the correct commands"
usage
exit 1
fi
exit 0 exit 0