frappe_docker/dbench
chabad360 d9dcc0dd01 Switch bench to dbench, added -s feature of dbench to bench. updated
Docker file with sudo and vim, and setup travis to run with said changes
2018-10-05 19:31:09 +00:00

34 lines
No EOL
1.3 KiB
Text
Executable file

#!/bin/bash
if [[ $# -eq 0 ]]; then
docker exec -it frappe bash
elif [ "$1" == 'init' ]; then
docker exec -it -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*"
docker exec -i frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation"
docker exec -i frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json && bench set-mariadb-host mariadb"
elif [ "$1" == 'setup' ]; then
if [ "$2" == 'docker' ]; then
if [ "$3" == '--swarm-mode' ]; then
echo "Docker swarm mode is not currently supported"
else
docker-compose up -d
fi
elif [ "$2" == 'hosts' ]; then
a=$(cd frappe-bench && ls sites/*/site_config.json | grep -o '/.\+/')
a="${a//$'\n'/ }"
a=$(echo $a | tr -d / )
result="127.0.0.1 ${a}"
sudo echo $result >> /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"
fi
elif [ "$1" == '-c' ]; then
shift
user=$1
shift
docker exec -i -u "$user" frappe bash -c "$@"
else
IFS=" "
docker exec -i frappe bash -c "bench $*"
fi