From 5e84e477ac8f2b44d21024ff7f16ac082ded3904 Mon Sep 17 00:00:00 2001 From: vishalseshagiri Date: Mon, 24 Jul 2017 15:19:32 +0530 Subject: [PATCH] start-container became build-container, added new start-container and updated README.md --- README.md | 83 ++++++++++++++++++++++++++++++++++++---------- build-container.sh | 10 ++++++ start-container.sh | 10 +----- 3 files changed, 77 insertions(+), 26 deletions(-) create mode 100755 build-container.sh diff --git a/README.md b/README.md index ff3f43fe..33649da0 100644 --- a/README.md +++ b/README.md @@ -18,45 +18,94 @@ docker-compose ### Installing A step by step series of examples that tell you have to get a development env running +#### 1. Installation Pre-requisites -Installing Docker Community Edition +- Installing Docker Community Edition ``` -Follow the steps given in https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/ +Follow the steps given in https://docs.docker.com/engine/installation The Docker version used by us is Docker version 17.06.0-ce, build 02c1d87 ``` -Installing docker-compose +- Installing docker-compose ``` -Follow the steps given in https://docs.docker.com/compose/install/ +Follow the steps given in (Docker for Mac, Docker for Windows, and Docker Toolbox include Docker Compose) https://docs.docker.com/compose/install/ The docker-compose version used by us is docker-compose version 1.14.0, build c7bdf9e ``` -## Deployment +#### 2. Build the container and install bench + +* Make sure your logged in as root. Build the container and install bench inside the container as a **non root** user + source build-container.sh +Note: Please do not remove the bench directory the above commands will create + +#### Basic Usage +* Starting docker containers + docker-compose start + docker-compose stop + +* Accessing the frappe container via CLI + ./start-container.sh + +* Set the db host for bench(points bench to the mariadb container) + bench set-mariadb-host mariadb + +* Create a new bench + + The init command will create a bench directory with frappe framework + installed. It will be setup for periodic backups and auto updates once + a day. + + bench init frappe-bench && cd frappe-bench + +* Add a site + + Frappe apps are run by frappe sites and you will have to create at least one + site. The new-site command allows you to do that. + + bench new-site site1.local + +* Add apps + + The get-app command gets remote frappe apps from a remote git repository and installs them. Example: [erpnext](https://github.com/frappe/erpnext) + + bench get-app erpnext https://github.com/frappe/erpnext + +* Install apps + + To install an app on your new site, use the bench `install-app` command. + + bench --site site1.local install-app erpnext + +* Exiting the frappe container and stopping all the containers gracefully + exit + docker-compose stop + +* Removing docker containers + docker-compose rm + +* Removing dangling volumes + docker volume rm $(docker volume ls -f dangling=true -q) + +To login to Frappe / ERPNext, open your browser and go to `[your-external-ip]:8000`, probably `localhost:8000` + + The default username is "Administrator" and password is what you set when you created the new site. + +* -Steps to be followed to build and run the docker image are : -``` -1. Run the start-container script -2. After a few minutes the prompt will point to the App container with a root prefix to it (your current location is /home/frappe) -3. You will be inside /home/frappe/code folder -4. Make the bash_run_container.sh executable by chmod +x as in step 1 and run it with the command ./bash_run_container.sh -5. Run the bash_for_container.sh file with the command ./bash_for_container.sh -6. You will be prompted to enter the Mysql db password it is 123 -7. You will be prompted to choose and enter an administrator password please enter and remember it for future use -8. Once all the installation steps are complete you can access the Web based GUI by typing localhost:8000 on your browser. ## Built With * [Docker](https://www.docker.com/) ## Contributing -Feel free to contribute to this and make the container better +Feel free to contribute to this project and make the containers better ## Authors -* **Vishal Seshagiri** - *Initial work* - [FrappeBench](https://github.com/frappe/bench) +* **Vishal Seshagiri** See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project. diff --git a/build-container.sh b/build-container.sh new file mode 100755 index 00000000..8812299b --- /dev/null +++ b/build-container.sh @@ -0,0 +1,10 @@ +echo "Enter a password for your database " +read DB_PASS + +echo 'export DB_PASS='$DB_PASS >> ~/.bashrc +source ~/.bashrc + +docker-compose up -d +app_id=`docker ps | grep docker_frappe | awk {'print $1'}` + +docker exec -it $app_id bash -c './setup.sh; exec "${SHELL:-sh}"' diff --git a/start-container.sh b/start-container.sh index 2c600b05..aa890566 100755 --- a/start-container.sh +++ b/start-container.sh @@ -1,11 +1,3 @@ -echo "Enter a password for your database " -read DB_PASS - -echo 'export DB_PASS='$DB_PASS >> ~/.bashrc -source ~/.bashrc - -docker-compose up -d app_id=`docker ps | grep docker_frappe | awk {'print $1'}` -docker exec -it $app_id bash -c './setup.sh; exec "${SHELL:-sh}"' - +docker exec -it $app_id bash -c 'cd /home/frappe/frappe-bench && su frappe; exec "${SHELL:-sh}"'