2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2025-01-24 07:38:33 +00:00

Merge pull request #212 from frappe/develop

ERPNext v12.7.1 and Frappe v12.5.1
This commit is contained in:
Revant Nandgaonkar 2020-04-23 23:00:42 +05:30 committed by GitHub
commit c4608066ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 83 additions and 41 deletions

View File

@ -36,12 +36,6 @@ Copy the example docker environment file to `.env`:
cp installation/env-example installation/.env
```
Make a directory for sites:
```sh
mkdir installation/sites
```
### 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:
@ -152,6 +146,21 @@ Notes:
- Use `docker-compose-frappe.yml` in case you need only Frappe without ERPNext.
- New site (first site) needs to be added after starting the services.
#### Using Amazon RDS (or any other DBaaS)
To configure usage of RDS, `common_site_config.json` in your `sites-vol` volume has to be edited using:
```sh
docker run \
-it \
-v <project-name>_sites-vol:/sites \
alpine vi /sites/common_site_config.json
```
Instead of `alpine` you can use any image you like.
For full instructions, refer to the [wiki](https://github.com/frappe/frappe/wiki/Using-Frappe-with-Amazon-RDS-(or-any-other-DBaaS). Common question can be found in Issues and on forum.
### Docker containers
This repository contains the following docker-compose files, each one containing the described images:
@ -166,7 +175,7 @@ This repository contains the following docker-compose files, each one containing
* 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
* volume: assets-vol
* erpnext-python: main application code
* frappe-socketio: enables realtime communication to the user interface through websockets
* frappe-worker-default: background runner
@ -176,13 +185,19 @@ This repository contains the following docker-compose files, each one containing
* 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
* volume: assets-vol, sites-vol
* erpnext-python: main application code
* volume: sites-vol
* frappe-socketio: enables realtime communication to the user interface through websockets
* volume: sites-vol
* frappe-worker-default: background runner
* volume: sites-vol
* frappe-worker-short: background runner for short-running jobs
* volume: sites-vol
* frappe-worker-long: background runner for long-running jobs
* volume: sites-vol
* frappe-schedule
* volume: sites-vol
* docker-compose-networks.yml: this yaml define the network to communicate with *Letsencrypt Nginx Proxy Companion*.
@ -228,7 +243,7 @@ Environment Variables
- `WITH_FILES` if set to 1, it will backup user-uploaded files.
- By default `backup` takes mariadb dump and gzips it. Example file, `20200325_221230-test_localhost-database.sql.gz`
- If `WITH_FILES` is set then it will also backup public and private files of each site as uncompressed tarball. Example files, `20200325_221230-test_localhost-files.tar` and `20200325_221230-test_localhost-private-files.tar`
- All the files generated by backup are placed at volume location `sites/{site-name}/private/backups/*`
- All the files generated by backup are placed at volume location `sites-vol:/{site-name}/private/backups/*`
```sh
docker exec -it \
@ -237,7 +252,7 @@ docker exec -it \
<project-name>_erpnext-python_1 docker-entrypoint.sh backup
```
The backup will be available in the `sites` mounted volume.
The backup will be available in the `sites-vol` volume.
#### Push backup to s3 compatible storage
@ -257,7 +272,7 @@ Environment Variables
-e "SECRET_ACCESS_KEY=secret_access_from_provider" \
-e "ENDPOINT_URL=https://region.storage-provider.com" \
-e "BUCKET_DIR=frappe-bench-v12" \
-v ./installation/sites:/home/frappe/frappe-bench/sites \
-v <project-name>_sites-vol:/home/frappe/frappe-bench/sites \
--network <project-name>_default \
frappe/frappe-worker:v12 push-backup
```
@ -315,7 +330,7 @@ docker run \
-e "SECRET_ACCESS_KEY=secret_access_from_provider" \
-e "ENDPOINT_URL=https://region.storage-provider.com" \
-e "BUCKET_DIR=frappe-bench-v12" \
-v ./installation/sites:/home/frappe/frappe-bench/sites \
-v <project-name>_sites-vol:/home/frappe/frappe-bench/sites \
-v ./backups:/home/frappe/backups \
--network <project-name>_default \
frappe/frappe-worker:v12 restore-backup

View File

@ -6,13 +6,23 @@ RUN mkdir -p /home/frappe/frappe-bench/sites \
RUN install_packages git
RUN mkdir -p apps sites/assets \
RUN mkdir -p apps sites/assets/css \
&& cd apps \
&& git clone --depth 1 https://github.com/frappe/frappe
COPY build/frappe-nginx/generate_standard_style_css.js \
/home/frappe/frappe-bench/apps/frappe/generate_standard_style_css.js
RUN cd /home/frappe/frappe-bench/apps/frappe \
&& yarn \
&& yarn run production \
&& yarn add nunjucks -D \
&& node generate_standard_style_css.js \
frappe/website/doctype/website_theme/website_theme_template.scss > \
/home/frappe/standard_templates_string \
&& node generate_bootstrap_theme.js \
/home/frappe/frappe-bench/sites/assets/css/standard_style.css \
"$(cat /home/frappe/standard_templates_string)" \
&& rm -fr node_modules \
&& yarn install --production=true \
&& node --version \

View File

@ -40,8 +40,8 @@ envsubst '${API_HOST}
echo "Waiting for frappe-python to be available on $FRAPPE_PY port $FRAPPE_PY_PORT"
timeout 10 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' $FRAPPE_PY $FRAPPE_PY_PORT
echo "Frappe-python available on $FRAPPE_PY port $FRAPPE_PY_PORT"
echo "Waiting for frappe-socketio to be available on $FRAPPE_PY port $FRAPPE_PY_PORT"
echo "Waiting for frappe-socketio to be available on $FRAPPE_SOCKETIO port $SOCKETIO_PORT"
timeout 10 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' $FRAPPE_SOCKETIO $SOCKETIO_PORT
echo "Frappe-socketio available on $FRAPPE_PY port $FRAPPE_PY_PORT"
echo "Frappe-socketio available on $FRAPPE_SOCKETIO port $SOCKETIO_PORT"
exec "$@"

View File

@ -0,0 +1,14 @@
const nunjucks = require("nunjucks");
const templatePath = process.argv[2];
const pathArray = templatePath.split("/");
const templateFile = pathArray.pop();
const templateDir = pathArray.join("/");
nunjucks.configure(templateDir);
const rendered = nunjucks.render(templateFile, {
button_rounded_corners: true,
font_properties: "300,600",
});
console.log(rendered.replace(/\n/gm, "\\n"));

View File

@ -2,7 +2,7 @@
## Prerequisites
In order to start deveping you need to satisfy the folowing prerequisites:
In order to start developing you need to satisfy the following prerequisites:
- Docker
- docker-compose
@ -140,7 +140,7 @@ bench start
```
You can now login with user `Administrator` and the password you choose when creating the site.
Your website will now be accessible on [on port 8000](http://locahost:8000)
Your website will now be accessible at location [mysite.localhost:8000](http://mysite.localhost:8000)
Note: To start bench with debugger refer section for debugging.
### Start Frappe with Visual Studio Code Python Debugging

View File

@ -28,7 +28,7 @@ services:
- frappe-worker-long
- frappe-worker-short
volumes:
- ./sites:/var/www/html/sites:rw
- sites-vol:/var/www/html/sites:rw
- assets-vol:/assets:rw
[app]-python:
@ -44,7 +44,7 @@ services:
- REDIS_SOCKETIO=redis-socketio:6379
- SOCKETIO_PORT=9000
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
- assets-vol:/home/frappe/frappe-bench/sites/assets:rw
frappe-socketio:
@ -55,7 +55,7 @@ services:
links:
- redis-socketio
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
frappe-worker-default:
image: [app]-worker
@ -68,7 +68,7 @@ services:
- redis-queue
- redis-cache
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
frappe-worker-short:
image: [app]-worker
@ -83,7 +83,7 @@ services:
- redis-queue
- redis-cache
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
frappe-worker-long:
image: [app]-worker
@ -98,7 +98,7 @@ services:
- redis-queue
- redis-cache
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
frappe-schedule:
image: [app]-worker
@ -111,7 +111,8 @@ services:
- redis-queue
- redis-cache
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
volumes:
assets-vol:
sites-vol:

View File

@ -25,7 +25,7 @@ services:
- frappe-worker-long
- frappe-worker-short
volumes:
- ./sites:/var/www/html/sites:rw
- sites-vol:/var/www/html/sites:rw
- assets-vol:/assets:rw
erpnext-python:
@ -39,7 +39,7 @@ services:
- SOCKETIO_PORT=9000
- AUTO_MIGRATE=1
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
- assets-vol:/home/frappe/frappe-bench/sites/assets:rw
frappe-socketio:
@ -50,7 +50,7 @@ services:
links:
- redis-socketio
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
frappe-worker-default:
image: frappe/erpnext-worker:${VERSION}
@ -63,7 +63,7 @@ services:
- redis-queue
- redis-cache
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
frappe-worker-short:
image: frappe/erpnext-worker:${VERSION}
@ -78,7 +78,7 @@ services:
- redis-queue
- redis-cache
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
frappe-worker-long:
image: frappe/erpnext-worker:${VERSION}
@ -93,7 +93,7 @@ services:
- redis-queue
- redis-cache
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
frappe-schedule:
image: frappe/erpnext-worker:${VERSION}
@ -106,7 +106,8 @@ services:
- redis-queue
- redis-cache
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
volumes:
assets-vol:
sites-vol:

View File

@ -25,7 +25,7 @@ services:
- frappe-worker-long
- frappe-worker-short
volumes:
- ./sites:/var/www/html/sites:rw
- sites-vol:/var/www/html/sites:rw
- assets-vol:/assets:rw
frappe-python:
@ -39,7 +39,7 @@ services:
- SOCKETIO_PORT=9000
- AUTO_MIGRATE=1
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
- assets-vol:/home/frappe/frappe-bench/sites/assets:rw
frappe-socketio:
@ -50,7 +50,7 @@ services:
links:
- redis-socketio
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
frappe-worker-default:
image: frappe/frappe-worker:${VERSION}
@ -63,7 +63,7 @@ services:
- redis-queue
- redis-cache
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
frappe-worker-short:
image: frappe/frappe-worker:${VERSION}
@ -78,7 +78,7 @@ services:
- redis-queue
- redis-cache
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
frappe-worker-long:
image: frappe/frappe-worker:${VERSION}
@ -93,7 +93,7 @@ services:
- redis-queue
- redis-cache
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
frappe-schedule:
image: frappe/frappe-worker:${VERSION}
@ -106,7 +106,8 @@ services:
- redis-queue
- redis-cache
volumes:
- ./sites:/home/frappe/frappe-bench/sites:rw
- sites-vol:/home/frappe/frappe-bench/sites:rw
volumes:
assets-vol:
sites-vol: