mirror of
https://github.com/frappe/frappe_docker.git
synced 2024-12-23 10:38:58 +00:00
added init option
This commit is contained in:
parent
643dd4b4ce
commit
656386c44b
17
dbench
17
dbench
@ -7,10 +7,24 @@ display_usage() {
|
||||
echo ' -h show this help text'
|
||||
echo ' -c execute a command inside docker using docker exec'
|
||||
echo ' -s adds site-names to /etc/hosts file in the container to facilitate multisite access'
|
||||
echo ' init initializes frappe-bench adds a new-site bench-manager.local and installs the bench_manager app
|
||||
app onto it'
|
||||
}
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
docker exec -it frappe bash
|
||||
|
||||
elif [ $1 == 'init' ]
|
||||
then
|
||||
docker exec -i -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*"
|
||||
docker exec -it frappe bash -c "cd .. && bench init frappe-bench --skip-bench-mkdir --skip-redis-config-generation && cd frappe-bench"
|
||||
docker exec -it frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json"
|
||||
docker exec -it -u root frappe bash -c "apt-get install vim && apt-get install sudo && usermod -aG sudo frappe && printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe"
|
||||
docker exec -it frappe bash -c "bench set-mariadb-host mariadb"
|
||||
docker exec -it frappe bash -c "bench new-site bench-manager.local"
|
||||
docker exec -it frappe bash -c "bench get-app bench_manager https://github.com/frappe/bench_manager"
|
||||
docker exec -it frappe bash -c "bench --site bench-manager.local install-app bench_manager"
|
||||
|
||||
else
|
||||
while getopts ':hsc:' option; do
|
||||
case "$option" in
|
||||
@ -19,7 +33,7 @@ else
|
||||
exit
|
||||
;;
|
||||
c)
|
||||
docker exec frappe bash -c "bench $OPTARG"
|
||||
docker exec -it frappe bash -c "bench $OPTARG"
|
||||
;;
|
||||
s)
|
||||
a=$(cd frappe-bench && ls sites/*/site_config.json | grep -o '/.\+/')
|
||||
@ -28,6 +42,7 @@ else
|
||||
result="127.0.0.1 ${a}"
|
||||
echo $result
|
||||
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"
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
|
Loading…
Reference in New Issue
Block a user