diff --git a/README.md b/README.md index 914b63ad..809a660e 100644 --- a/README.md +++ b/README.md @@ -90,37 +90,33 @@ Express dependency between services, which has two effects: * Build the container and install bench inside the container. - 1.Build the 5 linked containers frappe, mariadb, redis-cache, redis-queue and redis-socketio using this command. Make sure your current working directory is frappe_docker which contains the docker-compose.yml and Dockerfile. - It creates a user, frappe inside the frappe container, whose working directory is /home/frappe. It also clones - the bench-repo from [here](https://github.com/frappe/bench) + 1.Build the 5 linked containers frappe, mariadb, redis-cache, redis-queue and redis-socketio using this command. - docker-compose up -d + ./dbench --setup -d - Note: Please do not remove the bench-repo directory the above commands will create + Make sure your current working directory is frappe_docker which contains the docker-compose.yml and Dockerfile. + It creates a user, frappe inside the frappe container, whose working directory is /home/frappe. It also clones the bench-repo from [here](https://github.com/frappe/bench) + Note: Please do not remove the bench-repo directory the above commands will create #### Basic Usage ##### Make sure your current directory is frappe_docker 1. First time setup - - ./dbench init + + ./dbench --init 2. Command to start all the containers - docker-compose start - -3. Command to be executed everytime after starting your containers - - ./dbench -s + ./dbench --start 4. Command to enter your container - docker exec -it frappe bash + ./dbench -5. All bench commands can also be directly run from the host machine by using dbench. For instance ```bench start``` can be executed by running ```./dbench -c start```. Just preface the option with ./dbench -c. For more information on dbench run the command ```./dbench -h```. +5. All bench commands can also be directly run from the host machine by using `dbench`. For instance `bench start` can be executed by running `./dbench -c start`. Just preface the option with `./dbench -c`. For more information on `dbench` run the command `./dbench -h`. -For more info on how to build this docker container refer to this [Wiki](https://github.com/frappe/frappe_docker/wiki/Hitchhiker's-guide-to-building-this-frappe_docker-image) +For more info on how to build this docker container refer to this [Wiki](https://github.com/chabad360/frappe_docker/wiki/Hitchhiker's-guide-to-building-this-frappe_docker-image) To login to Frappe / ERPNext, open your browser and go to `[your-external-ip]:8000`, probably `localhost:8000` diff --git a/dbench b/dbench index 43fc50b5..789b69b9 100644 --- a/dbench +++ b/dbench @@ -1,10 +1,11 @@ #!/bin/bash function usage { - echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start] [\"\"]" + echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start | -c \"\"]" echo '' echo 'where:' echo ' -h show this help text' + echo ' -c send a command to the frappe container' echo ' -d [sitename] enables developer mode for specified site' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' echo ' --setup [-d] builds docker containers, NOTE: assumes you have docker installed' @@ -30,8 +31,8 @@ function frappe_installer { } if [[ $# -eq 0 ]]; then - echo "$@" - docker exec -it frappe bash 'bench $@' + echo "entering container" + docker exec -it frappe bash elif [ $1 == '--init' ]; then site=$3 @@ -73,7 +74,7 @@ elif [ "$1" == '--start' ]; then docker exec -i frappe bash -c "bench start" else - while getopts ':had:' option; do + while getopts ':hadc:' option; do case "$option" in h) display_usage @@ -91,6 +92,9 @@ else d) docker exec -it -u root frappe bash -c "bench --site $OPTARG set-config \"developer_mode\" 1 && bench clear-cache" ;; + c) + docker exec -it -u root frappe bash -c "bench $OPTARG" + ;; \?) echo "Invalid option: -$OPTARG" >&2 usage diff --git a/test.py b/test.py index e29fa851..c127ad74 100644 --- a/test.py +++ b/test.py @@ -13,7 +13,7 @@ def print_out(val,delay): elif val == 2: try: global r - r = requests.get("http://site1.local:8000") + r = requests.get("http://localhost:8000") print(r) except requests.exceptions.ConnectionError as e: print(e)