From 3a497e1e0d79866a873097b95cd23e7adf431fc4 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 09:50:25 -0700 Subject: [PATCH 001/108] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6c78c5e5..8232ea24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ install: - docker-compose build - docker-compose up -d - docker exec -it -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" - - docker exec -i frappe bash -c "cd .. && bench init frappe-bench --skip-bench-mkdir --skip-redis-config-generation && cd frappe-bench" + - docker exec -i frappe bash -c "cd .. && bench init frappe-bench --skip-redis-config-generation && cd frappe-bench" - docker exec -i frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" - docker exec -i frappe bash -c "bench new-site site1.local" - docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts" From 060c86f52b506b80d3646a21f82903f589bb0795 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 09:55:50 -0700 Subject: [PATCH 002/108] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6308622c..914b63ad 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # frappe_docker -[![Build Status](https://travis-ci.org/frappe/frappe_docker.svg?branch=master)](https://travis-ci.org/frappe/frappe_docker) +[![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=master)](https://travis-ci.org/frappe/frappe_docker) - [Docker](https://docker.com/) is an open source project to pack, ship and run any Linux application in a lighter weight, faster container than a traditional virtual machine. From 95426877e0a24c9619a00dcf659940e9c7163ccf Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 09:57:08 -0700 Subject: [PATCH 003/108] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8232ea24..8636bc6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ install: - docker-compose build - docker-compose up -d - docker exec -it -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" - - docker exec -i frappe bash -c "cd .. && bench init frappe-bench --skip-redis-config-generation && cd frappe-bench" + - docker exec -i frappe bash -c "cd .. && cd frappe-bench" - docker exec -i frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" - docker exec -i frappe bash -c "bench new-site site1.local" - docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts" From 4c4ad963c9ee4d581961d8b9425c6b34370d7542 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 10:20:02 -0700 Subject: [PATCH 004/108] Update Dockerfile --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7f5b9a14..cc6a5c51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,11 +33,13 @@ USER frappe WORKDIR /home/frappe RUN git clone -b master https://github.com/frappe/bench.git bench-repo -USER root + RUN pip install -e bench-repo + +USER root RUN apt-get install -y libmysqlclient-dev mariadb-client mariadb-common RUN npm install -g yarn -RUN chown -R frappe:frappe /home/frappe/* USER frappe + WORKDIR /home/frappe/frappe-bench From 32451fc1f44e5321122921e042ce92fcf4028076 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 10:40:55 -0700 Subject: [PATCH 005/108] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cc6a5c51..085420d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,7 +34,7 @@ WORKDIR /home/frappe RUN git clone -b master https://github.com/frappe/bench.git bench-repo -RUN pip install -e bench-repo +RUN pip install --user -e bench-repo USER root RUN apt-get install -y libmysqlclient-dev mariadb-client mariadb-common From 9b09d614330d30c1478cd5f1148fc1be08e9e3ef Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 10:45:11 -0700 Subject: [PATCH 006/108] Update .travis.yml --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8636bc6e..3a2e2f9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,9 @@ services: install: - docker-compose build - docker-compose up -d - - docker exec -it -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" - - docker exec -i frappe bash -c "cd .. && cd frappe-bench" + + + - docker exec -i frappe bash -c "bench init frappe-bench && cd frappe-bench" - docker exec -i frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" - docker exec -i frappe bash -c "bench new-site site1.local" - docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts" From c8fcbe0fdb4a5507450445c85445332e41d7a18b Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 11:23:14 -0700 Subject: [PATCH 007/108] Update Dockerfile --- Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 085420d3..ea1c6476 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,8 +32,6 @@ RUN apt-get install -y wkhtmltopdf USER frappe WORKDIR /home/frappe RUN git clone -b master https://github.com/frappe/bench.git bench-repo - - RUN pip install --user -e bench-repo USER root @@ -41,5 +39,5 @@ RUN apt-get install -y libmysqlclient-dev mariadb-client mariadb-common RUN npm install -g yarn USER frappe - -WORKDIR /home/frappe/frappe-bench +ENV PATH /home/frappe/.local/bin:$PATH +WORKDIR /home/frappe/ From 922832c92c9d6b2255eb429817e1c3f4b7a8652f Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 11:33:12 -0700 Subject: [PATCH 008/108] Update .travis.yml --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3a2e2f9c..dae20c80 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ language: python + python: - "2.7" + env: - DOCKER_COMPOSE_VERSION: 1.8.0 @@ -12,7 +14,7 @@ install: - docker-compose up -d - - docker exec -i frappe bash -c "bench init frappe-bench && cd frappe-bench" + - docker exec -i frappe bash -c "cd frappe-bench" - docker exec -i frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" - docker exec -i frappe bash -c "bench new-site site1.local" - docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts" From 1113efd652f2c590035129c2f4702135b69e93be Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 11:39:05 -0700 Subject: [PATCH 009/108] Update Dockerfile --- Dockerfile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index ea1c6476..9627063d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ FROM ubuntu:16.04 MAINTAINER frappé USER root +RUN useradd -ms /bin/bash frappe RUN apt-get update RUN apt-get install -y iputils-ping RUN apt-get install -y git build-essential python-setuptools python-dev libffi-dev libssl-dev @@ -13,7 +14,6 @@ RUN apt-get install -y libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev lib RUN apt-get install -y wget RUN wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py RUN pip install --upgrade setuptools pip -RUN useradd -ms /bin/bash frappe RUN apt-get install -y curl RUN apt-get install -y rlwrap RUN apt-get install redis-tools @@ -28,16 +28,12 @@ RUN curl https://deb.nodesource.com/node_6.x/pool/main/n/nodejs/nodejs_6.7.0-1no && dpkg -i node.deb \ && rm node.deb RUN apt-get install -y wkhtmltopdf - -USER frappe -WORKDIR /home/frappe -RUN git clone -b master https://github.com/frappe/bench.git bench-repo -RUN pip install --user -e bench-repo - -USER root RUN apt-get install -y libmysqlclient-dev mariadb-client mariadb-common RUN npm install -g yarn USER frappe +WORKDIR /home/frappe/ +RUN git clone https://github.com/frappe/bench.git bench-repo +RUN pip install --user -e bench-repo ENV PATH /home/frappe/.local/bin:$PATH WORKDIR /home/frappe/ From 4841bd1fdd078abf2767aa22f18030bc14853e40 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 12:25:21 -0700 Subject: [PATCH 010/108] fixed frappe isues --- {frappe-bench => frappe-site}/Procfile_docker | 0 .../sites/common_site_config_docker.json | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {frappe-bench => frappe-site}/Procfile_docker (100%) rename {frappe-bench => frappe-site}/sites/common_site_config_docker.json (100%) diff --git a/frappe-bench/Procfile_docker b/frappe-site/Procfile_docker similarity index 100% rename from frappe-bench/Procfile_docker rename to frappe-site/Procfile_docker diff --git a/frappe-bench/sites/common_site_config_docker.json b/frappe-site/sites/common_site_config_docker.json similarity index 100% rename from frappe-bench/sites/common_site_config_docker.json rename to frappe-site/sites/common_site_config_docker.json From e41b4abce3d080655f8fe79cdd51b3d3a874917b Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 12:28:33 -0700 Subject: [PATCH 011/108] fixed proc_file issues --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dae20c80..838db9ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,8 +14,9 @@ install: - docker-compose up -d + - docker exec -i frappe bash -c "bench new-site frappe-bench" + - docker exec -i frappe bash -c "mv frappe-site/Procfile_docker frappe-bench/Procfile && mv frappe-site/sites/common_site_config_docker.json frappe-bench/sites/common_site_config.json" - docker exec -i frappe bash -c "cd frappe-bench" - - docker exec -i frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" - docker exec -i frappe bash -c "bench new-site site1.local" - docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts" - sudo su -c 'echo 127.0.0.1 site1.local >> /etc/hosts' From f2034f874e78483994834d2eef51b85b20f3a02e Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 12:34:02 -0700 Subject: [PATCH 012/108] oops --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 838db9ab..f75c5433 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ install: - docker-compose up -d - - docker exec -i frappe bash -c "bench new-site frappe-bench" + - docker exec -i frappe bash -c "bench init frappe-bench" - docker exec -i frappe bash -c "mv frappe-site/Procfile_docker frappe-bench/Procfile && mv frappe-site/sites/common_site_config_docker.json frappe-bench/sites/common_site_config.json" - docker exec -i frappe bash -c "cd frappe-bench" - docker exec -i frappe bash -c "bench new-site site1.local" From bf849a0d486b06c5672bc3c8be8dc0ee6849f025 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 12:40:44 -0700 Subject: [PATCH 013/108] added a debug --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f75c5433..2558893a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,7 @@ services: install: - docker-compose build - docker-compose up -d - - + - docker exec -i frappe bash -c "ls" - docker exec -i frappe bash -c "bench init frappe-bench" - docker exec -i frappe bash -c "mv frappe-site/Procfile_docker frappe-bench/Procfile && mv frappe-site/sites/common_site_config_docker.json frappe-bench/sites/common_site_config.json" - docker exec -i frappe bash -c "cd frappe-bench" From ddede9b5a40d270f007cec49edc6e5f8bef80ad0 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 12:48:21 -0700 Subject: [PATCH 014/108] revert --- .travis.yml | 2 +- Dockerfile | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6c78c5e5..bf15e5f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ install: - docker-compose build - docker-compose up -d - docker exec -it -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" - - docker exec -i frappe bash -c "cd .. && bench init frappe-bench --skip-bench-mkdir --skip-redis-config-generation && cd frappe-bench" + - docker exec -i frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" - docker exec -i frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" - docker exec -i frappe bash -c "bench new-site site1.local" - docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts" diff --git a/Dockerfile b/Dockerfile index 7f5b9a14..4bdf8885 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ - + #bench Dockerfile FROM ubuntu:16.04 @@ -38,6 +38,7 @@ RUN pip install -e bench-repo RUN apt-get install -y libmysqlclient-dev mariadb-client mariadb-common RUN npm install -g yarn RUN chown -R frappe:frappe /home/frappe/* +ENV PATH /home/frappe/.local/bin USER frappe WORKDIR /home/frappe/frappe-bench From 806eb9214b6b846adbd77981ba47b6c06b382001 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 12:59:49 -0700 Subject: [PATCH 015/108] back up --- {frappe-site => frappe-bench}/Procfile_docker | 0 .../sites/common_site_config_docker.json | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {frappe-site => frappe-bench}/Procfile_docker (100%) rename {frappe-site => frappe-bench}/sites/common_site_config_docker.json (100%) diff --git a/frappe-site/Procfile_docker b/frappe-bench/Procfile_docker similarity index 100% rename from frappe-site/Procfile_docker rename to frappe-bench/Procfile_docker diff --git a/frappe-site/sites/common_site_config_docker.json b/frappe-bench/sites/common_site_config_docker.json similarity index 100% rename from frappe-site/sites/common_site_config_docker.json rename to frappe-bench/sites/common_site_config_docker.json From ec4cd3e76209dc1047faf208bf07e7ea90bf37bc Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 13:05:45 -0700 Subject: [PATCH 016/108] better work --- Dockerfile | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index a212e88e..a460a7d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,6 @@ FROM ubuntu:16.04 MAINTAINER frappé USER root -RUN useradd -ms /bin/bash frappe RUN apt-get update RUN apt-get install -y iputils-ping RUN apt-get install -y git build-essential python-setuptools python-dev libffi-dev libssl-dev @@ -14,6 +13,7 @@ RUN apt-get install -y libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev lib RUN apt-get install -y wget RUN wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py RUN pip install --upgrade setuptools pip +RUN useradd -ms /bin/bash frappe RUN apt-get install -y curl RUN apt-get install -y rlwrap RUN apt-get install redis-tools @@ -28,15 +28,17 @@ RUN curl https://deb.nodesource.com/node_6.x/pool/main/n/nodejs/nodejs_6.7.0-1no && dpkg -i node.deb \ && rm node.deb RUN apt-get install -y wkhtmltopdf -RUN apt-get install -y libmysqlclient-dev mariadb-client mariadb-common -RUN npm install -g yarn -RUN chown -R frappe:frappe /home/frappe/* -ENV PATH /home/frappe/.local/bin - USER frappe -WORKDIR /home/frappe/ -RUN git clone https://github.com/frappe/bench.git bench-repo -RUN pip install --user -e bench-repo -ENV PATH /home/frappe/.local/bin:$PATH -WORKDIR /home/frappe/ +WORKDIR /home/frappe +RUN git clone -b master https://github.com/frappe/bench.git bench-repo + +USER root +RUN pip install -e bench-repo +RUN apt-get install -y libmysqlclient-dev mariadb-client mariadb-common +RUN npm install -g yarn +RUN chown -R frappe:frappe /home/frappe +ENV PATH /home/frappe/.local/bin + +USER frappe +WORKDIR /home/frappe/frappe-bench From 7ba473ea0bdfe148c60e1f000829d832c8b8544b Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 13:16:12 -0700 Subject: [PATCH 017/108] fixed path isssue --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a460a7d0..cf31db7b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,7 @@ RUN pip install -e bench-repo RUN apt-get install -y libmysqlclient-dev mariadb-client mariadb-common RUN npm install -g yarn RUN chown -R frappe:frappe /home/frappe -ENV PATH /home/frappe/.local/bin +ENV PATH /home/frappe/.local/bin:$PATH USER frappe WORKDIR /home/frappe/frappe-bench From f609009c65d8d71a3a3d6fbc938cdd32035da381 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 13:39:08 -0700 Subject: [PATCH 018/108] fix suggested by frappe/frappe_docker/issues/40 --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index a8beba0b..d9dfe1f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '2' services: mariadb: - image: "mariadb" + image: "mariadb:10.2" environment: - MYSQL_ROOT_PASSWORD=123 - MYSQL_USER=root From fab5c8395259c6fde21880823641f5dda9befb54 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 13:52:24 -0700 Subject: [PATCH 019/108] fixed InnoDB compatibility issues --- conf/mariadb-conf.d/my.cnf | 6 +++--- docker-compose.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/mariadb-conf.d/my.cnf b/conf/mariadb-conf.d/my.cnf index 9cc98d88..9b831abd 100644 --- a/conf/mariadb-conf.d/my.cnf +++ b/conf/mariadb-conf.d/my.cnf @@ -21,9 +21,9 @@ bind-address = 0.0.0.0 [mysqld] -innodb-file-format=barracuda -innodb-file-per-table=1 -innodb-large-prefix=1 +#innodb-file-format=barracuda +#innodb-file-per-table=1 +#innodb-large-prefix=1 character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci diff --git a/docker-compose.yml b/docker-compose.yml index d9dfe1f7..aa88f4d7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '2' services: mariadb: - image: "mariadb:10.2" + image: "mariadb:latest" environment: - MYSQL_ROOT_PASSWORD=123 - MYSQL_USER=root From 5555b588e6cfe844941e9de2a9bbd61b72e0e150 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 14:06:26 -0700 Subject: [PATCH 020/108] moving travis to dbench and fixing some dbench issues --- .travis.yml | 7 +------ dbench | 3 ++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 72c39650..f4ea2754 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,12 +12,7 @@ services: install: - docker-compose build - docker-compose up -d - - docker exec -it -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" - - docker exec -i frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" - - docker exec -i frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" - - docker exec -i frappe bash -c "bench new-site site1.local" - - docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts" - - sudo su -c 'echo 127.0.0.1 site1.local >> /etc/hosts' + - ./dbench - pip install --upgrade virtualenv - virtualenv -p python3 testenv - source testenv/bin/activate diff --git a/dbench b/dbench index 8731cf97..1fc0560d 100755 --- a/dbench +++ b/dbench @@ -20,8 +20,9 @@ then docker exec -it frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" docker exec -it frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" docker exec -it -u root frappe bash -c "apt-get install vim && apt-get install sudo && usermod -aG sudo frappe && printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" - docker exec -it frappe bash -c "bench set-mariadb-host mariadb" docker exec -it frappe bash -c "bench new-site site1.local" + docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts" + sudo su -c 'echo 127.0.0.1 site1.local >> /etc/hosts' docker exec -it frappe bash -c "bench get-app erpnext" docker exec -it frappe bash -c "bench --site site1.local install-app erpnext" From ec0c29604f2181c8fb99951a26fc41a3023685b8 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 14:26:47 -0700 Subject: [PATCH 021/108] added some echos to dbench --- dbench | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/dbench b/dbench index 1fc0560d..5789ee3f 100755 --- a/dbench +++ b/dbench @@ -1,30 +1,44 @@ #!/bin/bash -display_usage() { +display_usage () { echo "$(basename "$0") [-h] [-c \"\"]" echo '' echo 'where:' echo ' -h show this help text' echo ' -c execute a command inside docker using docker exec' echo ' -s adds site-names to /etc/hosts file in the container to facilitate multisite access' - echo ' init initializes frappe-bench adds a new-site bench-manager.local and installs the bench_manager app - app onto it' + echo ' init initializes frappe-bench' + echo ' init -e initializes frappe-bench and installs erpnext' +} + +frappe_installer () { + echo "starting frappe_docker setup" + docker exec -i -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" + docker exec -it frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" + docker exec -it frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" + echo "frappe-bench folder setup" + docker exec -it -u root frappe bash -c "apt-get install vim && apt-get install sudo && usermod -aG sudo frappe && printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" + echo "adding site1.local" + docker exec -it frappe bash -c "bench new-site site1.local" + docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts" + sudo su -c 'echo 127.0.0.1 site1.local >> /etc/hosts' + echo "site1.local added" } if [[ $# -eq 0 ]]; then docker exec -it frappe bash -elif [ $1 == 'init' ] +elif [ $1 == 'init' && $2 == 'e'] then - docker exec -i -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" - docker exec -it frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" - docker exec -it frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" - docker exec -it -u root frappe bash -c "apt-get install vim && apt-get install sudo && usermod -aG sudo frappe && printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" - docker exec -it frappe bash -c "bench new-site site1.local" - docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts" - sudo su -c 'echo 127.0.0.1 site1.local >> /etc/hosts' - docker exec -it frappe bash -c "bench get-app erpnext" - docker exec -it frappe bash -c "bench --site site1.local install-app erpnext" + frappe_installer + echo "installing erpnext" + docker exec -it frappe bash -c "bench get-app erpnext" | echo + docker exec -it frappe bash -c "bench --site site1.local install-app erpnext" | echo + echo "finished" + +elif [$1 == 'init'] +then + frappe_installer else while getopts ':hsc:' option; do From 8636d6fb68d73c12621b41be4024de414184f34d Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 14:33:41 -0700 Subject: [PATCH 022/108] fix travis crash --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f4ea2754..50921410 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ services: install: - docker-compose build - docker-compose up -d - - ./dbench + - ./dbench init - pip install --upgrade virtualenv - virtualenv -p python3 testenv - source testenv/bin/activate From 0c23680bdc8516e6ea271aef46f253e2cc3fcca8 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 14:46:21 -0700 Subject: [PATCH 023/108] bug fix --- dbench | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbench b/dbench index 5789ee3f..bcb87e5f 100755 --- a/dbench +++ b/dbench @@ -28,7 +28,7 @@ frappe_installer () { if [[ $# -eq 0 ]]; then docker exec -it frappe bash -elif [ $1 == 'init' && $2 == 'e'] +elif [ $1 == 'init' && $2 == 'e' ] then frappe_installer echo "installing erpnext" @@ -36,7 +36,7 @@ then docker exec -it frappe bash -c "bench --site site1.local install-app erpnext" | echo echo "finished" -elif [$1 == 'init'] +elif [ $1 == 'init' ] then frappe_installer From a66099dda00dafd9047ba2494145f0bc3cabf23a Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 14:51:58 -0700 Subject: [PATCH 024/108] propber bug fix, what happens when you dont have a dev env --- dbench | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbench b/dbench index bcb87e5f..899db413 100755 --- a/dbench +++ b/dbench @@ -28,7 +28,7 @@ frappe_installer () { if [[ $# -eq 0 ]]; then docker exec -it frappe bash -elif [ $1 == 'init' && $2 == 'e' ] +elif [ $1 == 'init' ] && [ $2 == 'e' ] then frappe_installer echo "installing erpnext" From 82c839b14ab960de02fd4c54ef97ba34a4c961cf Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 15:00:18 -0700 Subject: [PATCH 025/108] more bugfix --- dbench | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dbench b/dbench index 899db413..b8ec8346 100755 --- a/dbench +++ b/dbench @@ -28,12 +28,12 @@ frappe_installer () { if [[ $# -eq 0 ]]; then docker exec -it frappe bash -elif [ $1 == 'init' ] && [ $2 == 'e' ] +elif [[ $1 == 'init' && $2 == 'e' ]] then frappe_installer echo "installing erpnext" - docker exec -it frappe bash -c "bench get-app erpnext" | echo - docker exec -it frappe bash -c "bench --site site1.local install-app erpnext" | echo + docker exec -it frappe bash -c "bench get-app erpnext" + docker exec -it frappe bash -c "bench --site site1.local install-app erpnext" echo "finished" elif [ $1 == 'init' ] From 567307ab629e1f7fe2b81d70ffb45a9232be48be Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 15:01:02 -0700 Subject: [PATCH 026/108] install fixing --- dbench | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbench b/dbench index b8ec8346..2933cc18 100755 --- a/dbench +++ b/dbench @@ -17,7 +17,7 @@ frappe_installer () { docker exec -it frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" docker exec -it frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" echo "frappe-bench folder setup" - docker exec -it -u root frappe bash -c "apt-get install vim && apt-get install sudo && usermod -aG sudo frappe && printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" + docker exec -it -u root frappe bash -c "apt-get install vim -y && apt-get install sudo -y && usermod -aG sudo frappe && printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" echo "adding site1.local" docker exec -it frappe bash -c "bench new-site site1.local" docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts" From 2df1b1826c3d455bd83e6aa7433d70011aeca850 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 15:37:17 -0700 Subject: [PATCH 027/108] atempting cache --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index 50921410..4b5add2f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +sudo: required + language: python python: @@ -10,7 +12,9 @@ services: - docker install: + - if [[ -e ~/docker/image.tar ]]; then docker load -i ~/docker/image.tar; fi - docker-compose build + - mkdir -p ~/docker; docker save frappe > ~/docker/image.tar - docker-compose up -d - ./dbench init - pip install --upgrade virtualenv @@ -26,3 +30,8 @@ script: - docker-compose ps | grep -i mariadb - python test.py - docker-compose stop + + +cache: + directories: + - ~/docker \ No newline at end of file From 7a33d59e7396b8222b02277dfc1ca86ce6762b0a Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 15:42:55 -0700 Subject: [PATCH 028/108] cache fix --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4b5add2f..323370ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ services: install: - if [[ -e ~/docker/image.tar ]]; then docker load -i ~/docker/image.tar; fi - docker-compose build - - mkdir -p ~/docker; docker save frappe > ~/docker/image.tar + - mkdir -p ~/docker; docker save frappedocker_frappe > ~/docker/image.tar - docker-compose up -d - ./dbench init - pip install --upgrade virtualenv From e421a9a23cf5aa5c2948cb47d1eddcde00a4381d Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 15:51:14 -0700 Subject: [PATCH 029/108] added devmode beta --- .travis.yml | 2 +- dbench | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 323370ea..b2c01dfd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: - docker-compose build - mkdir -p ~/docker; docker save frappedocker_frappe > ~/docker/image.tar - docker-compose up -d - - ./dbench init + - ./dbench init -d - pip install --upgrade virtualenv - virtualenv -p python3 testenv - source testenv/bin/activate diff --git a/dbench b/dbench index 2933cc18..2d5622dd 100755 --- a/dbench +++ b/dbench @@ -9,6 +9,7 @@ display_usage () { echo ' -s adds site-names to /etc/hosts file in the container to facilitate multisite access' echo ' init initializes frappe-bench' echo ' init -e initializes frappe-bench and installs erpnext' + echo ' init -d initializes frappe-bench and enables developer mode' } frappe_installer () { @@ -36,6 +37,11 @@ then docker exec -it frappe bash -c "bench --site site1.local install-app erpnext" echo "finished" +elif [[ $1 == 'init' && $2 == 'd' ]] +then + frappe_installer + cat frappe-bench/sites/site1/site_config.json + elif [ $1 == 'init' ] then frappe_installer From 3546d01053fd4528b43d1975f6935d31c7fb11ec Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 16:04:33 -0700 Subject: [PATCH 030/108] fixing dbench and removing cache, its not worth it --- .travis.yml | 9 +-------- dbench | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index b2c01dfd..7b1caf81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,9 +12,7 @@ services: - docker install: - - if [[ -e ~/docker/image.tar ]]; then docker load -i ~/docker/image.tar; fi - docker-compose build - - mkdir -p ~/docker; docker save frappedocker_frappe > ~/docker/image.tar - docker-compose up -d - ./dbench init -d - pip install --upgrade virtualenv @@ -29,9 +27,4 @@ script: - docker-compose ps | grep -i redis-socketio - docker-compose ps | grep -i mariadb - python test.py - - docker-compose stop - - -cache: - directories: - - ~/docker \ No newline at end of file + - docker-compose stop \ No newline at end of file diff --git a/dbench b/dbench index 2d5622dd..19d3c163 100755 --- a/dbench +++ b/dbench @@ -40,7 +40,7 @@ then elif [[ $1 == 'init' && $2 == 'd' ]] then frappe_installer - cat frappe-bench/sites/site1/site_config.json + docker exec -it frappe bash -c "cat frappe-bench/sites/site1/site_config.json" elif [ $1 == 'init' ] then From 8992678e7f7d5029e7afe635341957f48d7e2312 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 16:16:35 -0700 Subject: [PATCH 031/108] fixed dbench --- dbench | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dbench b/dbench index 19d3c163..31132fc6 100755 --- a/dbench +++ b/dbench @@ -29,7 +29,7 @@ frappe_installer () { if [[ $# -eq 0 ]]; then docker exec -it frappe bash -elif [[ $1 == 'init' && $2 == 'e' ]] +elif [[ $1 == 'init' && $2 == '-e' ]] then frappe_installer echo "installing erpnext" @@ -37,7 +37,7 @@ then docker exec -it frappe bash -c "bench --site site1.local install-app erpnext" echo "finished" -elif [[ $1 == 'init' && $2 == 'd' ]] +elif [[ $1 == 'init' && $2 == '-d' ]] then frappe_installer docker exec -it frappe bash -c "cat frappe-bench/sites/site1/site_config.json" @@ -67,10 +67,12 @@ else ;; \?) echo "Invalid option: -$OPTARG" >&2 + display_usage exit 1 ;; :) echo "Option -$OPTARG requires an argument." >&2 + displpay_usage exit 1 ;; esac From 9f5ae270000b0c826697052bd15c4d0e5f5abbb5 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 16:25:33 -0700 Subject: [PATCH 032/108] fixed dbench and added check for crontab --- Dockerfile | 1 + dbench | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index cf31db7b..ccf4b4d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,7 @@ RUN apt-get install -y curl RUN apt-get install -y rlwrap RUN apt-get install redis-tools RUN apt-get install -y nano +RUN apt-get install -y crontab # Generate locale C.UTF-8 for mariadb and general locale data ENV LANG C.UTF-8 diff --git a/dbench b/dbench index 31132fc6..614857c0 100755 --- a/dbench +++ b/dbench @@ -40,7 +40,7 @@ then elif [[ $1 == 'init' && $2 == '-d' ]] then frappe_installer - docker exec -it frappe bash -c "cat frappe-bench/sites/site1/site_config.json" + docker exec -it frappe bash -c "cat frappe-bench/sites/site1.local/site_config.json" elif [ $1 == 'init' ] then @@ -72,7 +72,7 @@ else ;; :) echo "Option -$OPTARG requires an argument." >&2 - displpay_usage + display_usage exit 1 ;; esac From f4820c3810a4212c89c0280fab0d93327aeff274 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 16:30:15 -0700 Subject: [PATCH 033/108] fix cron --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ccf4b4d2..0ee7402a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ RUN apt-get install -y curl RUN apt-get install -y rlwrap RUN apt-get install redis-tools RUN apt-get install -y nano -RUN apt-get install -y crontab +RUN apt-get install -y cron # Generate locale C.UTF-8 for mariadb and general locale data ENV LANG C.UTF-8 From 4feb7f357d3e1c7ae10799a6a846513439f4a11e Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 16:39:38 -0700 Subject: [PATCH 034/108] need to find where site_config.json is --- dbench | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbench b/dbench index 614857c0..879418c6 100755 --- a/dbench +++ b/dbench @@ -40,6 +40,8 @@ then elif [[ $1 == 'init' && $2 == '-d' ]] then frappe_installer + docker exec -it frappe bash -c "ls frappe-bench/sites/" + docker exec -it frappe bash -c "ls frappe-bench/sites/site1.local" docker exec -it frappe bash -c "cat frappe-bench/sites/site1.local/site_config.json" elif [ $1 == 'init' ] From 501185d832ff993da8fea70c18c187347c763693 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 16:47:30 -0700 Subject: [PATCH 035/108] more --- dbench | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dbench b/dbench index 879418c6..3e1911c9 100755 --- a/dbench +++ b/dbench @@ -40,9 +40,7 @@ then elif [[ $1 == 'init' && $2 == '-d' ]] then frappe_installer - docker exec -it frappe bash -c "ls frappe-bench/sites/" - docker exec -it frappe bash -c "ls frappe-bench/sites/site1.local" - docker exec -it frappe bash -c "cat frappe-bench/sites/site1.local/site_config.json" + docker exec -it frappe bash -c "cat ~/frappe-bench/sites/site1.local/site_config.json" elif [ $1 == 'init' ] then From 7c51ae9ae037bd9af892192f9dcd91b055f406d8 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 17:03:03 -0700 Subject: [PATCH 036/108] finally --- dbench | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbench b/dbench index 3e1911c9..f9bd162a 100755 --- a/dbench +++ b/dbench @@ -40,7 +40,7 @@ then elif [[ $1 == 'init' && $2 == '-d' ]] then frappe_installer - docker exec -it frappe bash -c "cat ~/frappe-bench/sites/site1.local/site_config.json" + docker exec -it frappe bash -c "bench set-config \"developer_mode\" 1 && bench clear-cache" elif [ $1 == 'init' ] then From 0db110f8edd92be5fd938a4d4a00aaf4c0430741 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 17:12:02 -0700 Subject: [PATCH 037/108] testing erpnext install --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7b1caf81..70305d71 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ services: install: - docker-compose build - docker-compose up -d - - ./dbench init -d + - ./dbench init -e - pip install --upgrade virtualenv - virtualenv -p python3 testenv - source testenv/bin/activate From ab00022d66248c0542370ba94500519a75d20ca9 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 18:56:53 -0700 Subject: [PATCH 038/108] adding commands to dbench --- dbench => dbench.sh | 50 +++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 22 deletions(-) rename dbench => dbench.sh (56%) mode change 100755 => 100644 diff --git a/dbench b/dbench.sh old mode 100755 new mode 100644 similarity index 56% rename from dbench rename to dbench.sh index f9bd162a..787eaef1 --- a/dbench +++ b/dbench.sh @@ -1,15 +1,15 @@ #!/bin/bash display_usage () { - echo "$(basename "$0") [-h] [-c \"\"]" + echo "Usage: dbench.sh [-hda [sitename] | --init [-e | -d] [sitename (if not specified, it will default to site1.local)]] [\"\"]" echo '' echo 'where:' echo ' -h show this help text' - echo ' -c execute a command inside docker using docker exec' - echo ' -s adds site-names to /etc/hosts file in the container to facilitate multisite access' - echo ' init initializes frappe-bench' - echo ' init -e initializes frappe-bench and installs erpnext' - echo ' init -d initializes frappe-bench and enables developer mode' + echo ' -d [sitename] enables developer mode for specified site' + echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' + echo ' --init [-e | -d] [sitename] initializes frappe-bench' + echo ' -e initializes frappe-bench and installs erpnext' + echo ' -d initializes frappe-bench and enables developer mode' } frappe_installer () { @@ -19,45 +19,51 @@ frappe_installer () { docker exec -it frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" echo "frappe-bench folder setup" docker exec -it -u root frappe bash -c "apt-get install vim -y && apt-get install sudo -y && usermod -aG sudo frappe && printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" - echo "adding site1.local" - docker exec -it frappe bash -c "bench new-site site1.local" - docker exec -i -u root frappe bash -c "echo 127.0.0.1 site1.local >> /etc/hosts" - sudo su -c 'echo 127.0.0.1 site1.local >> /etc/hosts' - echo "site1.local added" + echo "adding $1" + docker exec -it frappe bash -c "bench new-site $1" + docker exec -i -u root frappe bash -c "echo 127.0.0.1 $1 >> /etc/hosts" + sudo su -c 'echo 127.0.0.1 $1 >> /etc/hosts' + echo "$1 added" } if [[ $# -eq 0 ]]; then - docker exec -it frappe bash + docker exec -it frappe bash "bench $@" elif [[ $1 == 'init' && $2 == '-e' ]] then - frappe_installer + if ! $3 then + set -- "${@:1:2}" "site1.local" + fi + frappe_installer $3 echo "installing erpnext" docker exec -it frappe bash -c "bench get-app erpnext" - docker exec -it frappe bash -c "bench --site site1.local install-app erpnext" + docker exec -it frappe bash -c "bench --site $3 install-app erpnext" echo "finished" elif [[ $1 == 'init' && $2 == '-d' ]] then - frappe_installer - docker exec -it frappe bash -c "bench set-config \"developer_mode\" 1 && bench clear-cache" + if ! $3 then + set -- "${@:1:2}" "site1.local" + fi + frappe_installer $3 + docker exec -it frappe bash -c "bench --site $3 set-config \"developer_mode\" 1 && bench clear-cache" elif [ $1 == 'init' ] then - frappe_installer + if ! $2 then + set -- "${@:1}" "site1.local" + fi + frappe_installer $2 else - while getopts ':hsc:' option; do + while getopts ':hs:' option; do case "$option" in h) display_usage exit ;; - c) - docker exec -it frappe bash -c "bench $OPTARG" - ;; s) - a=$(cd frappe-bench && ls sites/*/site_config.json | grep -o '/.\+/') + a=$(docker exec -i frappe bash -c "cd ~/frappe-bench && ls sites/*/site_config.json" | grep -o '/.\+/') a="${a//$'\n'/ }" a=$(echo $a | tr -d / ) result="127.0.0.1 ${a}" From 3c53492b20eaefbcaabaaa86f1f3ec845b5e81cd Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 19:05:09 -0700 Subject: [PATCH 039/108] Updated a few more things --- .travis.yml | 2 +- dbench.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 70305d71..3fbd4119 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ services: install: - docker-compose build - docker-compose up -d - - ./dbench init -e + - ./dbench init - pip install --upgrade virtualenv - virtualenv -p python3 testenv - source testenv/bin/activate diff --git a/dbench.sh b/dbench.sh index 787eaef1..0f3f8c61 100644 --- a/dbench.sh +++ b/dbench.sh @@ -56,13 +56,13 @@ then frappe_installer $2 else - while getopts ':hs:' option; do + while getopts ':had:' option; do case "$option" in h) display_usage exit ;; - s) + a) a=$(docker exec -i frappe bash -c "cd ~/frappe-bench && ls sites/*/site_config.json" | grep -o '/.\+/') a="${a//$'\n'/ }" a=$(echo $a | tr -d / ) @@ -71,6 +71,8 @@ else docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts" docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" ;; + d) + docker exec -it frappe bash -c "bench --site $OPTARG set-config \"developer_mode\" 1 && bench clear-cache" \?) echo "Invalid option: -$OPTARG" >&2 display_usage From 00b623ef04a63fad70f76a032aaae760ecc934bc Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 19:15:59 -0700 Subject: [PATCH 040/108] switched dbench back --- dbench.sh => dbench | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dbench.sh => dbench (100%) diff --git a/dbench.sh b/dbench similarity index 100% rename from dbench.sh rename to dbench From 47f8b3dc2aeab8c0512290125b45e4c03136d851 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 19:24:36 -0700 Subject: [PATCH 041/108] Try again --- dbench | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dbench b/dbench index 0f3f8c61..6c023833 100644 --- a/dbench +++ b/dbench @@ -1,7 +1,7 @@ #!/bin/bash -display_usage () { - echo "Usage: dbench.sh [-hda [sitename] | --init [-e | -d] [sitename (if not specified, it will default to site1.local)]] [\"\"]" +display_usage { + echo "Usage: dbench [-hda [sitename] | --init [-e | -d] [sitename (if not specified, it will default to site1.local)]] [\"\"]" echo '' echo 'where:' echo ' -h show this help text' @@ -12,7 +12,7 @@ display_usage () { echo ' -d initializes frappe-bench and enables developer mode' } -frappe_installer () { +frappe_installer { echo "starting frappe_docker setup" docker exec -i -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" docker exec -it frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" @@ -46,7 +46,7 @@ then set -- "${@:1:2}" "site1.local" fi frappe_installer $3 - docker exec -it frappe bash -c "bench --site $3 set-config \"developer_mode\" 1 && bench clear-cache" + docker exec -it -u root frappe bash -c "bench --site $3 set-config \"developer_mode\" 1 && bench clear-cache" elif [ $1 == 'init' ] then @@ -72,7 +72,7 @@ else docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" ;; d) - docker exec -it frappe bash -c "bench --site $OPTARG set-config \"developer_mode\" 1 && bench clear-cache" + docker exec -it -u root frappe bash -c "bench --site $OPTARG set-config \"developer_mode\" 1 && bench clear-cache" \?) echo "Invalid option: -$OPTARG" >&2 display_usage From e345671667f3b1a5f7cceee699bc28b9365a537a Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 19:30:39 -0700 Subject: [PATCH 042/108] hope fix perm denied --- dbench | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dbench b/dbench index 6c023833..fb24c077 100644 --- a/dbench +++ b/dbench @@ -1,6 +1,6 @@ #!/bin/bash -display_usage { +usage { echo "Usage: dbench [-hda [sitename] | --init [-e | -d] [sitename (if not specified, it will default to site1.local)]] [\"\"]" echo '' echo 'where:' @@ -29,7 +29,7 @@ frappe_installer { if [[ $# -eq 0 ]]; then docker exec -it frappe bash "bench $@" -elif [[ $1 == 'init' && $2 == '-e' ]] +elif [[ $1 == '--init' && $2 == '-e' ]] then if ! $3 then set -- "${@:1:2}" "site1.local" @@ -40,7 +40,7 @@ then docker exec -it frappe bash -c "bench --site $3 install-app erpnext" echo "finished" -elif [[ $1 == 'init' && $2 == '-d' ]] +elif [[ $1 == '--init' && $2 == '-d' ]] then if ! $3 then set -- "${@:1:2}" "site1.local" @@ -48,7 +48,7 @@ then frappe_installer $3 docker exec -it -u root frappe bash -c "bench --site $3 set-config \"developer_mode\" 1 && bench clear-cache" -elif [ $1 == 'init' ] +elif [ $1 == '--init' ] then if ! $2 then set -- "${@:1}" "site1.local" @@ -75,12 +75,12 @@ else docker exec -it -u root frappe bash -c "bench --site $OPTARG set-config \"developer_mode\" 1 && bench clear-cache" \?) echo "Invalid option: -$OPTARG" >&2 - display_usage + usage exit 1 ;; :) echo "Option -$OPTARG requires an argument." >&2 - display_usage + usage exit 1 ;; esac From 3c469b0e4a30a5504b9df85573779c1aa2513b89 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 19:53:02 -0700 Subject: [PATCH 043/108] fixed and enhanced dbench --- dbench | 61 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/dbench b/dbench index fb24c077..3f2285c1 100644 --- a/dbench +++ b/dbench @@ -1,18 +1,19 @@ #!/bin/bash -usage { - echo "Usage: dbench [-hda [sitename] | --init [-e | -d] [sitename (if not specified, it will default to site1.local)]] [\"\"]" +function usage { + echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup ] [\"\"]" echo '' echo 'where:' echo ' -h show this help text' - echo ' -d [sitename] enables developer mode for specified site' + echo ' -d [sitename] enables developer mode for specified site' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' - echo ' --init [-e | -d] [sitename] initializes frappe-bench' + echo ' --setup starts up and builds docker' + echo ' --init [-e | -d] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' echo ' -e initializes frappe-bench and installs erpnext' echo ' -d initializes frappe-bench and enables developer mode' } -frappe_installer { +function frappe_installer { echo "starting frappe_docker setup" docker exec -i -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" docker exec -it frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" @@ -27,34 +28,31 @@ frappe_installer { } if [[ $# -eq 0 ]]; then - docker exec -it frappe bash "bench $@" - -elif [[ $1 == '--init' && $2 == '-e' ]] -then - if ! $3 then - set -- "${@:1:2}" "site1.local" - fi - frappe_installer $3 - echo "installing erpnext" - docker exec -it frappe bash -c "bench get-app erpnext" - docker exec -it frappe bash -c "bench --site $3 install-app erpnext" - echo "finished" - -elif [[ $1 == '--init' && $2 == '-d' ]] -then - if ! $3 then - set -- "${@:1:2}" "site1.local" + docker exec -it frappe bash 'bench $@' + +elif [ $1 == '--init' ]; then + site=$2 + if ! $2; then set -- "${@:1}" "site1.local"; fi + if ! $3; then set -- "${@:1:2}" "site1.local" && site=$3; fi + if ! $4; then set -- "${@:1:2:3}" "site1.local" && site=$4; fi + frappe_installer $site + if [ $2 == '-e' ]; then + echo "installing erpnext" + docker exec -it frappe bash -c "bench get-app erpnext" + docker exec -it frappe bash -c "bench --site $site install-app erpnext" + echo "finished" + elif [ $2 == '-d' ]; then + docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + elif [ $2 == '-ed' ]; then + echo "installing erpnext" + docker exec -it frappe bash -c "bench get-app erpnext" + docker exec -it frappe bash -c "bench --site $site install-app erpnext" + docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + echo "finished" fi - frappe_installer $3 - docker exec -it -u root frappe bash -c "bench --site $3 set-config \"developer_mode\" 1 && bench clear-cache" - -elif [ $1 == '--init' ] -then - if ! $2 then - set -- "${@:1}" "site1.local" - fi - frappe_installer $2 +elif [ $1 == '--setup' ]; then + frappe_installer else while getopts ':had:' option; do case "$option" in @@ -73,6 +71,7 @@ else ;; d) docker exec -it -u root frappe bash -c "bench --site $OPTARG set-config \"developer_mode\" 1 && bench clear-cache" + ;; \?) echo "Invalid option: -$OPTARG" >&2 usage From bf83486dcc4a07ba7f444b884d91f13bb9687183 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 19:56:56 -0700 Subject: [PATCH 044/108] fixed travis and added a bit to dbench --- .travis.yml | 5 ++--- dbench | 15 ++++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3fbd4119..2f6edce9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,9 +12,8 @@ services: - docker install: - - docker-compose build - - docker-compose up -d - - ./dbench init + - ./dbench --setup + - ./dbench --init - pip install --upgrade virtualenv - virtualenv -p python3 testenv - source testenv/bin/activate diff --git a/dbench b/dbench index 3f2285c1..40e8ba27 100644 --- a/dbench +++ b/dbench @@ -7,7 +7,7 @@ function usage { echo ' -h show this help text' echo ' -d [sitename] enables developer mode for specified site' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' - echo ' --setup starts up and builds docker' + echo ' --setup starts up and builds docker, NOTE: assumes you have docker installed' echo ' --init [-e | -d] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' echo ' -e initializes frappe-bench and installs erpnext' echo ' -d initializes frappe-bench and enables developer mode' @@ -29,21 +29,21 @@ function frappe_installer { if [[ $# -eq 0 ]]; then docker exec -it frappe bash 'bench $@' - + elif [ $1 == '--init' ]; then site=$2 if ! $2; then set -- "${@:1}" "site1.local"; fi if ! $3; then set -- "${@:1:2}" "site1.local" && site=$3; fi if ! $4; then set -- "${@:1:2:3}" "site1.local" && site=$4; fi frappe_installer $site - if [ $2 == '-e' ]; then + if [ "$2" == '-e' ]; then echo "installing erpnext" docker exec -it frappe bash -c "bench get-app erpnext" docker exec -it frappe bash -c "bench --site $site install-app erpnext" echo "finished" - elif [ $2 == '-d' ]; then + elif [ "$2" == '-d' ]; then docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" - elif [ $2 == '-ed' ]; then + elif [ "$2" == '-ed' ]; then echo "installing erpnext" docker exec -it frappe bash -c "bench get-app erpnext" docker exec -it frappe bash -c "bench --site $site install-app erpnext" @@ -51,8 +51,9 @@ elif [ $1 == '--init' ]; then echo "finished" fi -elif [ $1 == '--setup' ]; then - frappe_installer +elif [ "$1" == '--setup' ]; then + docker-compose build + docker-compose up -d else while getopts ':had:' option; do case "$option" in From dbb35af38535f0b26b4ad78c71454d25eb6da2fe Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 20:02:25 -0700 Subject: [PATCH 045/108] chmod for dbench --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2f6edce9..afc72552 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ services: - docker install: + - chmod u+x ./dbench - ./dbench --setup - ./dbench --init - pip install --upgrade virtualenv From 01e43aa74f40271d26a1883301aa96502115827c Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 20:19:57 -0700 Subject: [PATCH 046/108] debug dbench update travis --- .travis.yml | 2 -- dbench | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index afc72552..34cd9812 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,3 @@ -sudo: required - language: python python: diff --git a/dbench b/dbench index 40e8ba27..38f90056 100644 --- a/dbench +++ b/dbench @@ -35,6 +35,7 @@ elif [ $1 == '--init' ]; then if ! $2; then set -- "${@:1}" "site1.local"; fi if ! $3; then set -- "${@:1:2}" "site1.local" && site=$3; fi if ! $4; then set -- "${@:1:2:3}" "site1.local" && site=$4; fi + echo "$site" frappe_installer $site if [ "$2" == '-e' ]; then echo "installing erpnext" From 975aea90f31400f78d8fc1b92c1206da3de61fb0 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 20:49:41 -0700 Subject: [PATCH 047/108] removed superflourus if statment --- dbench | 1 - 1 file changed, 1 deletion(-) diff --git a/dbench b/dbench index 38f90056..1cb3d8f4 100644 --- a/dbench +++ b/dbench @@ -34,7 +34,6 @@ elif [ $1 == '--init' ]; then site=$2 if ! $2; then set -- "${@:1}" "site1.local"; fi if ! $3; then set -- "${@:1:2}" "site1.local" && site=$3; fi - if ! $4; then set -- "${@:1:2:3}" "site1.local" && site=$4; fi echo "$site" frappe_installer $site if [ "$2" == '-e' ]; then From 37765cfc120b0b2d7356c79f413c18b243636929 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 20:58:52 -0700 Subject: [PATCH 048/108] update travis --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 34cd9812..07c8d56c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +sudo: required + language: python python: @@ -9,8 +11,14 @@ env: services: - docker -install: +before_install: + - sudo rm /usr/local/bin/docker-compose + - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose + - chmod +x docker-compose + - sudo mv docker-compose /usr/local/bin - chmod u+x ./dbench + +install: - ./dbench --setup - ./dbench --init - pip install --upgrade virtualenv From 17c7b662a749fca02f27157902e26571ef830f0f Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 21:01:56 -0700 Subject: [PATCH 049/108] Found the build issue, and now its gone --- dbench | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dbench b/dbench index 1cb3d8f4..196a1239 100644 --- a/dbench +++ b/dbench @@ -28,11 +28,12 @@ function frappe_installer { } if [[ $# -eq 0 ]]; then + echo "$@" docker exec -it frappe bash 'bench $@' elif [ $1 == '--init' ]; then site=$2 - if ! $2; then set -- "${@:1}" "site1.local"; fi + if ! $2; then set -- "${@:1}" "site1.local" && site=$2; fi if ! $3; then set -- "${@:1:2}" "site1.local" && site=$3; fi echo "$site" frappe_installer $site From ee2c9c3a97a24c06bbc401df15607dc50f391815 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 21:13:17 -0700 Subject: [PATCH 050/108] decided to dump reseting args --- dbench | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbench b/dbench index 196a1239..db7f019c 100644 --- a/dbench +++ b/dbench @@ -33,8 +33,8 @@ if [[ $# -eq 0 ]]; then elif [ $1 == '--init' ]; then site=$2 - if ! $2; then set -- "${@:1}" "site1.local" && site=$2; fi - if ! $3; then set -- "${@:1:2}" "site1.local" && site=$3; fi + if ! $2; then site="site1.local"; fi + if ! $3; then site="site1.local"; fi echo "$site" frappe_installer $site if [ "$2" == '-e' ]; then From 2f7ca23290fd8594128e7de0ee09c30f2c3e2f50 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 21:25:50 -0700 Subject: [PATCH 051/108] Issue was with both messed up if and opposite placement for default --- dbench | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dbench b/dbench index db7f019c..68a801b5 100644 --- a/dbench +++ b/dbench @@ -32,9 +32,13 @@ if [[ $# -eq 0 ]]; then docker exec -it frappe bash 'bench $@' elif [ $1 == '--init' ]; then - site=$2 - if ! $2; then site="site1.local"; fi - if ! $3; then site="site1.local"; fi + site=$3 + if [ -z "$3" ]; then + site="site1.local" + fi + if [ -z "$2" ]; then + site="site1.local" + fi echo "$site" frappe_installer $site if [ "$2" == '-e' ]; then From 4c15279f07775f7af21441e7f61aa00ac2699710 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 21:29:38 -0700 Subject: [PATCH 052/108] fixed issue where if you didnt supply 2nd arg in init it would default --- dbench | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dbench b/dbench index 68a801b5..3f8924d1 100644 --- a/dbench +++ b/dbench @@ -27,7 +27,7 @@ function frappe_installer { echo "$1 added" } -if [[ $# -eq 0 ]]; then +if [[ $# -eq 1 ]]; then echo "$@" docker exec -it frappe bash 'bench $@' @@ -38,6 +38,8 @@ elif [ $1 == '--init' ]; then fi if [ -z "$2" ]; then site="site1.local" + else + site=$2 fi echo "$site" frappe_installer $site From c7416cc3bc3cb95e030d34038cf13a6a83332cb5 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 21:36:12 -0700 Subject: [PATCH 053/108] Updated dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0ee7402a..24398cb5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ #bench Dockerfile FROM ubuntu:16.04 -MAINTAINER frappé +LABEL Author frappé USER root RUN apt-get update From e7c3b144351836bcba3e861dedf8429d83c7c691 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 21:39:14 -0700 Subject: [PATCH 054/108] oops, small change broke every thing --- dbench | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbench b/dbench index 3f8924d1..ceb3433e 100644 --- a/dbench +++ b/dbench @@ -27,7 +27,7 @@ function frappe_installer { echo "$1 added" } -if [[ $# -eq 1 ]]; then +if [[ $# -eq 0 ]]; then echo "$@" docker exec -it frappe bash 'bench $@' From 2be7fbb50838bde5aa5e8283ff7eadee941fcfc1 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 22:01:33 -0700 Subject: [PATCH 055/108] added dbench start --- .travis.yml | 1 + dbench | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 07c8d56c..966c2d6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ before_install: install: - ./dbench --setup - ./dbench --init + - ./dbench --start - pip install --upgrade virtualenv - virtualenv -p python3 testenv - source testenv/bin/activate diff --git a/dbench b/dbench index ceb3433e..34bcd6a8 100644 --- a/dbench +++ b/dbench @@ -1,13 +1,14 @@ #!/bin/bash function usage { - echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup ] [\"\"]" + echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup | --start] [\"\"]" echo '' echo 'where:' echo ' -h show this help text' echo ' -d [sitename] enables developer mode for specified site' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' echo ' --setup starts up and builds docker, NOTE: assumes you have docker installed' + echo ' --start starts frappe docker' echo ' --init [-e | -d] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' echo ' -e initializes frappe-bench and installs erpnext' echo ' -d initializes frappe-bench and enables developer mode' @@ -61,6 +62,17 @@ elif [ $1 == '--init' ]; then elif [ "$1" == '--setup' ]; then docker-compose build docker-compose up -d + +elif [ "$1" == '--start' ]; then + docker-compose start + a=$(docker exec -i frappe bash -c "cd ~/frappe-bench && ls sites/*/site_config.json" | grep -o '/.\+/') + a="${a//$'\n'/ }" + a=$(echo $a | tr -d / ) + result="127.0.0.1 ${a}" + echo $result + docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts" + docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" + else while getopts ':had:' option; do case "$option" in From ebd691ee299bb92829acb2405b1fed0e5979b33d Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 22:25:35 -0700 Subject: [PATCH 056/108] hopfully fixes issue with test.py --- .travis.yml | 2 +- dbench | 21 ++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 966c2d6e..fccfe49f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ before_install: - chmod u+x ./dbench install: - - ./dbench --setup + - ./dbench --setup -d - ./dbench --init - ./dbench --start - pip install --upgrade virtualenv diff --git a/dbench b/dbench index 34bcd6a8..43fc50b5 100644 --- a/dbench +++ b/dbench @@ -1,13 +1,14 @@ #!/bin/bash function usage { - echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup | --start] [\"\"]" + echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start] [\"\"]" echo '' echo 'where:' echo ' -h show this help text' echo ' -d [sitename] enables developer mode for specified site' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' - echo ' --setup starts up and builds docker, NOTE: assumes you have docker installed' + echo ' --setup [-d] builds docker containers, NOTE: assumes you have docker installed' + echo ' -d start up docker containers as well' echo ' --start starts frappe docker' echo ' --init [-e | -d] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' echo ' -e initializes frappe-bench and installs erpnext' @@ -61,17 +62,15 @@ elif [ $1 == '--init' ]; then elif [ "$1" == '--setup' ]; then docker-compose build - docker-compose up -d - + if [ "$2" == '-d' ]; then + docker-compose up -d + else + docker-compose up + fi elif [ "$1" == '--start' ]; then docker-compose start - a=$(docker exec -i frappe bash -c "cd ~/frappe-bench && ls sites/*/site_config.json" | grep -o '/.\+/') - a="${a//$'\n'/ }" - a=$(echo $a | tr -d / ) - result="127.0.0.1 ${a}" - echo $result - docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts" - docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" + ./dbench -a + docker exec -i frappe bash -c "bench start" else while getopts ':had:' option; do From c7eacecc0e21084e50708f63d8b05f715db73871 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 22:43:43 -0700 Subject: [PATCH 057/108] updated read me, dbench, test.py, and hopefully all stuff will work now --- README.md | 26 +++++++++++--------------- dbench | 12 ++++++++---- test.py | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 914b63ad..809a660e 100644 --- a/README.md +++ b/README.md @@ -90,37 +90,33 @@ Express dependency between services, which has two effects: * 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](https://github.com/frappe/bench) + 1.Build the 5 linked containers frappe, mariadb, redis-cache, redis-queue and redis-socketio using this command. - docker-compose up -d + ./dbench --setup -d - Note: Please do not remove the bench-repo directory the above commands will create + 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](https://github.com/frappe/bench) + Note: Please do not remove the bench-repo directory the above commands will create #### Basic Usage ##### Make sure your current directory is frappe_docker 1. First time setup - - ./dbench init + + ./dbench --init 2. Command to start all the containers - docker-compose start - -3. Command to be executed everytime after starting your containers - - ./dbench -s + ./dbench --start 4. Command to enter your container - docker exec -it frappe bash + ./dbench -5. All bench commands can also be directly run from the host machine by using dbench. For instance ```bench start``` can be executed by running ```./dbench -c start```. Just preface the option with ./dbench -c. For more information on dbench run the command ```./dbench -h```. +5. All bench commands can also be directly run from the host machine by using `dbench`. For instance `bench start` can be executed by running `./dbench -c start`. Just preface the option with `./dbench -c`. For more information on `dbench` run the command `./dbench -h`. -For more info on how to build this docker container refer to this [Wiki](https://github.com/frappe/frappe_docker/wiki/Hitchhiker's-guide-to-building-this-frappe_docker-image) +For more info on how to build this docker container refer to this [Wiki](https://github.com/chabad360/frappe_docker/wiki/Hitchhiker's-guide-to-building-this-frappe_docker-image) To login to Frappe / ERPNext, open your browser and go to `[your-external-ip]:8000`, probably `localhost:8000` diff --git a/dbench b/dbench index 43fc50b5..789b69b9 100644 --- a/dbench +++ b/dbench @@ -1,10 +1,11 @@ #!/bin/bash function usage { - echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start] [\"\"]" + echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start | -c \"\"]" echo '' echo 'where:' echo ' -h show this help text' + echo ' -c send a command to the frappe container' echo ' -d [sitename] enables developer mode for specified site' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' echo ' --setup [-d] builds docker containers, NOTE: assumes you have docker installed' @@ -30,8 +31,8 @@ function frappe_installer { } if [[ $# -eq 0 ]]; then - echo "$@" - docker exec -it frappe bash 'bench $@' + echo "entering container" + docker exec -it frappe bash elif [ $1 == '--init' ]; then site=$3 @@ -73,7 +74,7 @@ elif [ "$1" == '--start' ]; then docker exec -i frappe bash -c "bench start" else - while getopts ':had:' option; do + while getopts ':hadc:' option; do case "$option" in h) display_usage @@ -91,6 +92,9 @@ else d) docker exec -it -u root frappe bash -c "bench --site $OPTARG set-config \"developer_mode\" 1 && bench clear-cache" ;; + c) + docker exec -it -u root frappe bash -c "bench $OPTARG" + ;; \?) echo "Invalid option: -$OPTARG" >&2 usage diff --git a/test.py b/test.py index e29fa851..c127ad74 100644 --- a/test.py +++ b/test.py @@ -13,7 +13,7 @@ def print_out(val,delay): elif val == 2: try: global r - r = requests.get("http://site1.local:8000") + r = requests.get("http://localhost:8000") print(r) except requests.exceptions.ConnectionError as e: print(e) From bf0affbae7e8f3cd02cb31f40e3536fdce70608a Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 1 Aug 2018 22:53:13 -0700 Subject: [PATCH 058/108] updated dbench --- dbench | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dbench b/dbench index 789b69b9..5beca359 100644 --- a/dbench +++ b/dbench @@ -1,7 +1,7 @@ #!/bin/bash function usage { - echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start | -c \"\"]" + echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start [-b] | -c \"\"]" echo '' echo 'where:' echo ' -h show this help text' @@ -9,8 +9,9 @@ function usage { echo ' -d [sitename] enables developer mode for specified site' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' echo ' --setup [-d] builds docker containers, NOTE: assumes you have docker installed' - echo ' -d start up docker containers as well' - echo ' --start starts frappe docker' + echo ' -d start up docker containers as well' + echo ' --start [-b] starts frappe docker' + echo ' -b starts bench as well' echo ' --init [-e | -d] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' echo ' -e initializes frappe-bench and installs erpnext' echo ' -d initializes frappe-bench and enables developer mode' @@ -71,7 +72,9 @@ elif [ "$1" == '--setup' ]; then elif [ "$1" == '--start' ]; then docker-compose start ./dbench -a - docker exec -i frappe bash -c "bench start" + if [ "$2" == '-b' ]; then + docker exec -i frappe bash -c "bench start" + fi else while getopts ':hadc:' option; do From 2c6dd9272fc4c598e9752078032d1bf6cfd501e3 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 10:22:53 -0700 Subject: [PATCH 059/108] updated README --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 809a660e..26702af8 100644 --- a/README.md +++ b/README.md @@ -69,9 +69,9 @@ depends_on: ``` 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. +1. `docker-compose up -d` 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 SERVICE’s dependencies. In the following example, docker-compose up docker_frappe will also create and start mariadb and redis. +2. docker-compose up SERVICE will automatically include SERVICE’s dependencies. In the following example, `docker-compose up -d frappe` will also create and start mariadb and redis. ### Installation @@ -94,7 +94,7 @@ Express dependency between services, which has two effects: ./dbench --setup -d - Make sure your current working directory is frappe_docker which contains the docker-compose.yml and Dockerfile. + 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](https://github.com/frappe/bench) Note: Please do not remove the bench-repo directory the above commands will create @@ -118,7 +118,7 @@ Express dependency between services, which has two effects: For more info on how to build this docker container refer to this [Wiki](https://github.com/chabad360/frappe_docker/wiki/Hitchhiker's-guide-to-building-this-frappe_docker-image) -To login to Frappe / ERPNext, open your browser and go to `[your-external-ip]:8000`, probably `localhost:8000` +To login to Frappe / ERPNext, open your browser and go to `[your-external-ip]:8000`, or `localhost:8000` The default username is "Administrator" and password is what you set when you created the new site. The default admin password is set in common_site_config.json, and is set to 'admin' in this docker image. From 713fffeb71cc16b48aac660adf552d1b540e829a Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 10:45:12 -0700 Subject: [PATCH 060/108] set taravis to trigger on succesful build --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index fccfe49f..0a365179 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,4 +34,5 @@ script: - docker-compose ps | grep -i redis-socketio - docker-compose ps | grep -i mariadb - python test.py + - curl -H "Content-Type: application/json" --data '{"docker_tag": "env"}' -X POST https://registry.hub.docker.com/u/chabad360/frappe/trigger/$hubkey/ - docker-compose stop \ No newline at end of file From f3327ada01ce157ea0005be4b8f54597d87de78a Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 10:58:22 -0700 Subject: [PATCH 061/108] fix travis config --- .travis.yml | 3 ++- curl-travis | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 curl-travis diff --git a/.travis.yml b/.travis.yml index 0a365179..6564c319 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ before_install: - chmod +x docker-compose - sudo mv docker-compose /usr/local/bin - chmod u+x ./dbench + - chmod u+x ./curl-travis install: - ./dbench --setup -d @@ -34,5 +35,5 @@ script: - docker-compose ps | grep -i redis-socketio - docker-compose ps | grep -i mariadb - python test.py - - curl -H "Content-Type: application/json" --data '{"docker_tag": "env"}' -X POST https://registry.hub.docker.com/u/chabad360/frappe/trigger/$hubkey/ + - ./curl-travis - docker-compose stop \ No newline at end of file diff --git a/curl-travis b/curl-travis new file mode 100644 index 00000000..99c96f81 --- /dev/null +++ b/curl-travis @@ -0,0 +1,3 @@ +#!/bin/bash + +curl -H "Content-Type: application/json" --data '{"docker_tag": "latest"}' -X POST https://registry.hub.docker.com/u/chabad360/frappe/trigger/$hubkey/ \ No newline at end of file From 78ac80d54ac1f6acd9cd6918b2f7c1c15db471b2 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 11:07:42 -0700 Subject: [PATCH 062/108] fixed tag --- curl-travis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/curl-travis b/curl-travis index 99c96f81..4a9c7e31 100644 --- a/curl-travis +++ b/curl-travis @@ -1,3 +1,3 @@ #!/bin/bash -curl -H "Content-Type: application/json" --data '{"docker_tag": "latest"}' -X POST https://registry.hub.docker.com/u/chabad360/frappe/trigger/$hubkey/ \ No newline at end of file +curl -H "Content-Type: application/json" --data '{"docker_tag": "env"}' -X POST https://registry.hub.docker.com/u/chabad360/frappe/trigger/$hubkey/ \ No newline at end of file From ae0e89b1a8d172552c953c04ae89fa16d0338452 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 11:31:58 -0700 Subject: [PATCH 063/108] Updated readme --- README.md | 62 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 26702af8..991d400c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # frappe_docker -[![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=master)](https://travis-ci.org/frappe/frappe_docker) + +| `latest` | `env` | `frappe-dev` | +|:--------:|:-----:|:------------:| +| [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=frappe)](https://travis-ci.org/frappe/frappe_docker) | [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=master)](https://travis-ci.org/frappe/frappe_docker) |[![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=frappe-dev)](https://travis-ci.org/frappe/frappe_docker) | - [Docker](https://docker.com/) is an open source project to pack, ship and run any Linux application in a lighter weight, faster container than a traditional virtual machine. @@ -19,9 +22,9 @@ These instructions will get you a copy of the project up and running on your loc ### Container Configuration -#### ports: +#### Ports -``` +```bash ports: - "3307:3307" mariadb-port - "8000:8000" webserver-port @@ -34,9 +37,9 @@ ports: 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_port]])|():[/udp]` as defined in the [docker port binding documentation](http://docs.docker.com/userguide/dockerlinks/). 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 -``` +```bash volumes: - ./frappe-bench:/home/frappe/frappe-bench - ./conf/mariadb-conf.d:/etc/mysql/conf.d @@ -44,11 +47,12 @@ volumes: - ./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: +#### Links -``` +```bash links: - redis-cache - redis-queue @@ -58,15 +62,16 @@ links: Links allow you to define extra aliases by which a service is reachable from another service. -#### depends_on: +#### Depends_on -``` +```bash depends_on: - mariadb - redis-cache - redis-queue - redis-socketio ``` + Express dependency between services, which has two effects: 1. `docker-compose up -d` will start services in dependency order. In the following example, mariadb and redis will be started before frappe. @@ -83,48 +88,49 @@ Express dependency between services, which has two effects: #### 2. Build the container and install bench -* Clone this repo and change your working directory to frappe_docker - - git clone --depth 1 https://github.com/frappe/frappe_docker.git - cd frappe_docker +- Clone this repo and change your working directory to frappe_docker -* Build the container and install bench inside the container. + git clone --depth 1 https://github.com/frappe/frappe_docker.git + cd frappe_docker - 1.Build the 5 linked containers frappe, mariadb, redis-cache, redis-queue and redis-socketio using this command. +- Build the container and install bench inside the container. + + 1. Build and start the 5 linked containers frappe, mariadb, redis-cache, redis-queue and redis-socketio using this command. ./dbench --setup -d - 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](https://github.com/frappe/bench) + 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](https://github.com/frappe/bench) + Note: Please do not remove the bench-repo directory the above commands will create - - #### Basic Usage + ##### Make sure your current directory is frappe_docker -1. First time setup - + +1.First time setup + ./dbench --init -2. Command to start all the containers +2.Command to start all the containers - ./dbench --start + ./dbench --start -4. Command to enter your container +4.Command to enter your container - ./dbench + ./dbench -5. All bench commands can also be directly run from the host machine by using `dbench`. For instance `bench start` can be executed by running `./dbench -c start`. Just preface the option with `./dbench -c`. For more information on `dbench` run the command `./dbench -h`. +5.All bench commands can also be directly run from the host machine by using `dbench`. For instance `bench start` can be executed by running `./dbench -c start`. Just preface the option with `./dbench -c`. For more information on `dbench` run the command `./dbench -h`. For more info on how to build this docker container refer to this [Wiki](https://github.com/chabad360/frappe_docker/wiki/Hitchhiker's-guide-to-building-this-frappe_docker-image) To login to Frappe / ERPNext, open your browser and go to `[your-external-ip]:8000`, or `localhost:8000` -The default username is "Administrator" and password is what you set when you created the new site. The default admin password is set in common_site_config.json, and is set to 'admin' in this docker image. +The default username is "Administrator" and password is what you set when you created the new site. The default admin password is set in common_site_config.json, and is set to 'admin' in this docker image. ## Built With -* [Docker](https://www.docker.com/) +- [Docker](https://www.docker.com/) ## Contributing From c5c66cf1e8f2b3a948fcf963dc0101179cd31dd3 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 11:36:59 -0700 Subject: [PATCH 064/108] Update README again --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 991d400c..424ad0ce 100644 --- a/README.md +++ b/README.md @@ -108,19 +108,19 @@ Express dependency between services, which has two effects: ##### Make sure your current directory is frappe_docker -1.First time setup +1. First time setup ./dbench --init -2.Command to start all the containers +2. Command to start all the containers ./dbench --start -4.Command to enter your container +4. Command to enter your container ./dbench -5.All bench commands can also be directly run from the host machine by using `dbench`. For instance `bench start` can be executed by running `./dbench -c start`. Just preface the option with `./dbench -c`. For more information on `dbench` run the command `./dbench -h`. +5. All bench commands can also be directly run from the host machine by using `dbench`. For instance `bench start` can be executed by running `./dbench -c start`. Just preface the option with `./dbench -c`. For more information on `dbench` run the command `./dbench -h`. For more info on how to build this docker container refer to this [Wiki](https://github.com/chabad360/frappe_docker/wiki/Hitchhiker's-guide-to-building-this-frappe_docker-image) From 2a08429f4080f1aa3adc3dafba3c61a97a9f0868 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 11:37:17 -0700 Subject: [PATCH 065/108] one more fix --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 424ad0ce..a6a9281a 100644 --- a/README.md +++ b/README.md @@ -116,11 +116,11 @@ Express dependency between services, which has two effects: ./dbench --start -4. Command to enter your container +3. Command to enter your container ./dbench -5. All bench commands can also be directly run from the host machine by using `dbench`. For instance `bench start` can be executed by running `./dbench -c start`. Just preface the option with `./dbench -c`. For more information on `dbench` run the command `./dbench -h`. +4. All bench commands can also be directly run from the host machine by using `dbench`. For instance `bench start` can be executed by running `./dbench -c start`. Just preface the option with `./dbench -c`. For more information on `dbench` run the command `./dbench -h`. For more info on how to build this docker container refer to this [Wiki](https://github.com/chabad360/frappe_docker/wiki/Hitchhiker's-guide-to-building-this-frappe_docker-image) From 0f33cfdb4fe722e426a5d613d67191d63d21cf8d Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 14:32:43 -0700 Subject: [PATCH 066/108] simplifying dbench --- dbench | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/dbench b/dbench index 5beca359..bb42cc06 100644 --- a/dbench +++ b/dbench @@ -1,18 +1,18 @@ #!/bin/bash function usage { - echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start [-b] | -c \"\"]" + echo "Usage: dbench [-had [sitename] | --init [-ed] [sitename] | --setup [-d] | --start [-b] | -c \"\"]" echo '' echo 'where:' echo ' -h show this help text' - echo ' -c send a command to the frappe container' echo ' -d [sitename] enables developer mode for specified site' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' + echo ' -c send a command to the frappe container' echo ' --setup [-d] builds docker containers, NOTE: assumes you have docker installed' echo ' -d start up docker containers as well' echo ' --start [-b] starts frappe docker' echo ' -b starts bench as well' - echo ' --init [-e | -d] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' + echo ' --init [-ed] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' echo ' -e initializes frappe-bench and installs erpnext' echo ' -d initializes frappe-bench and enables developer mode' } @@ -35,7 +35,7 @@ if [[ $# -eq 0 ]]; then echo "entering container" docker exec -it frappe bash -elif [ $1 == '--init' ]; then +elif [ "$1" == '--init' ]; then site=$3 if [ -z "$3" ]; then site="site1.local" @@ -47,20 +47,24 @@ elif [ $1 == '--init' ]; then fi echo "$site" frappe_installer $site - if [ "$2" == '-e' ]; then - echo "installing erpnext" - docker exec -it frappe bash -c "bench get-app erpnext" - docker exec -it frappe bash -c "bench --site $site install-app erpnext" - echo "finished" - elif [ "$2" == '-d' ]; then - docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" - elif [ "$2" == '-ed' ]; then - echo "installing erpnext" - docker exec -it frappe bash -c "bench get-app erpnext" - docker exec -it frappe bash -c "bench --site $site install-app erpnext" - docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" - echo "finished" - fi + while getopts :ed: option; do + case "$option" in + e) + echo "installing erpnext" + docker exec -it frappe bash -c "bench get-app erpnext" + docker exec -it frappe bash -c "bench --site $site install-app erpnext" + echo "finished" + ;; + d) + docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + ;; + *) + echo "Invalid option: -$OPTARG" >&2 + usage + exit 1 + ;; + esac + done elif [ "$1" == '--setup' ]; then docker-compose build From 18dffdd563bd0db8ad8a46d60c6097178befcd9e Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 14:51:57 -0700 Subject: [PATCH 067/108] going back because of getopts --- dbench | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/dbench b/dbench index bb42cc06..06ca10a4 100644 --- a/dbench +++ b/dbench @@ -1,18 +1,18 @@ #!/bin/bash function usage { - echo "Usage: dbench [-had [sitename] | --init [-ed] [sitename] | --setup [-d] | --start [-b] | -c \"\"]" + echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start [-b] | -c \"\"]" echo '' echo 'where:' echo ' -h show this help text' + echo ' -c send a command to the frappe container' echo ' -d [sitename] enables developer mode for specified site' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' - echo ' -c send a command to the frappe container' echo ' --setup [-d] builds docker containers, NOTE: assumes you have docker installed' echo ' -d start up docker containers as well' echo ' --start [-b] starts frappe docker' echo ' -b starts bench as well' - echo ' --init [-ed] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' + echo ' --init [-e | -d] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' echo ' -e initializes frappe-bench and installs erpnext' echo ' -d initializes frappe-bench and enables developer mode' } @@ -35,7 +35,7 @@ if [[ $# -eq 0 ]]; then echo "entering container" docker exec -it frappe bash -elif [ "$1" == '--init' ]; then +elif [ $1 == '--init' ]; then site=$3 if [ -z "$3" ]; then site="site1.local" @@ -46,25 +46,21 @@ elif [ "$1" == '--init' ]; then site=$2 fi echo "$site" - frappe_installer $site - while getopts :ed: option; do - case "$option" in - e) - echo "installing erpnext" - docker exec -it frappe bash -c "bench get-app erpnext" - docker exec -it frappe bash -c "bench --site $site install-app erpnext" - echo "finished" - ;; - d) - docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" - ;; - *) - echo "Invalid option: -$OPTARG" >&2 - usage - exit 1 - ;; - esac - done + frappe_installer "$site" + if [ "$2" == '-e' ]; then + echo "installing erpnext" + docker exec -it frappe bash -c "bench get-app erpnext" + docker exec -it frappe bash -c "bench --site $site install-app erpnext" + echo "finished" + elif [ "$2" == '-d' ]; then + docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + elif [ "$2" == '-ed' ]; then + echo "installing erpnext" + docker exec -it frappe bash -c "bench get-app erpnext" + docker exec -it frappe bash -c "bench --site $site install-app erpnext" + docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + echo "finished" + fi elif [ "$1" == '--setup' ]; then docker-compose build From 182be6152e9f9291b8e98ce456aecb58edfa33f6 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 15:12:52 -0700 Subject: [PATCH 068/108] setting up getopt --- dbench | 110 +++++++++++++++------------------------------------ dbench.bak | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+), 79 deletions(-) create mode 100644 dbench.bak diff --git a/dbench b/dbench index 06ca10a4..b90f5d65 100644 --- a/dbench +++ b/dbench @@ -1,18 +1,24 @@ #!/bin/bash +options=$(getopt -o hd:ac: --long add,help,developer:,setup::,start::,init:: -- "$@") +[ $? -eq 0 ] || { + echo "entering container" + docker exec -it frappe bash +} + function usage { echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start [-b] | -c \"\"]" echo '' echo 'where:' echo ' -h show this help text' - echo ' -c send a command to the frappe container' + echo ' -c command send a command to bench in the container' echo ' -d [sitename] enables developer mode for specified site' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' echo ' --setup [-d] builds docker containers, NOTE: assumes you have docker installed' echo ' -d start up docker containers as well' echo ' --start [-b] starts frappe docker' echo ' -b starts bench as well' - echo ' --init [-e | -d] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' + echo ' --init [-ed] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' echo ' -e initializes frappe-bench and installs erpnext' echo ' -d initializes frappe-bench and enables developer mode' } @@ -31,83 +37,29 @@ function frappe_installer { echo "$1 added" } -if [[ $# -eq 0 ]]; then - echo "entering container" - docker exec -it frappe bash - -elif [ $1 == '--init' ]; then - site=$3 - if [ -z "$3" ]; then - site="site1.local" - fi - if [ -z "$2" ]; then - site="site1.local" - else - site=$2 - fi - echo "$site" - frappe_installer "$site" - if [ "$2" == '-e' ]; then - echo "installing erpnext" - docker exec -it frappe bash -c "bench get-app erpnext" - docker exec -it frappe bash -c "bench --site $site install-app erpnext" - echo "finished" - elif [ "$2" == '-d' ]; then - docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" - elif [ "$2" == '-ed' ]; then - echo "installing erpnext" - docker exec -it frappe bash -c "bench get-app erpnext" - docker exec -it frappe bash -c "bench --site $site install-app erpnext" - docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" - echo "finished" - fi - -elif [ "$1" == '--setup' ]; then - docker-compose build - if [ "$2" == '-d' ]; then - docker-compose up -d - else - docker-compose up - fi -elif [ "$1" == '--start' ]; then - docker-compose start - ./dbench -a - if [ "$2" == '-b' ]; then - docker exec -i frappe bash -c "bench start" - fi - -else - while getopts ':hadc:' option; do - case "$option" in - h) - display_usage - exit - ;; - a) - a=$(docker exec -i frappe bash -c "cd ~/frappe-bench && ls sites/*/site_config.json" | grep -o '/.\+/') - a="${a//$'\n'/ }" - a=$(echo $a | tr -d / ) - result="127.0.0.1 ${a}" - echo $result - docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts" - docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" - ;; - d) - docker exec -it -u root frappe bash -c "bench --site $OPTARG set-config \"developer_mode\" 1 && bench clear-cache" +eval set -- "$options" +while true; do + case "$1" in + -h | --help) + usage + ;; + -a | --add) + a=$(docker exec -i frappe bash -c "cd ~/frappe-bench && ls sites/*/site_config.json" | grep -o '/.\+/') + a="${a//$'\n'/ }" + a=$(echo "$a" | tr -d / ) + result="127.0.0.1 ${a}" + echo "$result" + docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts" + docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" + ;; + -d | --developer) + shift; # The arg is next in position args + docker exec -it -u root frappe bash -c "bench --site $$ set-config \"developer_mode\" 1 && bench clear-cache" ;; - c) - docker exec -it -u root frappe bash -c "bench $OPTARG" - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - usage - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument." >&2 - usage - exit 1 + --) + shift + break ;; esac - done -fi + shift +done \ No newline at end of file diff --git a/dbench.bak b/dbench.bak new file mode 100644 index 00000000..06ca10a4 --- /dev/null +++ b/dbench.bak @@ -0,0 +1,113 @@ +#!/bin/bash + +function usage { + echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start [-b] | -c \"\"]" + echo '' + echo 'where:' + echo ' -h show this help text' + echo ' -c send a command to the frappe container' + echo ' -d [sitename] enables developer mode for specified site' + echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' + echo ' --setup [-d] builds docker containers, NOTE: assumes you have docker installed' + echo ' -d start up docker containers as well' + echo ' --start [-b] starts frappe docker' + echo ' -b starts bench as well' + echo ' --init [-e | -d] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' + echo ' -e initializes frappe-bench and installs erpnext' + echo ' -d initializes frappe-bench and enables developer mode' +} + +function frappe_installer { + echo "starting frappe_docker setup" + docker exec -i -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" + docker exec -it frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" + docker exec -it frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" + echo "frappe-bench folder setup" + docker exec -it -u root frappe bash -c "apt-get install vim -y && apt-get install sudo -y && usermod -aG sudo frappe && printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" + echo "adding $1" + docker exec -it frappe bash -c "bench new-site $1" + docker exec -i -u root frappe bash -c "echo 127.0.0.1 $1 >> /etc/hosts" + sudo su -c 'echo 127.0.0.1 $1 >> /etc/hosts' + echo "$1 added" +} + +if [[ $# -eq 0 ]]; then + echo "entering container" + docker exec -it frappe bash + +elif [ $1 == '--init' ]; then + site=$3 + if [ -z "$3" ]; then + site="site1.local" + fi + if [ -z "$2" ]; then + site="site1.local" + else + site=$2 + fi + echo "$site" + frappe_installer "$site" + if [ "$2" == '-e' ]; then + echo "installing erpnext" + docker exec -it frappe bash -c "bench get-app erpnext" + docker exec -it frappe bash -c "bench --site $site install-app erpnext" + echo "finished" + elif [ "$2" == '-d' ]; then + docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + elif [ "$2" == '-ed' ]; then + echo "installing erpnext" + docker exec -it frappe bash -c "bench get-app erpnext" + docker exec -it frappe bash -c "bench --site $site install-app erpnext" + docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + echo "finished" + fi + +elif [ "$1" == '--setup' ]; then + docker-compose build + if [ "$2" == '-d' ]; then + docker-compose up -d + else + docker-compose up + fi +elif [ "$1" == '--start' ]; then + docker-compose start + ./dbench -a + if [ "$2" == '-b' ]; then + docker exec -i frappe bash -c "bench start" + fi + +else + while getopts ':hadc:' option; do + case "$option" in + h) + display_usage + exit + ;; + a) + a=$(docker exec -i frappe bash -c "cd ~/frappe-bench && ls sites/*/site_config.json" | grep -o '/.\+/') + a="${a//$'\n'/ }" + a=$(echo $a | tr -d / ) + result="127.0.0.1 ${a}" + echo $result + docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts" + docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" + ;; + d) + docker exec -it -u root frappe bash -c "bench --site $OPTARG set-config \"developer_mode\" 1 && bench clear-cache" + ;; + c) + docker exec -it -u root frappe bash -c "bench $OPTARG" + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + usage + exit 1 + ;; + :) + echo "Option -$OPTARG requires an argument." >&2 + usage + exit 1 + ;; + esac + done +fi From 8266587e9f0ce1a7521df11c74d931fabea6b966 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 15:15:01 -0700 Subject: [PATCH 069/108] fix dockerhub wrong tag --- curl-travis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/curl-travis b/curl-travis index 4a9c7e31..99c96f81 100644 --- a/curl-travis +++ b/curl-travis @@ -1,3 +1,3 @@ #!/bin/bash -curl -H "Content-Type: application/json" --data '{"docker_tag": "env"}' -X POST https://registry.hub.docker.com/u/chabad360/frappe/trigger/$hubkey/ \ No newline at end of file +curl -H "Content-Type: application/json" --data '{"docker_tag": "latest"}' -X POST https://registry.hub.docker.com/u/chabad360/frappe/trigger/$hubkey/ \ No newline at end of file From 60b8eb1922a384925fddb2a5f08dbdeb72d5a45d Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 15:18:54 -0700 Subject: [PATCH 070/108] remove dockerhub from travis, setup dbench more --- curl-travis | 3 --- dbench | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 curl-travis diff --git a/curl-travis b/curl-travis deleted file mode 100644 index 4a9c7e31..00000000 --- a/curl-travis +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -curl -H "Content-Type: application/json" --data '{"docker_tag": "env"}' -X POST https://registry.hub.docker.com/u/chabad360/frappe/trigger/$hubkey/ \ No newline at end of file diff --git a/dbench b/dbench index b90f5d65..bc1b43e9 100644 --- a/dbench +++ b/dbench @@ -54,7 +54,7 @@ while true; do ;; -d | --developer) shift; # The arg is next in position args - docker exec -it -u root frappe bash -c "bench --site $$ set-config \"developer_mode\" 1 && bench clear-cache" + docker exec -it -u root frappe bash -c "bench --site $1 set-config \"developer_mode\" 1 && bench clear-cache" ;; --) shift From cd56e6159e6124c79eddbbe0895b0c22d713bb42 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 15:20:17 -0700 Subject: [PATCH 071/108] remove curl --- .travis.yml | 1 - curl-travis | 3 --- 2 files changed, 4 deletions(-) delete mode 100644 curl-travis diff --git a/.travis.yml b/.travis.yml index 6564c319..a93fa8ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,5 +35,4 @@ script: - docker-compose ps | grep -i redis-socketio - docker-compose ps | grep -i mariadb - python test.py - - ./curl-travis - docker-compose stop \ No newline at end of file diff --git a/curl-travis b/curl-travis deleted file mode 100644 index 99c96f81..00000000 --- a/curl-travis +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -curl -H "Content-Type: application/json" --data '{"docker_tag": "latest"}' -X POST https://registry.hub.docker.com/u/chabad360/frappe/trigger/$hubkey/ \ No newline at end of file From 1581a9eff58734d58b1260d067fe159a5669f65d Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 15:21:02 -0700 Subject: [PATCH 072/108] remove curl from travis --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6564c319..a93fa8ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,5 +35,4 @@ script: - docker-compose ps | grep -i redis-socketio - docker-compose ps | grep -i mariadb - python test.py - - ./curl-travis - docker-compose stop \ No newline at end of file From 36d31df67a39cb1fc286cb10cc15f5139d127946 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 15:56:29 -0700 Subject: [PATCH 073/108] added most args, implemented setup --- dbench | 59 +++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/dbench b/dbench index bc1b43e9..f4ab2979 100644 --- a/dbench +++ b/dbench @@ -1,26 +1,34 @@ #!/bin/bash -options=$(getopt -o hd:ac: --long add,help,developer:,setup::,start::,init:: -- "$@") -[ $? -eq 0 ] || { +if ! options=$(getopt -o hd:ac:e:: --long add,help,developer:,setup::,start::,init:: -- "$@") +then echo "entering container" docker exec -it frappe bash -} +fi + +add=0 +setup=0 +start=0 +init=0 +dev=0 +erp=0 +mangr=0 +site=0 function usage { - echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start [-b] | -c \"\"]" + echo "Usage: dbench [-had sitename | --init [-e] [sitename] | --setup [-d] | --start [-b] | -c \"\"]" echo '' echo 'where:' echo ' -h show this help text' echo ' -c command send a command to bench in the container' - echo ' -d [sitename] enables developer mode for specified site' + echo ' -d sitename enables developer mode for specified site' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' echo ' --setup [-d] builds docker containers, NOTE: assumes you have docker installed' echo ' -d start up docker containers as well' echo ' --start [-b] starts frappe docker' echo ' -b starts bench as well' - echo ' --init [-ed] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' + echo ' --init [-e] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' echo ' -e initializes frappe-bench and installs erpnext' - echo ' -d initializes frappe-bench and enables developer mode' } function frappe_installer { @@ -42,24 +50,33 @@ while true; do case "$1" in -h | --help) usage + exit 0 ;; -a | --add) - a=$(docker exec -i frappe bash -c "cd ~/frappe-bench && ls sites/*/site_config.json" | grep -o '/.\+/') - a="${a//$'\n'/ }" - a=$(echo "$a" | tr -d / ) - result="127.0.0.1 ${a}" - echo "$result" - docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts" - docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" + add=1 ;; -d | --developer) - shift; # The arg is next in position args - docker exec -it -u root frappe bash -c "bench --site $1 set-config \"developer_mode\" 1 && bench clear-cache" - ;; + shift; # The arg is next in position args + dev=1 + site=$optopt + ;; + -c) + docker exec -it frappe bash -c "$optopt" + ;; + --setup) + setup=1 + ;; + --init) + init=1 + site=$optopt + ;; --) - shift - break - ;; + break + ;; esac shift -done \ No newline at end of file +done + +if setup; then + docker-compose +fi \ No newline at end of file From 86755f4a650c0249671f74b2b061c8bba1cfa64b Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 15:57:21 -0700 Subject: [PATCH 074/108] fixed chmod on travis --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a93fa8ab..fccfe49f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,6 @@ before_install: - chmod +x docker-compose - sudo mv docker-compose /usr/local/bin - chmod u+x ./dbench - - chmod u+x ./curl-travis install: - ./dbench --setup -d From 71bb7b340ef71f4414de20e7cb1563723e31288d Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 16:03:25 -0700 Subject: [PATCH 075/108] update travis and start func --- .travis.yml | 2 +- dbench | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index fccfe49f..480a8b47 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ before_install: - chmod u+x ./dbench install: - - ./dbench --setup -d + - ./dbench --setup -u - ./dbench --init - ./dbench --start - pip install --upgrade virtualenv diff --git a/dbench b/dbench index f4ab2979..0741f18a 100644 --- a/dbench +++ b/dbench @@ -1,6 +1,6 @@ #!/bin/bash -if ! options=$(getopt -o hd:ac:e:: --long add,help,developer:,setup::,start::,init:: -- "$@") +if ! options=$(getopt -o hd:ace --long add,help,developer:,setup,start,init -- "$@") then echo "entering container" docker exec -it frappe bash @@ -8,6 +8,7 @@ fi add=0 setup=0 +d=0 start=0 init=0 dev=0 @@ -23,8 +24,8 @@ function usage { echo ' -c command send a command to bench in the container' echo ' -d sitename enables developer mode for specified site' echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' - echo ' --setup [-d] builds docker containers, NOTE: assumes you have docker installed' - echo ' -d start up docker containers as well' + echo ' --setup [-u] builds docker containers, NOTE: assumes you have docker installed' + echo ' -u start up docker containers as well' echo ' --start [-b] starts frappe docker' echo ' -b starts bench as well' echo ' --init [-e] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' @@ -58,11 +59,14 @@ while true; do -d | --developer) shift; # The arg is next in position args dev=1 - site=$optopt + site=$1 ;; -c) docker exec -it frappe bash -c "$optopt" ;; + -u) + d=1 + ;; --setup) setup=1 ;; @@ -78,5 +82,10 @@ while true; do done if setup; then - docker-compose + docker-compose build + if d; then + docker-compose -d + else + docker-compose + fi fi \ No newline at end of file From 949a5051000682d68ea145e9cdf0540c64309abe Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 16:07:45 -0700 Subject: [PATCH 076/108] update dbench to include -u --- dbench | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dbench b/dbench index 0741f18a..0df6f5df 100644 --- a/dbench +++ b/dbench @@ -1,6 +1,6 @@ #!/bin/bash -if ! options=$(getopt -o hd:ace --long add,help,developer:,setup,start,init -- "$@") +if ! options=$(getopt -o hd:aceu --long add,help,developer:,setup,start,init -- "$@") then echo "entering container" docker exec -it frappe bash @@ -88,4 +88,12 @@ if setup; then else docker-compose fi + exit 0 +fi + +if init; then + if ! site; then + site="site1.local" + fi + frappe_installer site fi \ No newline at end of file From 4acb2cb6caf6c10a59551b21e9ad16d344a4e2c6 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 16:45:07 -0700 Subject: [PATCH 077/108] fixing missing var tags --- dbench | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dbench b/dbench index 0df6f5df..411afe84 100644 --- a/dbench +++ b/dbench @@ -72,7 +72,7 @@ while true; do ;; --init) init=1 - site=$optopt + site="$optopt" ;; --) break @@ -81,9 +81,9 @@ while true; do shift done -if setup; then +if $setup; then docker-compose build - if d; then + if $d; then docker-compose -d else docker-compose @@ -91,9 +91,9 @@ if setup; then exit 0 fi -if init; then - if ! site; then +if $init; then + if ! $site; then site="site1.local" fi - frappe_installer site + frappe_installer $site fi \ No newline at end of file From 6013270c231ee6ea274e45a502b151bb54f4d11b Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 16:50:33 -0700 Subject: [PATCH 078/108] this should work --- dbench | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dbench b/dbench index 411afe84..d776619f 100644 --- a/dbench +++ b/dbench @@ -81,9 +81,9 @@ while true; do shift done -if $setup; then +if [ $setup == 1 ]; then docker-compose build - if $d; then + if [ $d == 1 ]; then docker-compose -d else docker-compose @@ -91,7 +91,7 @@ if $setup; then exit 0 fi -if $init; then +if [ $init == 1 ]; then if ! $site; then site="site1.local" fi From b9e89a7d2f7d0b057116c571fe6b3e07e65f17ce Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 17:03:09 -0700 Subject: [PATCH 079/108] dbench should work for init --- dbench | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/dbench b/dbench index d776619f..f5e53186 100644 --- a/dbench +++ b/dbench @@ -1,6 +1,6 @@ #!/bin/bash -if ! options=$(getopt -o hd:aceu --long add,help,developer:,setup,start,init -- "$@") +if ! options=$(getopt -o hdaceumb --long add,help,developer,setup,start,init -- "$@") then echo "entering container" docker exec -it frappe bash @@ -13,11 +13,13 @@ start=0 init=0 dev=0 erp=0 -mangr=0 +mgr=0 site=0 +bench=0 +initf=0 function usage { - echo "Usage: dbench [-had sitename | --init [-e] [sitename] | --setup [-d] | --start [-b] | -c \"\"]" + echo "Usage: dbench " echo '' echo 'where:' echo ' -h show this help text' @@ -59,7 +61,7 @@ while true; do -d | --developer) shift; # The arg is next in position args dev=1 - site=$1 + site="$optopt" ;; -c) docker exec -it frappe bash -c "$optopt" @@ -67,6 +69,12 @@ while true; do -u) d=1 ;; + -m) + mgr=1 + ;; + -b) + bench=1 + ;; --setup) setup=1 ;; @@ -74,6 +82,9 @@ while true; do init=1 site="$optopt" ;; + --start) + start=1 + ;; --) break ;; @@ -84,9 +95,9 @@ done if [ $setup == 1 ]; then docker-compose build if [ $d == 1 ]; then - docker-compose -d + docker-compose up -d else - docker-compose + docker-compose up fi exit 0 fi @@ -96,4 +107,23 @@ if [ $init == 1 ]; then site="site1.local" fi frappe_installer $site -fi \ No newline at end of file +fi + +if [ $mgr == 1 ]; then + docker exec -it frappe bash -c "bench setup manager" +fi + +if [ $erp == 1 ]; then + echo "installing erpnext" + docker exec -it frappe bash -c "bench get-app erpnext" + docker exec -it frappe bash -c "bench --site $site install-app erpnext" + docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + echo "finished" +fi + +if [ $d == 1 ]; then + docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + exit 0 +fi + +exit 0 \ No newline at end of file From ee3c4147a446cdf8d73e2cfaa8ecb089cdcdf59c Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 17:16:58 -0700 Subject: [PATCH 080/108] added start to dbanch and testing if optopt works --- .travis.yml | 2 +- dbench | 35 +++++++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 480a8b47..83d0be29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ before_install: install: - ./dbench --setup -u - - ./dbench --init + - ./dbench --init site2.local - ./dbench --start - pip install --upgrade virtualenv - virtualenv -p python3 testenv diff --git a/dbench b/dbench index f5e53186..99a2060c 100644 --- a/dbench +++ b/dbench @@ -106,19 +106,34 @@ if [ $init == 1 ]; then if ! $site; then site="site1.local" fi + frappe_installer $site + + if [ $mgr == 1 ]; then + echo "installing bench manager" + docker exec -it frappe bash -c "bench setup manager" + fi + + if [ $erp == 1 ]; then + echo "installing erpnext" + docker exec -it frappe bash -c "bench get-app erpnext" + docker exec -it frappe bash -c "bench --site $site install-app erpnext" + docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + echo "finished" + fi + + if [ $d == 1 ]; then + docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + fi + exit 0 fi -if [ $mgr == 1 ]; then - docker exec -it frappe bash -c "bench setup manager" -fi - -if [ $erp == 1 ]; then - echo "installing erpnext" - docker exec -it frappe bash -c "bench get-app erpnext" - docker exec -it frappe bash -c "bench --site $site install-app erpnext" - docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" - echo "finished" +if [ $start == 1 ]; then + docker-compose start + ./dbench -a + if [ $bench == 1 ]; then + docker exec -it frappe bash -c "bench start" + fi fi if [ $d == 1 ]; then From e6af58086371f7dfecd376a8c2951bee2554d236 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 17:24:19 -0700 Subject: [PATCH 081/108] fixed somethings in init should work now --- dbench | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dbench b/dbench index 99a2060c..9d5fd224 100644 --- a/dbench +++ b/dbench @@ -16,10 +16,9 @@ erp=0 mgr=0 site=0 bench=0 -initf=0 function usage { - echo "Usage: dbench " + echo "Usage: dbench [ --setup [-d] | --init [-med] [sitename] | " echo '' echo 'where:' echo ' -h show this help text' @@ -103,7 +102,7 @@ if [ $setup == 1 ]; then fi if [ $init == 1 ]; then - if ! $site; then + if [ "$site" == 0 ] || [ "$site" == "" ]; then site="site1.local" fi @@ -128,6 +127,14 @@ if [ $init == 1 ]; then exit 0 fi +if [ $d == 1 ]; then + if [ "$site" == 0 ]; then + site="site1.local" + fi + docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + exit 0 +fi + if [ $start == 1 ]; then docker-compose start ./dbench -a From 6bab2b4cf72a96f95dc1bec3fb87e48a881ad06d Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 17:33:48 -0700 Subject: [PATCH 082/108] trying a few other things --- dbench | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dbench b/dbench index 9d5fd224..1bb82f73 100644 --- a/dbench +++ b/dbench @@ -63,7 +63,8 @@ while true; do site="$optopt" ;; -c) - docker exec -it frappe bash -c "$optopt" + shift + docker exec -it frappe bash -c "bench $optarg" ;; -u) d=1 @@ -79,7 +80,7 @@ while true; do ;; --init) init=1 - site="$optopt" + site="$optarg" ;; --start) start=1 From ea945b6917c705af48d2bfaad4e1c06b13b70a29 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 17:47:25 -0700 Subject: [PATCH 083/108] passing optional args nicely in getopt is a pain --- dbench | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dbench b/dbench index 1bb82f73..311b1785 100644 --- a/dbench +++ b/dbench @@ -60,11 +60,11 @@ while true; do -d | --developer) shift; # The arg is next in position args dev=1 - site="$optopt" + site="$1" ;; -c) shift - docker exec -it frappe bash -c "bench $optarg" + docker exec -it frappe bash -c "bench $*" ;; -u) d=1 @@ -80,7 +80,6 @@ while true; do ;; --init) init=1 - site="$optarg" ;; --start) start=1 @@ -92,6 +91,10 @@ while true; do shift done +if [ $site == "" ]; then + site=$1 +fi + if [ $setup == 1 ]; then docker-compose build if [ $d == 1 ]; then From 48e98086f379c0c3e353223b949d9d9effde895d Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 17:57:04 -0700 Subject: [PATCH 084/108] trashing getopt found a better way --- dbench | 72 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/dbench b/dbench index 311b1785..8006bdb5 100644 --- a/dbench +++ b/dbench @@ -1,22 +1,5 @@ #!/bin/bash -if ! options=$(getopt -o hdaceumb --long add,help,developer,setup,start,init -- "$@") -then - echo "entering container" - docker exec -it frappe bash -fi - -add=0 -setup=0 -d=0 -start=0 -init=0 -dev=0 -erp=0 -mgr=0 -site=0 -bench=0 - function usage { echo "Usage: dbench [ --setup [-d] | --init [-med] [sitename] | " echo '' @@ -47,9 +30,25 @@ function frappe_installer { echo "$1 added" } -eval set -- "$options" -while true; do - case "$1" in + +add=0 +setup=0 +d=0 +start=0 +init=0 +dev=0 +erp=0 +mgr=0 +site=0 +bench=0 +cmd=0 + +positional=() + +while [[ $# -gt 0 ]]; do +key="$1" + + case "key" in -h | --help) usage exit 0 @@ -58,13 +57,10 @@ while true; do add=1 ;; -d | --developer) - shift; # The arg is next in position args dev=1 - site="$1" ;; -c) - shift - docker exec -it frappe bash -c "bench $*" + cmd=1 ;; -u) d=1 @@ -84,16 +80,14 @@ while true; do --start) start=1 ;; - --) - break + *) + positional+="$key" ;; esac shift done - -if [ $site == "" ]; then - site=$1 -fi +set -- "${POSITIONAL[@]}" +site="$1" if [ $setup == 1 ]; then docker-compose build @@ -106,9 +100,6 @@ if [ $setup == 1 ]; then fi if [ $init == 1 ]; then - if [ "$site" == 0 ] || [ "$site" == "" ]; then - site="site1.local" - fi frappe_installer $site @@ -152,4 +143,19 @@ if [ $d == 1 ]; then exit 0 fi +if [ $cmd == 1 ]; then + docker exec -it frappe bash -c "bench $*" + exit 0 +fi + +if [ $add == 1 ]; then + a=$(docker exec -i frappe bash -c "cd ~/frappe-bench && ls sites/*/site_config.json" | grep -o '/.\+/') + a="${a//$'\n'/ }" + a=$(echo $a | tr -d / ) + result="127.0.0.1 ${a}" + echo $result + docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts" + docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" + +fi exit 0 \ No newline at end of file From c5daea64ad5961e5465ac13269fb95234e657c33 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 18:00:02 -0700 Subject: [PATCH 085/108] one small typo screwed everything --- dbench | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbench b/dbench index 8006bdb5..e1354b49 100644 --- a/dbench +++ b/dbench @@ -48,7 +48,7 @@ positional=() while [[ $# -gt 0 ]]; do key="$1" - case "key" in + case "$key" in -h | --help) usage exit 0 From 56cf9f546c62db6338d65a045eb99a235552c43f Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 18:19:55 -0700 Subject: [PATCH 086/108] case can be really annoying --- dbench | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dbench b/dbench index e1354b49..aacc1cb2 100644 --- a/dbench +++ b/dbench @@ -33,7 +33,7 @@ function frappe_installer { add=0 setup=0 -d=0 +up=0 start=0 init=0 dev=0 @@ -63,7 +63,7 @@ key="$1" cmd=1 ;; -u) - d=1 + up=1 ;; -m) mgr=1 @@ -86,12 +86,13 @@ key="$1" esac shift done -set -- "${POSITIONAL[@]}" +set -- "${positional[@]}" + site="$1" if [ $setup == 1 ]; then docker-compose build - if [ $d == 1 ]; then + if [ $up == 1 ]; then docker-compose up -d else docker-compose up @@ -116,7 +117,7 @@ if [ $init == 1 ]; then echo "finished" fi - if [ $d == 1 ]; then + if [ $dev == 1 ]; then docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" fi exit 0 From 3502f053e9d4086d0197f66852ac01ae72c3f9e8 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 18:31:03 -0700 Subject: [PATCH 087/108] gonna push it --- .travis.yml | 4 ++-- dbench | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83d0be29..aad56f39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,11 +16,11 @@ before_install: - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose - chmod +x docker-compose - sudo mv docker-compose /usr/local/bin - - chmod u+x ./dbench + - chmod ugo+x ./dbench install: - ./dbench --setup -u - - ./dbench --init site2.local + - ./dbench --init -med - ./dbench --start - pip install --upgrade virtualenv - virtualenv -p python3 testenv diff --git a/dbench b/dbench index aacc1cb2..bfcb6940 100644 --- a/dbench +++ b/dbench @@ -81,7 +81,7 @@ key="$1" start=1 ;; *) - positional+="$key" + positional+=("$key") ;; esac shift From 7588546871e53151272c95a497dde00c43769da6 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 18:32:22 -0700 Subject: [PATCH 088/108] small recomendation from shellcheck --- dbench | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbench b/dbench index bfcb6940..33c6965b 100644 --- a/dbench +++ b/dbench @@ -102,7 +102,7 @@ fi if [ $init == 1 ]; then - frappe_installer $site + frappe_installer "$site" if [ $mgr == 1 ]; then echo "installing bench manager" From a2ce6c729ae07c6bddb20ad4744eee9971ed8a39 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 18:37:37 -0700 Subject: [PATCH 089/108] making a few fixes --- dbench | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dbench b/dbench index 33c6965b..28e71cb9 100644 --- a/dbench +++ b/dbench @@ -123,7 +123,7 @@ if [ $init == 1 ]; then exit 0 fi -if [ $d == 1 ]; then +if [ $dev == 1 ]; then if [ "$site" == 0 ]; then site="site1.local" fi @@ -139,7 +139,7 @@ if [ $start == 1 ]; then fi fi -if [ $d == 1 ]; then +if [ $dev == 1 ]; then docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" exit 0 fi @@ -152,9 +152,9 @@ fi if [ $add == 1 ]; then a=$(docker exec -i frappe bash -c "cd ~/frappe-bench && ls sites/*/site_config.json" | grep -o '/.\+/') a="${a//$'\n'/ }" - a=$(echo $a | tr -d / ) + a=$(echo "$a" | tr -d / ) result="127.0.0.1 ${a}" - echo $result + echo "$result" docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts" docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" From 2aabd6b45ae446540390676484f1014d97494519 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 18:46:27 -0700 Subject: [PATCH 090/108] screwred up travis should build now --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index aad56f39..c755b13e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ before_install: install: - ./dbench --setup -u - - ./dbench --init -med + - ./dbench --init -m -e -d - ./dbench --start - pip install --upgrade virtualenv - virtualenv -p python3 testenv From 89f30954c80125f25e2c6da1a0c7c28ddb53e66e Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 19:00:39 -0700 Subject: [PATCH 091/108] ready for release --- .travis.yml | 2 +- dbench | 3 ++ dbench.bak | 113 ---------------------------------------------------- 3 files changed, 4 insertions(+), 114 deletions(-) delete mode 100644 dbench.bak diff --git a/.travis.yml b/.travis.yml index c755b13e..89706128 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ before_install: install: - ./dbench --setup -u - - ./dbench --init -m -e -d + - ./dbench --init - ./dbench --start - pip install --upgrade virtualenv - virtualenv -p python3 testenv diff --git a/dbench b/dbench index 28e71cb9..0ab5dbba 100644 --- a/dbench +++ b/dbench @@ -62,6 +62,9 @@ key="$1" -c) cmd=1 ;; + -e) + erp=1 + ;; -u) up=1 ;; diff --git a/dbench.bak b/dbench.bak deleted file mode 100644 index 06ca10a4..00000000 --- a/dbench.bak +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash - -function usage { - echo "Usage: dbench [-hda [sitename] | --init [-ed] [sitename] | --setup [-d] | --start [-b] | -c \"\"]" - echo '' - echo 'where:' - echo ' -h show this help text' - echo ' -c send a command to the frappe container' - echo ' -d [sitename] enables developer mode for specified site' - echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' - echo ' --setup [-d] builds docker containers, NOTE: assumes you have docker installed' - echo ' -d start up docker containers as well' - echo ' --start [-b] starts frappe docker' - echo ' -b starts bench as well' - echo ' --init [-e | -d] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' - echo ' -e initializes frappe-bench and installs erpnext' - echo ' -d initializes frappe-bench and enables developer mode' -} - -function frappe_installer { - echo "starting frappe_docker setup" - docker exec -i -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" - docker exec -it frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" - docker exec -it frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" - echo "frappe-bench folder setup" - docker exec -it -u root frappe bash -c "apt-get install vim -y && apt-get install sudo -y && usermod -aG sudo frappe && printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" - echo "adding $1" - docker exec -it frappe bash -c "bench new-site $1" - docker exec -i -u root frappe bash -c "echo 127.0.0.1 $1 >> /etc/hosts" - sudo su -c 'echo 127.0.0.1 $1 >> /etc/hosts' - echo "$1 added" -} - -if [[ $# -eq 0 ]]; then - echo "entering container" - docker exec -it frappe bash - -elif [ $1 == '--init' ]; then - site=$3 - if [ -z "$3" ]; then - site="site1.local" - fi - if [ -z "$2" ]; then - site="site1.local" - else - site=$2 - fi - echo "$site" - frappe_installer "$site" - if [ "$2" == '-e' ]; then - echo "installing erpnext" - docker exec -it frappe bash -c "bench get-app erpnext" - docker exec -it frappe bash -c "bench --site $site install-app erpnext" - echo "finished" - elif [ "$2" == '-d' ]; then - docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" - elif [ "$2" == '-ed' ]; then - echo "installing erpnext" - docker exec -it frappe bash -c "bench get-app erpnext" - docker exec -it frappe bash -c "bench --site $site install-app erpnext" - docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" - echo "finished" - fi - -elif [ "$1" == '--setup' ]; then - docker-compose build - if [ "$2" == '-d' ]; then - docker-compose up -d - else - docker-compose up - fi -elif [ "$1" == '--start' ]; then - docker-compose start - ./dbench -a - if [ "$2" == '-b' ]; then - docker exec -i frappe bash -c "bench start" - fi - -else - while getopts ':hadc:' option; do - case "$option" in - h) - display_usage - exit - ;; - a) - a=$(docker exec -i frappe bash -c "cd ~/frappe-bench && ls sites/*/site_config.json" | grep -o '/.\+/') - a="${a//$'\n'/ }" - a=$(echo $a | tr -d / ) - result="127.0.0.1 ${a}" - echo $result - docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts" - docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" - ;; - d) - docker exec -it -u root frappe bash -c "bench --site $OPTARG set-config \"developer_mode\" 1 && bench clear-cache" - ;; - c) - docker exec -it -u root frappe bash -c "bench $OPTARG" - ;; - \?) - echo "Invalid option: -$OPTARG" >&2 - usage - exit 1 - ;; - :) - echo "Option -$OPTARG requires an argument." >&2 - usage - exit 1 - ;; - esac - done -fi From 9a974b0c9f07e250f72fd571491d66a2a48adf01 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 19:24:22 -0700 Subject: [PATCH 092/108] updated dbench and docs --- dbench | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/dbench b/dbench index 0ab5dbba..69562596 100644 --- a/dbench +++ b/dbench @@ -1,19 +1,20 @@ #!/bin/bash function usage { - echo "Usage: dbench [ --setup [-d] | --init [-med] [sitename] | " + echo "Usage: $(basename "$0") [ --setup [-u] | --init [-m -e -d] [sitename] | --start [-b] | -h (--help) | -d (--developer) [sitename] | -a (--add) | -c \"Command to be sent to Frappe Bench on Docker\"" echo '' echo 'where:' - echo ' -h show this help text' - echo ' -c command send a command to bench in the container' - echo ' -d sitename enables developer mode for specified site' - echo ' -a adds site-names to /etc/hosts file in the container to facilitate multisite access' + echo ' dbench loads up container' + echo ' -c "command" send a command to bench in the container' + echo ' -h | --help show this help text' + echo ' -d | --developer [sitename] enables developer mode for "sitename" (if not specified, it will default to site1.local)' + echo ' -a | --add adds site-names to /etc/hosts file in the container to facilitate multisite access' echo ' --setup [-u] builds docker containers, NOTE: assumes you have docker installed' echo ' -u start up docker containers as well' + echo ' --init [-m -e -d] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' + echo ' -e initializes frappe-bench and installs erpnext' echo ' --start [-b] starts frappe docker' echo ' -b starts bench as well' - echo ' --init [-e] [sitename] initializes frappe-bench in docker and adds a site "sitename" (if not specified, it will default to site1.local)' - echo ' -e initializes frappe-bench and installs erpnext' } function frappe_installer { @@ -45,6 +46,11 @@ cmd=0 positional=() +if ! $key1; then + docker exec -it frappe bash + exit 0 +fi + while [[ $# -gt 0 ]]; do key="$1" @@ -140,6 +146,7 @@ if [ $start == 1 ]; then if [ $bench == 1 ]; then docker exec -it frappe bash -c "bench start" fi + exit 0 fi if [ $dev == 1 ]; then @@ -160,6 +167,13 @@ if [ $add == 1 ]; then echo "$result" docker exec -u root -i frappe bash -c "echo ${result} | tee --append /etc/hosts" docker exec -itu root frappe bash -c "printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" - + exit 0 fi + +if $*; then + echo "Incorrect option $*, please make sure you are entering the correct commands" + usage + exit 1 +fi + exit 0 \ No newline at end of file From a427d525295c14717a46a870ab174704775c7960 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 19:26:07 -0700 Subject: [PATCH 093/108] fixed site not defualted --- dbench | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dbench b/dbench index 69562596..32ab65b8 100644 --- a/dbench +++ b/dbench @@ -98,6 +98,10 @@ done set -- "${positional[@]}" site="$1" +if ! $1; then + site="site1.local" +fi + if [ $setup == 1 ]; then docker-compose build From 3c4bf6e396a99935ed3f4b90061f64fb036b66e6 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 20:12:12 -0700 Subject: [PATCH 094/108] pehaps this should fix it --- dbench | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbench b/dbench index 32ab65b8..5dd85ce0 100644 --- a/dbench +++ b/dbench @@ -98,7 +98,7 @@ done set -- "${positional[@]}" site="$1" -if ! $1; then +if [ -z "$1" ]; then site="site1.local" fi From a32fc1b7ecbfdbc3ea0d71ed88021f26e50d7306 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 20:44:42 -0700 Subject: [PATCH 095/108] this should ensure that if no args open docker --- dbench | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbench b/dbench index 5dd85ce0..949c0b9f 100644 --- a/dbench +++ b/dbench @@ -46,7 +46,7 @@ cmd=0 positional=() -if ! $key1; then +if [[ $# -gt 0 ]]; then docker exec -it frappe bash exit 0 fi From 497e429a3c748590cf4d5b5658906de9b851643f Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 20:52:01 -0700 Subject: [PATCH 096/108] added curl-travis to master --- .travis.yml | 4 +++- curl-travis | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 curl-travis diff --git a/.travis.yml b/.travis.yml index 89706128..704faac8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,7 @@ before_install: - chmod +x docker-compose - sudo mv docker-compose /usr/local/bin - chmod ugo+x ./dbench + - chmod ugo+x ./curl-travis install: - ./dbench --setup -u @@ -34,4 +35,5 @@ script: - docker-compose ps | grep -i redis-socketio - docker-compose ps | grep -i mariadb - python test.py - - docker-compose stop \ No newline at end of file + - docker-compose stop + - ./curl-travis \ No newline at end of file diff --git a/curl-travis b/curl-travis new file mode 100644 index 00000000..99c96f81 --- /dev/null +++ b/curl-travis @@ -0,0 +1,3 @@ +#!/bin/bash + +curl -H "Content-Type: application/json" --data '{"docker_tag": "latest"}' -X POST https://registry.hub.docker.com/u/chabad360/frappe/trigger/$hubkey/ \ No newline at end of file From a415c3c15322bc46ba5256a43f410e7570736aa1 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 20:57:17 -0700 Subject: [PATCH 097/108] updated README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a6a9281a..4fd79d1f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # frappe_docker -| `latest` | `env` | `frappe-dev` | -|:--------:|:-----:|:------------:| -| [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=frappe)](https://travis-ci.org/frappe/frappe_docker) | [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=master)](https://travis-ci.org/frappe/frappe_docker) |[![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=frappe-dev)](https://travis-ci.org/frappe/frappe_docker) | +| `latest` | `preview` | +|:--------:|:-----:| +| [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=master)](https://travis-ci.org/frappe/frappe_docker) | [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=develop)](https://travis-ci.org/frappe/frappe_docker) | - [Docker](https://docker.com/) is an open source project to pack, ship and run any Linux application in a lighter weight, faster container than a traditional virtual machine. @@ -35,7 +35,7 @@ ports: - "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_port]])|():[/udp]` as defined in the [docker port binding documentation](http://docs.docker.com/userguide/dockerlinks/). The port 3307 of the mariadb container and port 8000 of the frappe container is exposed to the host machine and other containers. +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_port]])|():[/udp]` as defined in the [docker port binding documentation](http://docs.docker.com/userguide/dockerlinks/). The port `3307` of the mariadb container and port `8000` of the frappe container is exposed to the host machine and other containers. #### Volumes @@ -97,7 +97,7 @@ Express dependency between services, which has two effects: 1. Build and start the 5 linked containers frappe, mariadb, redis-cache, redis-queue and redis-socketio using this command. - ./dbench --setup -d + ./dbench --setup -u 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](https://github.com/frappe/bench) @@ -126,7 +126,7 @@ For more info on how to build this docker container refer to this [Wiki](https:/ To login to Frappe / ERPNext, open your browser and go to `[your-external-ip]:8000`, or `localhost:8000` -The default username is "Administrator" and password is what you set when you created the new site. The default admin password is set in common_site_config.json, and is set to 'admin' in this docker image. +The default username is `Administrator` and password is what you set when you created the new site. The default admin password is set in `common_site_config.json`, and is set to `admin` in this docker image. ## Built With From 7f323a2da185bd37d3950e7014dc7dbdbf3c8a30 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 21:01:09 -0700 Subject: [PATCH 098/108] hotfix --- dbench | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbench b/dbench index 949c0b9f..2286f9a1 100644 --- a/dbench +++ b/dbench @@ -46,7 +46,7 @@ cmd=0 positional=() -if [[ $# -gt 0 ]]; then +if [ $# == 0 ]; then docker exec -it frappe bash exit 0 fi From a90ad625f94f6a904c3bd3304e84a259b610b3d0 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 2 Aug 2018 21:04:32 -0700 Subject: [PATCH 099/108] small fix --- dbench | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbench b/dbench index 2286f9a1..a10ca339 100644 --- a/dbench +++ b/dbench @@ -174,7 +174,7 @@ if [ $add == 1 ]; then exit 0 fi -if $*; then +if "$*"; then echo "Incorrect option $*, please make sure you are entering the correct commands" usage exit 1 From 870de30fb876d3be1ed89d0d88e496ef281dcfaf Mon Sep 17 00:00:00 2001 From: chabad360 Date: Fri, 3 Aug 2018 09:26:04 -0700 Subject: [PATCH 100/108] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4fd79d1f..182a2fda 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ | `latest` | `preview` | |:--------:|:-----:| -| [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=master)](https://travis-ci.org/frappe/frappe_docker) | [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=develop)](https://travis-ci.org/frappe/frappe_docker) | +| [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=master)](https://travis-ci.org/chabad360/frappe_docker) | [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=develop)](https://travis-ci.org/chabad360/frappe_docker) | - [Docker](https://docker.com/) is an open source project to pack, ship and run any Linux application in a lighter weight, faster container than a traditional virtual machine. From 4768acc5c2fa872a09f01c096ea9c0f381ae177d Mon Sep 17 00:00:00 2001 From: chabad360 Date: Fri, 3 Aug 2018 16:16:05 -0700 Subject: [PATCH 101/108] Updated readme [skip ci] --- README.md | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 182a2fda..742121d9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # frappe_docker -| `latest` | `preview` | -|:--------:|:-----:| +| `latest` | `develop` | +|:--------:|:---------:| | [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=master)](https://travis-ci.org/chabad360/frappe_docker) | [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=develop)](https://travis-ci.org/chabad360/frappe_docker) | - [Docker](https://docker.com/) is an open source project to pack, ship and run any Linux application in a lighter weight, faster container than a traditional virtual machine. @@ -74,9 +74,9 @@ depends_on: Express dependency between services, which has two effects: -1. `docker-compose up -d` will start services in dependency order. In the following example, mariadb and redis will be started before frappe. +1. `docker-compose up -d` 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 SERVICE’s dependencies. In the following example, `docker-compose up -d frappe` will also create and start mariadb and redis. +2. `docker-compose up SERVICE` will automatically include `SERVICE`’s dependencies. In the following example, `docker-compose up -d frappe` will also create and start MariaDB and Redis. ### Installation @@ -86,11 +86,11 @@ Express dependency between services, which has two effects: - Install [Docker Compose](https://docs.docker.com/compose/install/) (only for Linux users). Docker for Mac, Docker for Windows, and Docker Toolbox include Docker Compose -#### 2. Build the container and install bench +#### 2. Build the container - Clone this repo and change your working directory to frappe_docker - git clone --depth 1 https://github.com/frappe/frappe_docker.git + git clone --depth 1 https://github.com/chabad360/frappe_docker.git cd frappe_docker - Build the container and install bench inside the container. @@ -104,9 +104,7 @@ Express dependency between services, which has two effects: Note: Please do not remove the bench-repo directory the above commands will create -#### Basic Usage - -##### Make sure your current directory is frappe_docker +#### 3. Install and Start Bench 1. First time setup @@ -120,9 +118,9 @@ Express dependency between services, which has two effects: ./dbench -4. All bench commands can also be directly run from the host machine by using `dbench`. For instance `bench start` can be executed by running `./dbench -c start`. Just preface the option with `./dbench -c`. For more information on `dbench` run the command `./dbench -h`. +- All bench commands can also be directly run from the host machine by using `dbench`. For instance `bench start` can be executed by running `./dbench -c start`. Just preface the option with `./dbench -c`. For more information on `dbench` run the command `./dbench -h`. -For more info on how to build this docker container refer to this [Wiki](https://github.com/chabad360/frappe_docker/wiki/Hitchhiker's-guide-to-building-this-frappe_docker-image) +For more info on how to build this docker container refer to this [Wiki](https://github.com/chabad360/frappe_docker/wiki/First-Timers-Manual) To login to Frappe / ERPNext, open your browser and go to `[your-external-ip]:8000`, or `localhost:8000` From 235c3a9379db0d52504870b9a099f76ffa67506e Mon Sep 17 00:00:00 2001 From: chabad360 Date: Sun, 5 Aug 2018 17:19:59 -0700 Subject: [PATCH 102/108] Update .travis.yml --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 704faac8..55247ae9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ python: env: - DOCKER_COMPOSE_VERSION: 1.8.0 + - ARCH=arm services: - docker @@ -36,4 +37,4 @@ script: - docker-compose ps | grep -i mariadb - python test.py - docker-compose stop - - ./curl-travis \ No newline at end of file + - ./curl-travis From e1702538b7b95b009cec7b383f707313bd4f64a6 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Sun, 5 Aug 2018 17:23:27 -0700 Subject: [PATCH 103/108] Update .travis.yml --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 55247ae9..ee31cd49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ python: env: - DOCKER_COMPOSE_VERSION: 1.8.0 - - ARCH=arm services: - docker From 6d24bb5acf3b95ce3b5744da3fbaf0e1c1cbe87e Mon Sep 17 00:00:00 2001 From: chabad360 Date: Sun, 5 Aug 2018 21:54:06 -0700 Subject: [PATCH 104/108] Update .travis.yml --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ee31cd49..5caa594a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,4 +36,3 @@ script: - docker-compose ps | grep -i mariadb - python test.py - docker-compose stop - - ./curl-travis From 157928a117a38527761c61372b1d8257033ad432 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Sun, 5 Aug 2018 21:56:22 -0700 Subject: [PATCH 105/108] Update .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 5caa594a..ee31cd49 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,3 +36,4 @@ script: - docker-compose ps | grep -i mariadb - python test.py - docker-compose stop + - ./curl-travis From a3b96c311f047bdeae61fb483de12346e4b97cf8 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 8 Aug 2018 09:55:38 -0700 Subject: [PATCH 106/108] Update dbench --- dbench | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dbench b/dbench index a10ca339..dec6eb63 100644 --- a/dbench +++ b/dbench @@ -20,12 +20,12 @@ function usage { function frappe_installer { echo "starting frappe_docker setup" docker exec -i -u root frappe bash -c "cd /home/frappe && chown -R frappe:frappe ./*" - docker exec -it frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" - docker exec -it frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" + docker exec -i frappe bash -c "cd .. && bench init frappe-bench --ignore-exist --skip-redis-config-generation && cd frappe-bench" + docker exec -i frappe bash -c "mv Procfile_docker Procfile && mv sites/common_site_config_docker.json sites/common_site_config.json" echo "frappe-bench folder setup" - docker exec -it -u root frappe bash -c "apt-get install vim -y && apt-get install sudo -y && usermod -aG sudo frappe && printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" + docker exec -i -u root frappe bash -c "apt-get install vim -y && apt-get install sudo -y && usermod -aG sudo frappe && printf '# User rules for frappe\nfrappe ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/frappe" echo "adding $1" - docker exec -it frappe bash -c "bench new-site $1" + docker exec -i frappe bash -c "bench new-site $1" docker exec -i -u root frappe bash -c "echo 127.0.0.1 $1 >> /etc/hosts" sudo su -c 'echo 127.0.0.1 $1 >> /etc/hosts' echo "$1 added" @@ -124,9 +124,9 @@ if [ $init == 1 ]; then if [ $erp == 1 ]; then echo "installing erpnext" - docker exec -it frappe bash -c "bench get-app erpnext" - docker exec -it frappe bash -c "bench --site $site install-app erpnext" - docker exec -it -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" + docker exec -i frappe bash -c "bench get-app erpnext" + docker exec -i frappe bash -c "bench --site $site install-app erpnext" + docker exec -i -u root frappe bash -c "bench --site $site set-config \"developer_mode\" 1 && bench clear-cache" echo "finished" fi @@ -180,4 +180,4 @@ if "$*"; then exit 1 fi -exit 0 \ No newline at end of file +exit 0 From 3ba45bac5398f597356b7a70194095ddb099e161 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 9 Aug 2018 15:40:41 -0700 Subject: [PATCH 107/108] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 742121d9..b2375603 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # frappe_docker -| `latest` | `develop` | -|:--------:|:---------:| -| [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=master)](https://travis-ci.org/chabad360/frappe_docker) | [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=develop)](https://travis-ci.org/chabad360/frappe_docker) | +| `latest` | `develop` | `arm` | +|:--------:|:---------:|:-----:| +| [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=master)](https://travis-ci.org/chabad360/frappe_docker) | [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=develop)](https://travis-ci.org/chabad360/frappe_docker) || [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=arm)](https://travis-ci.org/chabad360/frappe_docker) | - [Docker](https://docker.com/) is an open source project to pack, ship and run any Linux application in a lighter weight, faster container than a traditional virtual machine. From 70d0d21f4ff757d330767fb0692fae0b19a787cb Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 9 Aug 2018 15:40:57 -0700 Subject: [PATCH 108/108] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b2375603..4eab4d87 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ | `latest` | `develop` | `arm` | |:--------:|:---------:|:-----:| -| [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=master)](https://travis-ci.org/chabad360/frappe_docker) | [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=develop)](https://travis-ci.org/chabad360/frappe_docker) || [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=arm)](https://travis-ci.org/chabad360/frappe_docker) | +| [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=master)](https://travis-ci.org/chabad360/frappe_docker) | [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=develop)](https://travis-ci.org/chabad360/frappe_docker) | [![Build Status](https://travis-ci.org/chabad360/frappe_docker.svg?branch=arm)](https://travis-ci.org/chabad360/frappe_docker) | - [Docker](https://docker.com/) is an open source project to pack, ship and run any Linux application in a lighter weight, faster container than a traditional virtual machine.