2017-07-20 07:21:33 +00:00
# frappe_docker
2017-07-18 09:26:31 +00:00
2017-07-18 08:57:28 +00:00
Containerizing the frappe bench installation for a development environment
2017-07-18 09:26:31 +00:00
## Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
### Prerequisites
What things you need to install the software and how to install them
```
Docker
docker-compose
```
### Installing
A step by step series of examples that tell you have to get a development env running
2017-07-24 09:49:32 +00:00
#### 1. Installation Pre-requisites
2017-07-18 09:26:31 +00:00
2017-07-24 09:49:32 +00:00
- Installing Docker Community Edition
2017-07-18 09:26:31 +00:00
2017-07-24 10:06:10 +00:00
Follow the steps given in [here ](https://docs.docker.com/engine/installation )
2017-07-24 10:04:28 +00:00
2017-07-24 11:11:51 +00:00
Docker version 17.06.0-ce, build 02c1d87
2017-07-18 09:26:31 +00:00
2017-07-24 10:12:55 +00:00
- Installing docker-compose(only for Linux users).Docker for Mac, Docker for Windows, and Docker Toolbox include Docker Compose
2017-07-18 09:26:31 +00:00
2017-07-24 10:11:59 +00:00
Follow the steps given in [here ](https://docs.docker.com/compose/install/ )
2017-07-24 10:04:28 +00:00
2017-07-24 11:11:51 +00:00
docker-compose version 1.14.0, build c7bdf9e
2017-07-18 09:26:31 +00:00
2017-07-24 09:49:32 +00:00
#### 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
2017-07-24 11:11:51 +00:00
This command requests the user to enter a password for the MySQL root user, please remember it for future use.
2017-07-24 11:22:21 +00:00
This command also builds the 3 linked containers docker-frappe, mariadb and redis using the docker-compose up -d,
it creates a user frappe inside the docker-frappe container, whose working directory is /home/frappe. It also clones
2017-07-24 11:11:51 +00:00
the bench-repo from [here ](https://github.com/frappe/bench )
2017-07-24 10:09:04 +00:00
source build-container.sh
2017-07-24 11:22:21 +00:00
Note: Please do not remove the bench-repo directory the above commands will create
2017-07-24 09:49:32 +00:00
#### Basic Usage
2017-07-24 11:11:51 +00:00
1. Starting docker containers
2017-07-24 10:00:18 +00:00
This command can be used to start containers
docker-compose start
2017-07-24 09:49:32 +00:00
2017-07-24 11:11:51 +00:00
2. Accessing the frappe container via CLI
2017-07-24 10:00:18 +00:00
2017-07-24 11:32:56 +00:00
./enter-container.sh
2017-07-24 10:41:20 +00:00
2017-07-24 11:11:51 +00:00
3. Create a new bench
2017-07-24 09:49:32 +00:00
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.
2017-07-24 10:41:20 +00:00
bench init frappe-bench & & cd frappe-bench
2017-07-24 11:11:51 +00:00
4. Set the db host for bench(points bench to the mariadb container)
2017-07-24 11:22:21 +00:00
Since the 3 containers are linked
2017-07-24 10:41:20 +00:00
bench set-mariadb-host mariadb
2017-07-24 09:49:32 +00:00
2017-07-24 11:11:51 +00:00
5. Add a site(make sure your current path is /home/frappe/frappe-bench)
2017-07-24 09:49:32 +00:00
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
2017-07-24 11:11:51 +00:00
6. Add apps(make sure your current path is /home/frappe/frappe-bench)
2017-07-24 09:49:32 +00:00
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
2017-07-24 11:11:51 +00:00
7. Install apps(make sure your current path is /home/frappe/frappe-bench)
2017-07-24 09:49:32 +00:00
To install an app on your new site, use the bench `install-app` command.
bench --site site1.local install-app erpnext
2017-07-24 11:11:51 +00:00
8. Start bench(make sure your current path is /home/frappe/frappe-bench)
2017-07-24 10:47:10 +00:00
To start using the bench, use the `bench start` command
bench start
2017-07-24 11:11:51 +00:00
9. Exiting the frappe container and stopping all the containers gracefully
2017-07-24 10:00:18 +00:00
2017-07-24 10:47:10 +00:00
exit
2017-07-24 10:00:18 +00:00
docker-compose stop
2017-07-24 09:49:32 +00:00
2017-07-24 11:11:51 +00:00
10. Removing docker containers
2017-07-24 10:00:18 +00:00
docker-compose rm
2017-07-24 09:49:32 +00:00
2017-07-24 11:11:51 +00:00
11. Removing dangling volumes
2017-07-24 10:00:18 +00:00
The volume frappe on your local machine is shared by the host(your local machine) and the frappe container.
Please do not delete this volume from your local machine. Any changes made in this directory will reflect on both
the container and the host. The below command specifies how to remain dangling volumes which may be taking up
unecessary space on your host.
docker volume rm $(docker volume ls -f dangling=true -q)
2017-07-24 09:49:32 +00:00
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.
2017-07-18 09:26:31 +00:00
## Built With
* [Docker ](https://www.docker.com/ )
## Contributing
2017-07-24 09:49:32 +00:00
Feel free to contribute to this project and make the containers better
2017-07-18 09:26:31 +00:00
## Authors
2017-07-24 09:49:32 +00:00
* **Vishal Seshagiri**
2017-07-18 09:26:31 +00:00
See also the list of [contributors ](https://github.com/your/project/contributors ) who participated in this project.
## License
This project is licensed under the MIT License - see the [LICENSE.md ](LICENSE.md ) file for details
## Acknowledgments
2017-07-20 07:21:33 +00:00
* Hat tip to anyone who's code was used - [Pratik Vyas ](https://github.com/pdvyas )
2017-07-18 09:26:31 +00:00
* Inspiration - [Rushabh Mehta ](https://github.com/rmehta )