From ff73540ada31f621a3c7313b57a91197c4563b38 Mon Sep 17 00:00:00 2001 From: maheshk2k <39314876+maheshk2k@users.noreply.github.com> Date: Sun, 3 May 2020 12:12:21 +0530 Subject: [PATCH 1/7] Update branch version while installing app Both bench init and get-app need to be on the same version branch. Mismatch results into errors while installing app --- development/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/development/README.md b/development/README.md index 9d421bf3..be8e7e04 100644 --- a/development/README.md +++ b/development/README.md @@ -117,16 +117,16 @@ bench --site mysite.localhost clear-cache To install an app we need to fetch it from the appropriate git repo, then install in on the appropriate site: You can check [VSCode container remote extension documentation](https://code.visualstudio.com/docs/remote/containers#_sharing-git-credentials-with-your-container) regarding git creedential sharing. - +Both frappe and erpnext must be on branch with same name. e.g. version-12 ```shell -bench get-app myapp https://github.com/myusername/myapp.git +bench get-app --branch version-12 myapp https://github.com/myusername/myapp.git bench --site mysite.localhost install-app myapp ``` For example, to install ERPNext (from the master branch): - +Both frappe and erpnext must be on branch with same name. e.g. version-12 ```shell -bench get-app erpnext https://github.com/frappe/erpnext.git +bench get-app --branch version-12 erpnext https://github.com/frappe/erpnext.git bench --site mysite.localhost install-app erpnext ``` From 28ea4671e8599be77ee7fc8f7ff0f886e481e580 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Sun, 3 May 2020 13:03:23 +0530 Subject: [PATCH 2/7] fix: development README info related to branches of apps [ci-skip] --- development/README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/development/README.md b/development/README.md index be8e7e04..44ec78f4 100644 --- a/development/README.md +++ b/development/README.md @@ -116,20 +116,24 @@ bench --site mysite.localhost clear-cache To install an app we need to fetch it from the appropriate git repo, then install in on the appropriate site: -You can check [VSCode container remote extension documentation](https://code.visualstudio.com/docs/remote/containers#_sharing-git-credentials-with-your-container) regarding git creedential sharing. -Both frappe and erpnext must be on branch with same name. e.g. version-12 +You can check [VSCode container remote extension documentation](https://code.visualstudio.com/docs/remote/containers#_sharing-git-credentials-with-your-container) regarding git credential sharing. + +To install custom app + ```shell +# --branch is optional, use it to point to branch on custom app repository bench get-app --branch version-12 myapp https://github.com/myusername/myapp.git bench --site mysite.localhost install-app myapp ``` -For example, to install ERPNext (from the master branch): -Both frappe and erpnext must be on branch with same name. e.g. version-12 +To install ERPNext (from the version-12 branch): + ```shell bench get-app --branch version-12 erpnext https://github.com/frappe/erpnext.git bench --site mysite.localhost install-app erpnext ``` +Note: Both frappe and erpnext must be on branch with same name. e.g. version-12 ### Start Frappe without debugging From 0d9d1dcf421c80242bf6ae7afb1e111ba360bb66 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 5 May 2020 13:12:25 +0530 Subject: [PATCH 3/7] [skip travis] Update README --- README.md | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index badb0721..8c93b580 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,16 @@ For docker based development refer to this [README](development/README.md) This repository requires Docker, docker-compose and Git to be setup on the instance to be used. +Always use non-root user. Add the user to `docker` group instead of using `sudo docker...` commands. + +Docker devop basics. + +- `docker ps`, check running containers. +- `docker logs `, check logs of given container. +- `docker run -it image/tag -v ./volume:/location/in/container --network existing_network` start a container with given image, run command, mount volume and use network. +- `docker exec -it -e "ENVIRONMENT_VARIABLE=VALUE" command`, execute command in existing container and use given environment variables. +- Other important docker commands to manage volumes, containers. Refer Docker documentation. + ### Cloning the repository and preliminary steps Clone this repository somewhere in your system: @@ -38,7 +48,7 @@ cp env-example .env ### 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: +To get started, copy the existing `env-example` file to `.env`. By default, the file will contain the following variables: - `VERSION=edge` - In this case, `edge` corresponds to `develop`. To setup any other version, you may use the branch name or version specific tags. (eg. version-12, v11.1.15, v11) @@ -53,12 +63,16 @@ To get started, copy the existing `env-example` file to `.env` inside the `insta - `LETSENCRYPT_EMAIL=your.email@your.domain.com` - Email for LetsEncrypt expiry notification. This is only required if you are setting up LetsEncrypt. +Notes: + +- docker-compose-erpnext.yml and docker-compose-frappe.yml set `AUTO_MIGRATE` environment variable to `1`. +- `AUTO_MIGRATE` checks if there is semver bump or git hash change in case of develop branch and automatically migrates the sites on container start up. +- It is good practice to tag version to specific version instead of latest. e.g `frappe-socketio:v12.5.1`, `erpnext-nginx:v12.7.1`. ### Local deployment for testing For trying out locally or to develop apps using ERPNext REST API port 80 must be published. -The first command will start the containers; the second command will publish the port of the *-nginx container. - +Following command will start the needed containers and expose ports. For Erpnext: From 33672e09e4ee44336549c43cbee40bbced8b79db Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 5 May 2020 13:18:36 +0530 Subject: [PATCH 4/7] [skip travis] Update README --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index 8c93b580..d35412e9 100644 --- a/README.md +++ b/README.md @@ -21,15 +21,7 @@ For docker based development refer to this [README](development/README.md) This repository requires Docker, docker-compose and Git to be setup on the instance to be used. -Always use non-root user. Add the user to `docker` group instead of using `sudo docker...` commands. - -Docker devop basics. - -- `docker ps`, check running containers. -- `docker logs `, check logs of given container. -- `docker run -it image/tag -v ./volume:/location/in/container --network existing_network` start a container with given image, run command, mount volume and use network. -- `docker exec -it -e "ENVIRONMENT_VARIABLE=VALUE" command`, execute command in existing container and use given environment variables. -- Other important docker commands to manage volumes, containers. Refer Docker documentation. +Docker basics and best practices. Refer Docker documentation. ### Cloning the repository and preliminary steps From 2fe9826f643d43028efefbb5a58f410f3ab13e95 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 5 May 2020 13:20:07 +0530 Subject: [PATCH 5/7] [skip travis] Update README fix sentence to avoid version/tag confusion --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d35412e9..91290450 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Notes: - docker-compose-erpnext.yml and docker-compose-frappe.yml set `AUTO_MIGRATE` environment variable to `1`. - `AUTO_MIGRATE` checks if there is semver bump or git hash change in case of develop branch and automatically migrates the sites on container start up. -- It is good practice to tag version to specific version instead of latest. e.g `frappe-socketio:v12.5.1`, `erpnext-nginx:v12.7.1`. +- It is good practice to use image tag for specific version instead of latest. e.g `frappe-socketio:v12.5.1`, `erpnext-nginx:v12.7.1`. ### Local deployment for testing From 52dbc49c21d3575a0d579394566b9c2827c7a384 Mon Sep 17 00:00:00 2001 From: paulator Date: Wed, 6 May 2020 11:11:55 +0200 Subject: [PATCH 6/7] Fix socketio error in reverse proxy setup --- build/common/nginx-default.conf.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/common/nginx-default.conf.template b/build/common/nginx-default.conf.template index 076b2c42..f6e375fb 100644 --- a/build/common/nginx-default.conf.template +++ b/build/common/nginx-default.conf.template @@ -30,7 +30,7 @@ server { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Frappe-Site-Name $host; - proxy_set_header Origin $scheme://$http_host; + proxy_set_header Origin $http_referer; proxy_set_header Host $http_host; proxy_pass http://socketio-server; From 9e1841f4949b46662d76e6bf9323dbbcb7223745 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Sat, 9 May 2020 00:30:15 +0530 Subject: [PATCH 7/7] fix: push site_config.json with backup --- build/common/commands/push_backup.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/common/commands/push_backup.py b/build/common/commands/push_backup.py index 8cf2b484..d1e3803c 100644 --- a/build/common/commands/push_backup.py +++ b/build/common/commands/push_backup.py @@ -176,6 +176,10 @@ def main(): folder = os.environ.get('BUCKET_DIR') + '/' + site + '/' + os.path.basename(db_file)[:15] + '/' upload_file_to_s3(db_file, folder, conn, bucket) + # Archive site_config.json + site_config_file = os.path.join(os.getcwd(), site, 'site_config.json') + upload_file_to_s3(site_config_file, folder, conn, bucket) + public_files = details.get('public_files', {}).get('file_path') if public_files: folder = os.environ.get('BUCKET_DIR') + '/' + site + '/' + os.path.basename(public_files)[:15] + '/'