2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-11-08 14:21:05 +00:00
Docker images for production and development setups of the Frappe framework and ERPNext
Go to file
2017-08-14 17:33:37 +05:30
conf/mariadb-conf.d Added .travis.yml for integration testing 2017-08-01 18:37:33 +05:30
frappe-bench Added bench init , start and python tests to curl the site 2017-08-02 16:46:50 +05:30
redis-conf Final docker setup 2017-07-31 15:51:51 +05:30
.travis.yml changes to test and travis.yml 2017-08-03 15:40:43 +05:30
dbench Final docker setup 2017-07-31 15:51:51 +05:30
docker-compose.yml added file-watcher-port and socketio-port + Readme changes 2017-08-14 17:16:10 +05:30
Dockerfile Changed the Procfile and site/common-site-config filenames 2017-08-01 17:05:42 +05:30
LICENSE Create LICENSE 2017-08-14 17:33:37 +05:30
LICENSE.md Create LICENSE.md 2017-07-18 15:18:45 +05:30
README.md Update README.md 2017-08-14 17:22:41 +05:30
test.py global r 2017-08-03 15:58:30 +05:30

frappe_docker

Build Status

  • Docker is an open source project to pack, ship and run any Linux application in a lighter weight, faster container than a traditional virtual machine.

  • Docker makes it much easier to deploy frappe on your servers.

  • This container uses bench to install frappe.

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

Docker

Docker Compose

Container Configuration

ports:

ports:
      - "3307:3307"   mariadb-port
      - "8000:8000"   webserver-port
      - "11000:11000" redis-cache
      - "12000:12000" redis-queue
      - "13000:13000" redis-socketio
      - "9000:9000"   socketio-port
      - "6787:6787"   file-watcher-port

Expose port 3307 inside the container on port 3307 on ALL local host interfaces. In order to bind to only one interface, you may specify the host's IP address as ([<host_interface>:[host_port]])|(<host_port>):<container_port>[/udp] as defined in the docker port binding documentation. The port 3307 of the mariadb container and port 8000 of the frappe container is exposed to the host machine and other containers.

volumes:

volumes:
     - ./frappe-bench:/home/frappe/frappe-bench
     - ./conf/mariadb-conf.d:/etc/mysql/conf.d
     - ./redis-conf/redis_socketio.conf:/etc/conf.d/redis.conf
     - ./redis-conf/redis_queue.conf:/etc/conf.d/redis.conf
     - ./redis-conf/redis_cache.conf:/etc/conf.d/redis.conf

Exposes a directory inside the host to the container.

links:
      - redis-cache
      - redis-queue
      - redis-socketio
      - mariadb

Links allow you to define extra aliases by which a service is reachable from another service.

depends_on:

depends_on:
      - mariadb
      - redis-cache
      - redis-queue
      - redis-socketio

Express dependency between services, which has two effects:

  1. docker-compose up will start services in dependency order. In the following example, mariadb and redis will be started before frappe.

  2. docker-compose up SERVICE will automatically include SERVICEs dependencies. In the following example, docker-compose up docker_frappe will also create and start mariadb and redis.

Installation

1. Installation Pre-requisites

  • Install Docker Community Edition

  • Install Docker Compose (only for Linux users). Docker for Mac, Docker for Windows, and Docker Toolbox include Docker Compose

2. Build the container and install bench

  • 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

      docker-compose up -d
    

    Note: Please do not remove the bench-repo directory the above commands will create

Basic Usage

  1. Starting docker containers

    This command can be used to start containers

     docker-compose start
    
  2. Accessing the frappe container via CLI

     docker exec -it frappe bash
    
  3. 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		
    
  4. Set the db host for bench (points bench to the mariadb container) since the 3 containers are linked

     bench set-mariadb-host mariadb
    
  5. Add a site (make sure your current path is /home/frappe/frappe-bench)

    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
    
  6. Add apps (make sure your current path is /home/frappe/frappe-bench)

    The get-app command gets remote frappe apps from a remote git repository and installs them. Example: erpnext

     bench get-app erpnext https://github.com/frappe/erpnext
    
  7. Install apps (make sure your current path is /home/frappe/frappe-bench)

    To install an app on your new site, use the bench install-app command.

     bench --site site1.local install-app erpnext
    
  8. Start bench (make sure your current path is /home/frappe/frappe-bench)

    To start using the bench, use the bench start command

     bench start
    
  9. Exiting the frappe container and stopping all the containers gracefully.

     exit
     docker-compose stop
    
  10. Removing docker containers

    docker-compose rm
    
  11. Removing dangling volumes

    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)
    

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.

Built With

Contributing

Feel free to contribute to this project and make the container better

License

This project is licensed under the MIT License - see the LICENSE.md file for details