Merge remote-tracking branch 'upstream/develop' into install_app

This commit is contained in:
chabad360
2020-03-06 06:21:07 +00:00
22 changed files with 423 additions and 76 deletions

153
README.md
View File

@@ -1,4 +1,4 @@
### Getting Started
## Getting Started
The templates in this repository will help deploy Frappe/ERPNext docker in a production environment.
@@ -8,31 +8,15 @@ This docker installation takes care of the following:
* Setting up all the system requirements: eg. MariaDB, Node, Redis.
* [OPTIONAL] Configuring networking for remote access and setting up LetsEncrypt
### Installation Process
For docker based development refer this [README](development/README.md)
#### Setting up Pre-requisites
## Deployment
### Setting up Pre-requisites
This repository requires Docker and Git to be setup on the instance to be used.
#### Setup Letsencrypt Nginx Proxy Companion
This is an optional first step. This step is only required if you want to have SSL setup on your docker instance.
This step also assumes that the DNS is preconfigured since it automatically handles setup and renewal of SSL certificates.
For more details, see: https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
To setup the proxy companion, run the following steps:
```sh
cd $HOME
git clone https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion.git
cd docker-compose-letsencrypt-nginx-proxy-companion
cp .env.sample .env
./start.sh
```
#### Setting up Frappe/ERPNext Docker
### Cloning the repository and preliminary steps
Clone this repository somewhere in your system:
@@ -43,7 +27,7 @@ cd frappe_docker
Copy the example docker environment file to `.env`:
```
```sh
cp installation/env-example installation/.env
```
@@ -53,9 +37,7 @@ Make a directory for sites:
mkdir installation/sites
```
#### Setup Environment Variables
Docker allows passing an environment file to aide in setting up containers, which is used by this repository to pass secret and variable data.
### Setup Environment Variables
To get started, copy the existing `env-example` file to `.env` inside the `installation` directory. By default, the file will contain the following variables:
@@ -68,13 +50,86 @@ To get started, copy the existing `env-example` file to `.env` inside the `insta
- In case of a separately managed database setup, set the value to the database's hostname/IP/domain.
- `SITES=site1.domain.com,site2.domain.com`
- List of sites that are part of the deployment "bench". Each site is separated by a comma(,).
- If LetsEncrypt is being setup, make sure that the DNS for all the site domains are pointing to the current instance.
- If LetsEncrypt is being setup, make sure that the DNS for all the site's domains are pointing to the current instance.
- `LETSENCRYPT_EMAIL=your.email@your.domain.com`
- Email for LetsEncrypt expiry notification. This is only required if you are setting up the nginx proxy companion.
- Email for LetsEncrypt expiry notification. This is only required if you are setting up LetsEncrypt.
### Local deployment
For trying out locally or to develop apps using ERPNext ReST API port 80 must be published.
First start the containers and then run an additional command to publish port of *-nginx container.
To start and publish Frappe/ERPNext services as local api, run the following commands:
For Erpnext:
```sh
# Start services
docker-compose \
--project-name <project-name> \
-f installation/docker-compose-common.yml \
-f installation/docker-compose-erpnext.yml \
--project-directory installation up -d
# Publish port
docker-compose \
--project-name <project-name> \
-f installation/docker-compose-common.yml \
-f installation/docker-compose-erpnext.yml \
--project-directory installation run --publish 80:80 -d erpnext-nginx
```
For Frappe:
```sh
# Start services
docker-compose \
--project-name <project-name> \
-f installation/docker-compose-common.yml \
-f installation/docker-compose-frappe.yml \
--project-directory installation up -d
# Publish port
docker-compose \
--project-name <project-name> \
-f installation/docker-compose-common.yml \
-f installation/docker-compose-frappe.yml \
--project-directory installation run --publish 80:80 -d frappe-nginx
```
Make sure to replace `<project-name>` with any desired name you wish to set for the project.
Note:
- This command adds an additional container for frappe-nginx with published ports.
- The local deployment is for testing and REST API development purpose only.
- The site names are limited to patterns matching \*.localhost by default
- Additional site name patterns can be added to /etc/hosts of desired container or host
### Deployment for production
#### Setup Letsencrypt Nginx Proxy Companion
Letsencrypt Nginx Proxy Companion can optionally be setup to provide SSL. This is recommended for instances accessed over the internet.
Your DNS will need to be configured correctly in order for Letsencrypt to verify your domain.
To setup the proxy companion, run the following commands:
```sh
cd $HOME
git clone https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion.git
cd docker-compose-letsencrypt-nginx-proxy-companion
cp .env.sample .env
./start.sh
```
For more details, see: https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
Letsencrypt Nginx Proxy Companion works by automatically proxying to containers with the `VIRTUAL_HOST` environmental variable.
#### Start Frappe/ERPNext Services
To start the Frappe/ERPNext services, run the following command:
To start the Frappe/ERPNext services for production, run the following command:
```sh
docker-compose \
@@ -86,8 +141,44 @@ docker-compose \
```
Make sure to replace `<project-name>` with any desired name you wish to set for the project.
Note: use `docker-compose-frappe.yml` in case you need only Frappe without ERPNext.
Note: use `docker-compose-frappe.yml` in case you need bench with just frappe installed.
### Docker containers
This repository contains the following docker-compose files each one containing the described images:
* docker-compose-common.yml
* redis-cache
* volume: redis-cache-vol
* redis-queue
* volume: redis-queue-vol
* redis-socketio
* volume: redis-socketio-vol
* mariadb: main database
* volume: mariadb-vol
* docker-compose-erpnext.yml
* erpnext-nginx: serves static assets and proxies web request to the appropriate container, allowing to offer all services on the same port.
* volume: assets
* erpnext-python: main application code
* frappe-socketio: enables realtime communication to the user interface through websockets
* frappe-worker-default: background runner
* frappe-worker-short: background runner for short-running jobs
* frappe-worker-long: background runner for long-running jobs
* frappe-schedule
* docker-compose-frappe.yml
* frappe-nginx: serves static assets and proxies web request to the appropriate container, allowing to offer all services on the same port.
* volume: assets
* erpnext-python: main application code
* frappe-socketio: enables realtime communication to the user interface through websockets
* frappe-worker-default: background runner
* frappe-worker-short: background runner for short-running jobs
* frappe-worker-long: background runner for long-running jobs
* frappe-schedule
* docker-compose-networks.yml: this yml define the network to communicate with *Letsencrypt Nginx Proxy Companion*.
### Site operations
#### Setup New Sites
@@ -218,7 +309,7 @@ To add your own apps to the image, we'll need to create a custom image with the
6. Install like usuall, except that when you set the `INSTALL_APPS` variable set it to `erpnext,[custom]`.
### Troubleshoot
## Troubleshoot
1. Remove containers and volumes, and clear redis cache: