From 177ca58af624daae4bb2385bbbbf819134bc693a Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 4 Mar 2020 02:52:36 +0000 Subject: [PATCH 01/14] add and implement install_app for worker image --- build/common/worker/install_app.sh | 13 +++++++++ build/erpnext-worker/Dockerfile | 45 ++--------------------------- build/erpnext-worker/v11.Dockerfile | 42 ++------------------------- build/erpnext-worker/v12.Dockerfile | 45 ++--------------------------- build/frappe-worker/Dockerfile | 2 ++ build/frappe-worker/v11.Dockerfile | 2 ++ build/frappe-worker/v12.Dockerfile | 2 ++ 7 files changed, 25 insertions(+), 126 deletions(-) create mode 100755 build/common/worker/install_app.sh diff --git a/build/common/worker/install_app.sh b/build/common/worker/install_app.sh new file mode 100755 index 00000000..4717312f --- /dev/null +++ b/build/common/worker/install_app.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +APP_NAME=${1} +APP_REPO=${2} + +cd /home/frappe/frappe-bench/ + +. env/bin/activate + +cd apps + +git clone --depth 1 -o upstream ${APP_REPO} +pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/APP_NAME \ No newline at end of file diff --git a/build/erpnext-worker/Dockerfile b/build/erpnext-worker/Dockerfile index 6d145d8c..88af72f6 100644 --- a/build/erpnext-worker/Dockerfile +++ b/build/erpnext-worker/Dockerfile @@ -1,44 +1,3 @@ -FROM bitnami/python:latest-prod +FROM frappe/frappe-worker:develop -RUN useradd -ms /bin/bash frappe -WORKDIR /home/frappe/frappe-bench -RUN install_packages \ - git \ - wkhtmltopdf \ - mariadb-client \ - gettext-base \ - wget \ - # for PDF - libssl-dev \ - fonts-cantarell \ - xfonts-75dpi \ - xfonts-base \ - # For psycopg2 - libpq-dev \ - build-essential - -# Install wkhtmltox correctly -RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb -RUN dpkg -i wkhtmltox_0.12.5-1.stretch_amd64.deb && rm wkhtmltox_0.12.5-1.stretch_amd64.deb - -RUN mkdir -p apps logs commands - -RUN virtualenv env \ - && . env/bin/activate \ - && cd apps \ - && git clone --depth 1 -o upstream https://github.com/frappe/frappe \ - && git clone --depth 1 -o upstream https://github.com/frappe/erpnext \ - && pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/frappe \ - && pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/erpnext - -COPY build/common/commands/* /home/frappe/frappe-bench/commands/ -COPY build/common/common_site_config.json.template /opt/frappe/common_site_config.json.template - -# Setup docker-entrypoint -COPY build/common/worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh -RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat - -WORKDIR /home/frappe/frappe-bench/sites - -ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["start"] +RUN install_app erpnext https://github.com/frappe/erpnext \ No newline at end of file diff --git a/build/erpnext-worker/v11.Dockerfile b/build/erpnext-worker/v11.Dockerfile index 81a59b63..9f6c9c2a 100644 --- a/build/erpnext-worker/v11.Dockerfile +++ b/build/erpnext-worker/v11.Dockerfile @@ -1,41 +1,3 @@ -FROM bitnami/python:latest-prod +FROM frappe/frappe-worker:v11 -RUN useradd -ms /bin/bash frappe -WORKDIR /home/frappe/frappe-bench -RUN install_packages \ - git \ - wkhtmltopdf \ - mariadb-client \ - gettext-base \ - wget \ - # for PDF - libssl-dev \ - fonts-cantarell \ - xfonts-75dpi \ - xfonts-base - -# Install wkhtmltox correctly -RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb -RUN dpkg -i wkhtmltox_0.12.5-1.stretch_amd64.deb && rm wkhtmltox_0.12.5-1.stretch_amd64.deb - -RUN mkdir -p apps logs commands - -RUN virtualenv env \ - && . env/bin/activate \ - && cd apps \ - && git clone --depth 1 -o upstream https://github.com/frappe/frappe --branch version-11 \ - && git clone --depth 1 -o upstream https://github.com/frappe/erpnext --branch version-11 \ - && pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/frappe \ - && pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/erpnext - -COPY build/common/commands/* /home/frappe/frappe-bench/commands/ -COPY build/common/common_site_config.json.template /opt/frappe/common_site_config.json.template - -# Setup docker-entrypoint -COPY build/common/worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh -RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat - -WORKDIR /home/frappe/frappe-bench/sites - -ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["start"] +RUN install_app erpnext https://github.com/frappe/erpnext \ No newline at end of file diff --git a/build/erpnext-worker/v12.Dockerfile b/build/erpnext-worker/v12.Dockerfile index 3945142a..734e9286 100644 --- a/build/erpnext-worker/v12.Dockerfile +++ b/build/erpnext-worker/v12.Dockerfile @@ -1,44 +1,3 @@ -FROM bitnami/python:latest-prod +FROM frappe/frappe-worker:v12 -RUN useradd -ms /bin/bash frappe -WORKDIR /home/frappe/frappe-bench -RUN install_packages \ - git \ - wkhtmltopdf \ - mariadb-client \ - gettext-base \ - wget \ - # for PDF - libssl-dev \ - fonts-cantarell \ - xfonts-75dpi \ - xfonts-base \ - # For psycopg2 - libpq-dev \ - build-essential - -# Install wkhtmltox correctly -RUN wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.stretch_amd64.deb -RUN dpkg -i wkhtmltox_0.12.5-1.stretch_amd64.deb && rm wkhtmltox_0.12.5-1.stretch_amd64.deb - -RUN mkdir -p apps logs commands - -RUN virtualenv env \ - && . env/bin/activate \ - && cd apps \ - && git clone --depth 1 -o upstream https://github.com/frappe/frappe --branch version-12 \ - && git clone --depth 1 -o upstream https://github.com/frappe/erpnext --branch version-12 \ - && pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/frappe \ - && pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/erpnext - -COPY build/common/commands/* /home/frappe/frappe-bench/commands/ -COPY build/common/common_site_config.json.template /opt/frappe/common_site_config.json.template - -# Setup docker-entrypoint -COPY build/common/worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh -RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat - -WORKDIR /home/frappe/frappe-bench/sites - -ENTRYPOINT ["docker-entrypoint.sh"] -CMD ["start"] +RUN install_app erpnext https://github.com/frappe/erpnext \ No newline at end of file diff --git a/build/frappe-worker/Dockerfile b/build/frappe-worker/Dockerfile index 41310b0d..40ce9c06 100644 --- a/build/frappe-worker/Dockerfile +++ b/build/frappe-worker/Dockerfile @@ -36,6 +36,8 @@ COPY build/common/common_site_config.json.template /opt/frappe/common_site_confi COPY build/common/worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat +COPY build/common/worker/install_app.sh /usr/local/bin/install_app + WORKDIR /home/frappe/frappe-bench/sites ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/build/frappe-worker/v11.Dockerfile b/build/frappe-worker/v11.Dockerfile index fa2f01c5..335eb7a9 100644 --- a/build/frappe-worker/v11.Dockerfile +++ b/build/frappe-worker/v11.Dockerfile @@ -33,6 +33,8 @@ COPY build/common/common_site_config.json.template /opt/frappe/common_site_confi COPY build/common/worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat +COPY build/common/worker/install_app.sh /usr/local/bin/install_app + WORKDIR /home/frappe/frappe-bench/sites ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/build/frappe-worker/v12.Dockerfile b/build/frappe-worker/v12.Dockerfile index 1eb6d60a..2f10db39 100644 --- a/build/frappe-worker/v12.Dockerfile +++ b/build/frappe-worker/v12.Dockerfile @@ -36,6 +36,8 @@ COPY build/common/common_site_config.json.template /opt/frappe/common_site_confi COPY build/common/worker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh RUN ln -s /usr/local/bin/docker-entrypoint.sh / # backwards compat +COPY build/common/worker/install_app.sh /usr/local/bin/install_app + WORKDIR /home/frappe/frappe-bench/sites ENTRYPOINT ["docker-entrypoint.sh"] From b610caba7ead17c30f45832547d459b25ff912b9 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 4 Mar 2020 03:33:23 +0000 Subject: [PATCH 02/14] forgot about branches --- build/common/worker/install_app.sh | 6 +++++- build/erpnext-worker/v11.Dockerfile | 2 +- build/erpnext-worker/v12.Dockerfile | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build/common/worker/install_app.sh b/build/common/worker/install_app.sh index 4717312f..e3b9b629 100755 --- a/build/common/worker/install_app.sh +++ b/build/common/worker/install_app.sh @@ -2,6 +2,7 @@ APP_NAME=${1} APP_REPO=${2} +APP_BRANCH=${3} cd /home/frappe/frappe-bench/ @@ -9,5 +10,8 @@ cd /home/frappe/frappe-bench/ cd apps -git clone --depth 1 -o upstream ${APP_REPO} +[ "${APP_BRANCH}" ] && \ + BRANCH="-b ${APP_BRANCH}" + +git clone --depth 1 -o upstream ${APP_REPO} ${BRANCH} pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/APP_NAME \ No newline at end of file diff --git a/build/erpnext-worker/v11.Dockerfile b/build/erpnext-worker/v11.Dockerfile index 9f6c9c2a..b17c7aaa 100644 --- a/build/erpnext-worker/v11.Dockerfile +++ b/build/erpnext-worker/v11.Dockerfile @@ -1,3 +1,3 @@ FROM frappe/frappe-worker:v11 -RUN install_app erpnext https://github.com/frappe/erpnext \ No newline at end of file +RUN install_app erpnext https://github.com/frappe/erpnext version-11 \ No newline at end of file diff --git a/build/erpnext-worker/v12.Dockerfile b/build/erpnext-worker/v12.Dockerfile index 734e9286..2bade604 100644 --- a/build/erpnext-worker/v12.Dockerfile +++ b/build/erpnext-worker/v12.Dockerfile @@ -1,3 +1,3 @@ FROM frappe/frappe-worker:v12 -RUN install_app erpnext https://github.com/frappe/erpnext \ No newline at end of file +RUN install_app erpnext https://github.com/frappe/erpnext version-12 \ No newline at end of file From f4e24e15a858a0b755aeb20c2c16904f3b08828e Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 4 Mar 2020 03:33:38 +0000 Subject: [PATCH 03/14] create install_app for assets --- build/erpnext-assets/Dockerfile | 38 ++++++---------------------- build/erpnext-assets/install_app.sh | 29 +++++++++++++++++++++ build/erpnext-assets/v11.Dockerfile | 38 ++++++---------------------- build/erpnext-assets/v12.Dockerfile | 39 ++++++----------------------- 4 files changed, 50 insertions(+), 94 deletions(-) create mode 100644 build/erpnext-assets/install_app.sh diff --git a/build/erpnext-assets/Dockerfile b/build/erpnext-assets/Dockerfile index 7fcb2b20..6bec65a0 100644 --- a/build/erpnext-assets/Dockerfile +++ b/build/erpnext-assets/Dockerfile @@ -1,38 +1,14 @@ FROM bitnami/node:12-prod -WORKDIR /home/frappe/frappe-bench -RUN mkdir -p /home/frappe/frappe-bench/sites \ - && echo "frappe\nerpnext" > /home/frappe/frappe-bench/sites/apps.txt +COPY build/erpnext-assets/install_app.sh /install_app -RUN install_packages git python2 +RUN /install_app erpnext https://github.com/frappe/erpnext -RUN mkdir -p apps sites/assets \ - && cd apps \ - && git clone --depth 1 https://github.com/frappe/frappe \ - && git clone --depth 1 https://github.com/frappe/erpnext - -RUN cd /home/frappe/frappe-bench/apps/frappe \ - && yarn \ - && yarn run production \ - && rm -fr node_modules \ - && yarn install --production=true - -RUN git clone --depth 1 https://github.com/frappe/bench /tmp/bench \ - && mkdir -p /var/www/error_pages \ - && cp -r /tmp/bench/bench/config/templates/502.html /var/www/error_pages - -RUN cp -R /home/frappe/frappe-bench/apps/frappe/frappe/public/* /home/frappe/frappe-bench/sites/assets/frappe \ - && cp -R /home/frappe/frappe-bench/apps/frappe/node_modules /home/frappe/frappe-bench/sites/assets/frappe/ \ - && mkdir -p /home/frappe/frappe-bench/sites/assets/erpnext \ - && cp -R /home/frappe/frappe-bench/apps/erpnext/erpnext/public/* /home/frappe/frappe-bench/sites/assets/erpnext - -FROM nginx:latest -COPY --from=0 /home/frappe/frappe-bench/sites /var/www/html/ -COPY --from=0 /var/www/error_pages /var/www/ -COPY build/common/nginx-default.conf.template /etc/nginx/conf.d/default.conf.template -COPY build/erpnext-assets/docker-entrypoint.sh / - -RUN apt-get update && apt-get install -y rsync && apt-get clean +FROM frappe/frappe-assets:develop +RUN cp /home/frappe/frappe-bench/sites/apps.txt /home/frappe/frappe-bench/sites/apps.bak +COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/ +RUN mv /home/frappe/frappe-bench/sites/apps.bak /home/frappe/frappe-bench/sites/apps.txt \ + && echo -n "\nerpnext" >> /home/frappe/frappe-bench/sites/apps.txt VOLUME [ "/assets" ] diff --git a/build/erpnext-assets/install_app.sh b/build/erpnext-assets/install_app.sh new file mode 100644 index 00000000..eefa538a --- /dev/null +++ b/build/erpnext-assets/install_app.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +APP_NAME=${1} +APP_REPO=${2} +APP_BRANCH=${3} + +[ "${APP_BRANCH}" ] && \ + BRANCH="-b ${APP_BRANCH}" + +cd /home/frappe/frappe-bench +mkdir -p /home/frappe/frappe-bench/sites +echo "frappe\n${APP_NAME}" > /home/frappe/frappe-bench/sites/apps.txt + +install_packages git python2 + +mkdir -p apps sites/assets +cd apps +git clone --depth 1 https://github.com/frappe/frappe ${BRANCH} +git clone --depth 1 ${APP_REPO} ${BRANCH} + +cd /home/frappe/frappe-bench/apps/frappe +yarn +yarn production +rm -fr node_modules +yarn install --production=true + +mkdir -p /home/frappe/frappe-bench/sites/assets/${APP_NAME} +cp -R /home/frappe/frappe-bench/apps/${APP_NAME}/${APP_NAME}/public/* /home/frappe/frappe-bench/sites/assets/${APP_NAME} + diff --git a/build/erpnext-assets/v11.Dockerfile b/build/erpnext-assets/v11.Dockerfile index 6db3b415..f46c2030 100644 --- a/build/erpnext-assets/v11.Dockerfile +++ b/build/erpnext-assets/v11.Dockerfile @@ -1,38 +1,14 @@ FROM bitnami/node:10-prod -WORKDIR /home/frappe/frappe-bench -RUN mkdir -p /home/frappe/frappe-bench/sites \ - && echo "frappe\nerpnext" > /home/frappe/frappe-bench/sites/apps.txt +COPY build/erpnext-assets/install_app.sh /install_app -RUN install_packages git python2 +RUN /install_app erpnext https://github.com/frappe/erpnext version-11 -RUN mkdir -p apps sites/assets \ - && cd apps \ - && git clone --depth 1 https://github.com/frappe/frappe --branch version-11 \ - && git clone --depth 1 https://github.com/frappe/erpnext --branch version-11 - -RUN cd /home/frappe/frappe-bench/apps/frappe \ - && yarn \ - && yarn run production \ - && rm -fr node_modules \ - && yarn install --production=true - -RUN git clone --depth 1 https://github.com/frappe/bench /tmp/bench \ - && mkdir -p /var/www/error_pages \ - && cp -r /tmp/bench/bench/config/templates/502.html /var/www/error_pages - -RUN cp -R /home/frappe/frappe-bench/apps/frappe/frappe/public/* /home/frappe/frappe-bench/sites/assets/frappe \ - && cp -R /home/frappe/frappe-bench/apps/frappe/node_modules /home/frappe/frappe-bench/sites/assets/frappe/ \ - && mkdir -p /home/frappe/frappe-bench/sites/assets/erpnext \ - && cp -R /home/frappe/frappe-bench/apps/erpnext/erpnext/public/* /home/frappe/frappe-bench/sites/assets/erpnext - -FROM nginx:latest -COPY --from=0 /home/frappe/frappe-bench/sites /var/www/html/ -COPY --from=0 /var/www/error_pages /var/www/ -COPY build/common/nginx-default.conf.template /etc/nginx/conf.d/default.conf.template -COPY build/erpnext-assets/docker-entrypoint.sh / - -RUN apt-get update && apt-get install -y rsync && apt-get clean +FROM frappe/frappe-assets:v11 +RUN cp /home/frappe/frappe-bench/sites/apps.txt /home/frappe/frappe-bench/sites/apps.bak +COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/ +RUN mv /home/frappe/frappe-bench/sites/apps.bak /home/frappe/frappe-bench/sites/apps.txt \ + && echo -n "\nerpnext" >> /home/frappe/frappe-bench/sites/apps.txt VOLUME [ "/assets" ] diff --git a/build/erpnext-assets/v12.Dockerfile b/build/erpnext-assets/v12.Dockerfile index 9b13bb13..cb29ea1b 100644 --- a/build/erpnext-assets/v12.Dockerfile +++ b/build/erpnext-assets/v12.Dockerfile @@ -1,39 +1,14 @@ FROM bitnami/node:12-prod -WORKDIR /home/frappe/frappe-bench -RUN mkdir -p /home/frappe/frappe-bench/sites \ - && echo "frappe\nerpnext" > /home/frappe/frappe-bench/sites/apps.txt +COPY build/erpnext-assets/install_app.sh /install_app -RUN install_packages git python2 - -RUN mkdir -p apps sites/assets \ - && cd apps \ - && git clone --depth 1 https://github.com/frappe/frappe --branch version-12 \ - && git clone --depth 1 https://github.com/frappe/erpnext --branch version-12 - -RUN cd /home/frappe/frappe-bench/apps/frappe \ - && yarn \ - && yarn run production \ - && rm -fr node_modules \ - && yarn install --production=true - -RUN git clone --depth 1 https://github.com/frappe/bench /tmp/bench \ - && mkdir -p /var/www/error_pages \ - && cp -r /tmp/bench/bench/config/templates/502.html /var/www/error_pages - -RUN cp -R /home/frappe/frappe-bench/apps/frappe/frappe/public/* /home/frappe/frappe-bench/sites/assets/frappe \ - && cp -R /home/frappe/frappe-bench/apps/frappe/node_modules /home/frappe/frappe-bench/sites/assets/frappe/ \ - && mkdir -p /home/frappe/frappe-bench/sites/assets/erpnext \ - && cp -R /home/frappe/frappe-bench/apps/erpnext/erpnext/public/* /home/frappe/frappe-bench/sites/assets/erpnext - -FROM nginx:latest -COPY --from=0 /home/frappe/frappe-bench/sites /var/www/html/ -COPY --from=0 /var/www/error_pages /var/www/ -COPY build/common/nginx-default.conf.template /etc/nginx/conf.d/default.conf.template -COPY build/erpnext-assets/docker-entrypoint.sh / - -RUN apt-get update && apt-get install -y rsync && apt-get clean +RUN /install_app erpnext https://github.com/frappe/erpnext version-12 +FROM frappe/frappe-assets:v12 +RUN cp /home/frappe/frappe-bench/sites/apps.txt /home/frappe/frappe-bench/sites/apps.bak +COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/ +RUN mv /home/frappe/frappe-bench/sites/apps.bak /home/frappe/frappe-bench/sites/apps.txt \ + && echo -n "\nerpnext" >> /home/frappe/frappe-bench/sites/apps.txt VOLUME [ "/assets" ] ENTRYPOINT ["/docker-entrypoint.sh"] From 48a305bec6f08b836f5d5e9642d1b11cd7400061 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 4 Mar 2020 03:43:49 +0000 Subject: [PATCH 04/14] Adding in the rsync for the docker-entrypoint --- build/erpnext-assets/Dockerfile | 1 + build/erpnext-assets/docker-entrypoint.sh | 40 ----------------------- build/erpnext-assets/install_app.sh | 1 + build/erpnext-assets/v11.Dockerfile | 1 + build/erpnext-assets/v12.Dockerfile | 1 + build/frappe-assets/docker-entrypoint.sh | 1 + 6 files changed, 5 insertions(+), 40 deletions(-) delete mode 100755 build/erpnext-assets/docker-entrypoint.sh diff --git a/build/erpnext-assets/Dockerfile b/build/erpnext-assets/Dockerfile index 6bec65a0..9e966d53 100644 --- a/build/erpnext-assets/Dockerfile +++ b/build/erpnext-assets/Dockerfile @@ -7,6 +7,7 @@ RUN /install_app erpnext https://github.com/frappe/erpnext FROM frappe/frappe-assets:develop RUN cp /home/frappe/frappe-bench/sites/apps.txt /home/frappe/frappe-bench/sites/apps.bak COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/ +COPY --from=0 /rsync /rsync RUN mv /home/frappe/frappe-bench/sites/apps.bak /home/frappe/frappe-bench/sites/apps.txt \ && echo -n "\nerpnext" >> /home/frappe/frappe-bench/sites/apps.txt diff --git a/build/erpnext-assets/docker-entrypoint.sh b/build/erpnext-assets/docker-entrypoint.sh deleted file mode 100755 index 4919fb34..00000000 --- a/build/erpnext-assets/docker-entrypoint.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -## Thanks -# https://serverfault.com/a/919212 -## - -set -e - -rsync -a --delete /var/www/html/assets/js /assets -rsync -a --delete /var/www/html/assets/css /assets -rsync -a --delete /var/www/html/assets/frappe /assets -rsync -a --delete /var/www/html/assets/erpnext /assets - -chmod -R 755 /assets - -if [[ -z "$FRAPPE_PY" ]]; then - export FRAPPE_PY=0.0.0.0 -fi - -if [[ -z "$FRAPPE_PY_PORT" ]]; then - export FRAPPE_PY_PORT=8000 -fi - -if [[ -z "$FRAPPE_SOCKETIO" ]]; then - export FRAPPE_SOCKETIO=0.0.0.0 -fi - -if [[ -z "$SOCKETIO_PORT" ]]; then - export SOCKETIO_PORT=9000 -fi - -envsubst '${API_HOST} - ${API_PORT} - ${FRAPPE_PY} - ${FRAPPE_PY_PORT} - ${FRAPPE_SOCKETIO} - ${SOCKETIO_PORT}' \ - < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf - -exec "$@" diff --git a/build/erpnext-assets/install_app.sh b/build/erpnext-assets/install_app.sh index eefa538a..dd05d228 100644 --- a/build/erpnext-assets/install_app.sh +++ b/build/erpnext-assets/install_app.sh @@ -27,3 +27,4 @@ yarn install --production=true mkdir -p /home/frappe/frappe-bench/sites/assets/${APP_NAME} cp -R /home/frappe/frappe-bench/apps/${APP_NAME}/${APP_NAME}/public/* /home/frappe/frappe-bench/sites/assets/${APP_NAME} +echo "rsync -a --delete /var/www/html/assets/${APP_NAME} /assets" > /rsync \ No newline at end of file diff --git a/build/erpnext-assets/v11.Dockerfile b/build/erpnext-assets/v11.Dockerfile index f46c2030..351cacb8 100644 --- a/build/erpnext-assets/v11.Dockerfile +++ b/build/erpnext-assets/v11.Dockerfile @@ -7,6 +7,7 @@ RUN /install_app erpnext https://github.com/frappe/erpnext version-11 FROM frappe/frappe-assets:v11 RUN cp /home/frappe/frappe-bench/sites/apps.txt /home/frappe/frappe-bench/sites/apps.bak COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/ +COPY --from=0 /rsync /rsync RUN mv /home/frappe/frappe-bench/sites/apps.bak /home/frappe/frappe-bench/sites/apps.txt \ && echo -n "\nerpnext" >> /home/frappe/frappe-bench/sites/apps.txt diff --git a/build/erpnext-assets/v12.Dockerfile b/build/erpnext-assets/v12.Dockerfile index cb29ea1b..83e163b3 100644 --- a/build/erpnext-assets/v12.Dockerfile +++ b/build/erpnext-assets/v12.Dockerfile @@ -7,6 +7,7 @@ RUN /install_app erpnext https://github.com/frappe/erpnext version-12 FROM frappe/frappe-assets:v12 RUN cp /home/frappe/frappe-bench/sites/apps.txt /home/frappe/frappe-bench/sites/apps.bak COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/ +COPY --from=0 /rsync /rsync RUN mv /home/frappe/frappe-bench/sites/apps.bak /home/frappe/frappe-bench/sites/apps.txt \ && echo -n "\nerpnext" >> /home/frappe/frappe-bench/sites/apps.txt VOLUME [ "/assets" ] diff --git a/build/frappe-assets/docker-entrypoint.sh b/build/frappe-assets/docker-entrypoint.sh index f68e7fd3..67128558 100755 --- a/build/frappe-assets/docker-entrypoint.sh +++ b/build/frappe-assets/docker-entrypoint.sh @@ -9,6 +9,7 @@ set -e rsync -a --delete /var/www/html/assets/js /assets rsync -a --delete /var/www/html/assets/css /assets rsync -a --delete /var/www/html/assets/frappe /assets +. /rsync chmod -R 755 /assets From 8eb26446da3cf5c58917511de9e64e0fc86f0a74 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Wed, 4 Mar 2020 03:59:53 +0000 Subject: [PATCH 05/14] make this pr not make travis build on the wrong image --- .travis.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8158bb93..47306180 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,9 +17,9 @@ before_install: after_success: - docker --version -matrix: +jobs: include: - - name: "Build Frappe python environment (edge)" + - stage: "Build Frappe python environment (edge)" if: branch = develop AND type != pull_request script: - docker build -t frappe-worker -f build/frappe-worker/Dockerfile . @@ -27,7 +27,7 @@ matrix: - docker tag frappe-worker frappe/frappe-worker:develop - docker push frappe/frappe-worker:edge - docker push frappe/frappe-worker:develop - - name: "Build Frappe nginx + static assets (edge)" + - stage: "Build Frappe nginx + static assets (edge)" if: branch = develop AND type != pull_request script: - docker build -t frappe-assets -f build/frappe-assets/Dockerfile . @@ -35,7 +35,7 @@ matrix: - docker tag frappe-assets frappe/frappe-assets:develop - docker push frappe/frappe-assets:edge - docker push frappe/frappe-assets:develop - - name: "Build ERPNext python environment (edge)" + - stage: "Build ERPNext python environment (edge)" if: branch = develop AND type != pull_request script: - docker build -t erpnext-worker -f build/erpnext-worker/Dockerfile . @@ -43,7 +43,7 @@ matrix: - docker tag erpnext-worker frappe/erpnext-worker:develop - docker push frappe/erpnext-worker:edge - docker push frappe/erpnext-worker:develop - - name: "Build ERPNext nginx + static assets (edge)" + - stage: "Build ERPNext nginx + static assets (edge)" if: branch = develop AND type != pull_request script: - docker build -t erpnext-assets -f build/erpnext-assets/Dockerfile . @@ -51,7 +51,7 @@ matrix: - docker tag erpnext-assets frappe/erpnext-assets:develop - docker push frappe/erpnext-assets:edge - docker push frappe/erpnext-assets:develop - - name: "Build Frappe socketio service (edge)" + - stage: "Build Frappe socketio service (edge)" if: branch = develop AND type != pull_request script: - docker build -t frappe-socketio -f build/frappe-socketio/Dockerfile . @@ -59,7 +59,7 @@ matrix: - docker tag frappe-socketio frappe/frappe-socketio:develop - docker push frappe/frappe-socketio:edge - docker push frappe/frappe-socketio:develop - - name: "Build Frappe python environment (v12)" + - stage: "Build Frappe python environment (v12)" if: branch = master AND type != pull_request script: - git clone https://github.com/frappe/frappe --branch version-12 @@ -73,7 +73,7 @@ matrix: - docker push frappe/frappe-worker:$VERSION - docker push frappe/frappe-worker:version-12 - docker push frappe/frappe-worker:v12 - - name: "Build Frappe nginx + static assets (v12)" + - stage: "Build Frappe nginx + static assets (v12)" if: branch = master AND type != pull_request script: - git clone https://github.com/frappe/frappe --branch version-12 @@ -87,7 +87,7 @@ matrix: - docker push frappe/frappe-assets:$VERSION - docker push frappe/frappe-assets:version-12 - docker push frappe/frappe-assets:v12 - - name: "Build ERPNext python environment (v12)" + - stage: "Build ERPNext python environment (v12)" if: branch = master AND type != pull_request script: - git clone https://github.com/frappe/erpnext --branch version-12 @@ -101,7 +101,7 @@ matrix: - docker push frappe/erpnext-worker:$VERSION - docker push frappe/erpnext-worker:version-12 - docker push frappe/erpnext-worker:v12 - - name: "Build ERPNext nginx + static assets (v12)" + - stage: "Build ERPNext nginx + static assets (v12)" if: branch = master AND type != pull_request script: - git clone https://github.com/frappe/erpnext --branch version-12 @@ -115,7 +115,7 @@ matrix: - docker push frappe/erpnext-assets:$VERSION - docker push frappe/erpnext-assets:version-12 - docker push frappe/erpnext-assets:v12 - - name: "Build Frappe socketio service (v12)" + - stage: "Build Frappe socketio service (v12)" if: branch = master AND type != pull_request script: - git clone https://github.com/frappe/frappe --branch version-12 @@ -129,7 +129,7 @@ matrix: - docker push frappe/frappe-socketio:$VERSION - docker push frappe/frappe-socketio:version-12 - docker push frappe/frappe-socketio:v12 - - name: "Build Frappe python environment (v11)" + - stage: "Build Frappe python environment (v11)" if: branch = master AND type != pull_request script: - git clone https://github.com/frappe/frappe --branch version-11 @@ -143,7 +143,7 @@ matrix: - docker push frappe/frappe-worker:$VERSION - docker push frappe/frappe-worker:version-11 - docker push frappe/frappe-worker:v11 - - name: "Build Frappe nginx + static assets (v11)" + - stage: "Build Frappe nginx + static assets (v11)" if: branch = master AND type != pull_request script: - git clone https://github.com/frappe/frappe --branch version-11 @@ -157,7 +157,7 @@ matrix: - docker push frappe/frappe-assets:$VERSION - docker push frappe/frappe-assets:version-11 - docker push frappe/frappe-assets:v11 - - name: "Build ERPNext python environment (v11)" + - stage: "Build ERPNext python environment (v11)" if: branch = master AND type != pull_request script: - git clone https://github.com/frappe/erpnext --branch version-11 @@ -171,7 +171,7 @@ matrix: - docker push frappe/erpnext-worker:$VERSION - docker push frappe/erpnext-worker:version-11 - docker push frappe/erpnext-worker:v11 - - name: "Build ERPNext nginx + static assets (v11)" + - stage: "Build ERPNext nginx + static assets (v11)" if: branch = master AND type != pull_request script: - git clone https://github.com/frappe/erpnext --branch version-11 @@ -185,7 +185,7 @@ matrix: - docker push frappe/erpnext-assets:$VERSION - docker push frappe/erpnext-assets:version-11 - docker push frappe/erpnext-assets:v11 - - name: "Build Frappe socketio service (v11)" + - stage: "Build Frappe socketio service (v11)" if: branch = master AND type != pull_request script: - git clone https://github.com/frappe/frappe --branch version-11 From 959ab4fc7d294f5edf5b0acb652fac2399ce04b7 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 5 Mar 2020 01:38:01 +0000 Subject: [PATCH 06/14] one small change to support multi-tenancy --- build/common/commands/new.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/common/commands/new.py b/build/common/commands/new.py index b87641db..4cc13a28 100644 --- a/build/common/commands/new.py +++ b/build/common/commands/new.py @@ -6,7 +6,7 @@ site_name = os.environ.get("SITE_NAME", 'site1.localhost') mariadb_root_username = os.environ.get("DB_ROOT_USER", 'root') mariadb_root_password = os.environ.get("MYSQL_ROOT_PASSWORD", 'admin') force = True if os.environ.get("FORCE", None) else False -install_apps = ['erpnext'] if os.environ.get("INSTALL_ERPNEXT", None) else False +install_apps = os.environ.get("INSTALL_APPS").split(",") frappe.init(site_name, new_site=True) _new_site( From 5cf8e68327bc248989bb5770b1c58dc6de272626 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 5 Mar 2020 02:00:54 +0000 Subject: [PATCH 07/14] update docs for INSTALL_APPS --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 611cde45..bef76892 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ docker exec -it \ -e "DB_ROOT_USER=$DB_ROOT_USER" \ -e "MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD" \ -e "ADMIN_PASSWORD=$ADMIN_PASSWORD" \ - -e "INSTALL_ERPNEXT=1" \ + -e "INSTALL_APPS='erpnext'" \ _erpnext-python_1 docker-entrypoint.sh new ``` @@ -115,7 +115,7 @@ Environment Variables needed: - `DB_ROOT_USER`: MariaDB Root user. The user that can create databases. - `MYSQL_ROOT_PASSWORD`: In case of mariadb docker container use the one set in `MYSQL_ROOT_PASSWORD` in previous steps. In case of managed database use appropriate password. - `ADMIN_PASSWORD`: set the administrator password for new site. -- `INSTALL_ERPNEXT=1`: available only in erpnext-worker and erpnext containers. Installs ERPNext on this new site. +- `INSTALL_APPS='erpnext'`: available only in erpnext-worker and erpnext containers (or other containers with custom apps). Installs ERPNext (and/or the specified apps, comma-delinieated) on this new site. - `FORCE=1`: is optional variable which force installs the same site. #### Backup Sites From b254e018e54a281c53c6a49ec83e2c9bc79700cc Mon Sep 17 00:00:00 2001 From: chabad360 Date: Thu, 5 Mar 2020 02:28:42 +0000 Subject: [PATCH 08/14] shave off a layer --- build/erpnext-assets/Dockerfile | 5 ++--- build/erpnext-assets/install_app.sh | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build/erpnext-assets/Dockerfile b/build/erpnext-assets/Dockerfile index 9e966d53..8ea44946 100644 --- a/build/erpnext-assets/Dockerfile +++ b/build/erpnext-assets/Dockerfile @@ -5,11 +5,10 @@ COPY build/erpnext-assets/install_app.sh /install_app RUN /install_app erpnext https://github.com/frappe/erpnext FROM frappe/frappe-assets:develop -RUN cp /home/frappe/frappe-bench/sites/apps.txt /home/frappe/frappe-bench/sites/apps.bak + COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/ COPY --from=0 /rsync /rsync -RUN mv /home/frappe/frappe-bench/sites/apps.bak /home/frappe/frappe-bench/sites/apps.txt \ - && echo -n "\nerpnext" >> /home/frappe/frappe-bench/sites/apps.txt +RUN echo -n "\nerpnext" >> /var/www/html/apps.txt VOLUME [ "/assets" ] diff --git a/build/erpnext-assets/install_app.sh b/build/erpnext-assets/install_app.sh index dd05d228..aa3cd98c 100644 --- a/build/erpnext-assets/install_app.sh +++ b/build/erpnext-assets/install_app.sh @@ -27,4 +27,6 @@ yarn install --production=true mkdir -p /home/frappe/frappe-bench/sites/assets/${APP_NAME} cp -R /home/frappe/frappe-bench/apps/${APP_NAME}/${APP_NAME}/public/* /home/frappe/frappe-bench/sites/assets/${APP_NAME} -echo "rsync -a --delete /var/www/html/assets/${APP_NAME} /assets" > /rsync \ No newline at end of file +echo "rsync -a --delete /var/www/html/assets/${APP_NAME} /assets" > /rsync + +rm /home/frappe/frappe-bench/sites/apps.txt \ No newline at end of file From be8f0e4fa0777a6b9149944b29b3ec889032fe63 Mon Sep 17 00:00:00 2001 From: chabad360 Date: Fri, 6 Mar 2020 06:12:11 +0000 Subject: [PATCH 09/14] rudimentary docs --- README.md | 57 ++++++++++++ installation/docker-compose-custom.yml | 117 +++++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 installation/docker-compose-custom.yml diff --git a/README.md b/README.md index bef76892..bbc93b1c 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,63 @@ docker exec -it \ _erpnext-python_1 docker-entrypoint.sh migrate ``` +### Custom apps + +> For the sake of example, we'll be using a place holder called `[custom]`, and we'll be building off the edge image. + +To add your own apps to the image, we'll need to create a custom image with the help of a special wrapper script + +1. Create two folders called `[custom]-worker` and `[custom]-assets` in the `build` folder. + + ```bash + cd frappe_docker + mkdir ./build/[custom]-worker ./build/[custom]-assets + ``` + +2. Create a `Dockerfile` in `./build/[custom]-worker` with the following content: + + ```Dockerfile + FROM frappe/erpnext-worker:edge + + RUN install_app [custom] https://github.com/[username]/[custom] [branch] + # Only add the branch if you are using a specific tag or branch. + ``` + +3. Create a `Dockerfile` in `./build/[custom]-assets` with the following content: + + ```Dockerfile + FROM bitnami/node:12-prod + + COPY build/[custom]-assets/install_app.sh /install_app + + RUN /install_app [custom] https://github.com/[username]/[custom] + + FROM frappe/erpnext-assets:edge + + COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/ + COPY --from=0 /rsync /rsync + RUN echo -n "\nerpnext" >> /var/www/html/apps.txt + + VOLUME [ "/assets" ] + + ENTRYPOINT ["/docker-entrypoint.sh"] + CMD ["nginx", "-g", "daemon off;"] + ``` + +4. Copy over the `install_app.sh` file from `./build/erpnext-assets` + + ```bash + cp ./build/erpnext-assets/install.sh ./build/[custom]-assets + ``` + +5. Open up `./installation/docker-compose-custom.yml` and replace all instances of `[app]` with the name of your app. + + ```bash + sed -i "s#\[app\]#[custom]#" ./installation/docker-compose-custom.yml + ``` + +6. Install like usuall, except that when you set the `INSTALL_APPS` variable set it to `erpnext,[custom]`. + ### Troubleshoot 1. Remove containers and volumes, and clear redis cache: diff --git a/installation/docker-compose-custom.yml b/installation/docker-compose-custom.yml new file mode 100644 index 00000000..5a7c3696 --- /dev/null +++ b/installation/docker-compose-custom.yml @@ -0,0 +1,117 @@ +version: '3' + +services: + [app]-assets: + image: [app]-assets + build: + context: . + dockerfile: ./build/[app]-assets/Dockerfile + restart: on-failure + environment: + - FRAPPE_PY=erpnext-python + - FRAPPE_PY_PORT=8000 + - FRAPPE_SOCKETIO=frappe-socketio + - SOCKETIO_PORT=9000 + - LETSENCRYPT_HOST=${SITES} + - VIRTUAL_HOST=${SITES} + - LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL} + depends_on: + - [app]-python + - frappe-socketio + - frappe-worker-default + - frappe-worker-long + - frappe-worker-short + links: + - [app]-python + - frappe-socketio + - frappe-worker-default + - frappe-worker-long + - frappe-worker-short + volumes: + - ./sites:/var/www/html/sites:rw + - assets-vol:/assets:rw + + [app]-python: + image: [app]-worker + build: + context: . + dockerfile: ./build/[app]-worker/Dockerfile + restart: on-failure + environment: + - MARIADB_HOST=${MARIADB_HOST} + - REDIS_CACHE=redis-cache:6379 + - REDIS_QUEUE=redis-queue:6379 + - REDIS_SOCKETIO=redis-socketio:6379 + - SOCKETIO_PORT=9000 + volumes: + - ./sites:/home/frappe/frappe-bench/sites:rw + - assets-vol:/home/frappe/frappe-bench/sites/assets:rw + + frappe-socketio: + image: frappe/frappe-socketio:${VERSION} + restart: on-failure + depends_on: + - redis-socketio + links: + - redis-socketio + volumes: + - ./sites:/home/frappe/frappe-bench/sites:rw + + frappe-worker-default: + image: [app]-worker + restart: on-failure + command: worker + depends_on: + - redis-queue + - redis-cache + links: + - redis-queue + - redis-cache + volumes: + - ./sites:/home/frappe/frappe-bench/sites:rw + + frappe-worker-short: + image: [app]-worker + restart: on-failure + command: worker + environment: + - WORKER_TYPE=short + depends_on: + - redis-queue + - redis-cache + links: + - redis-queue + - redis-cache + volumes: + - ./sites:/home/frappe/frappe-bench/sites:rw + + frappe-worker-long: + image: [app]-worker + restart: on-failure + command: worker + environment: + - WORKER_TYPE=long + depends_on: + - redis-queue + - redis-cache + links: + - redis-queue + - redis-cache + volumes: + - ./sites:/home/frappe/frappe-bench/sites:rw + + frappe-schedule: + image: [app]-worker + restart: on-failure + command: schedule + depends_on: + - redis-queue + - redis-cache + links: + - redis-queue + - redis-cache + volumes: + - ./sites:/home/frappe/frappe-bench/sites:rw + +volumes: + assets-vol: From 7bdd32979381a77ae82f71616a448c9f32c6178c Mon Sep 17 00:00:00 2001 From: chabad360 Date: Fri, 6 Mar 2020 06:23:53 +0000 Subject: [PATCH 10/14] some small changes --- README.md | 60 +++++++++++++++++----------------- build/erpnext-nginx/Dockerfile | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 7f7c5bcb..3bd34b90 100644 --- a/README.md +++ b/README.md @@ -258,54 +258,54 @@ docker exec -it \ To add your own apps to the image, we'll need to create a custom image with the help of a special wrapper script -1. Create two folders called `[custom]-worker` and `[custom]-assets` in the `build` folder. +1. Create two folders called `[custom]-worker` and `[custom]-nginx` in the `build` folder. - ```bash - cd frappe_docker - mkdir ./build/[custom]-worker ./build/[custom]-assets - ``` + ```bash + cd frappe_docker + mkdir ./build/[custom]-worker ./build/[custom]-nginx + ``` 2. Create a `Dockerfile` in `./build/[custom]-worker` with the following content: - ```Dockerfile - FROM frappe/erpnext-worker:edge + ```Dockerfile + FROM frappe/erpnext-worker:edge - RUN install_app [custom] https://github.com/[username]/[custom] [branch] - # Only add the branch if you are using a specific tag or branch. - ``` + RUN install_app [custom] https://github.com/[username]/[custom] [branch] + # Only add the branch if you are using a specific tag or branch. + ``` -3. Create a `Dockerfile` in `./build/[custom]-assets` with the following content: +3. Create a `Dockerfile` in `./build/[custom]-nginx` with the following content: - ```Dockerfile - FROM bitnami/node:12-prod + ```Dockerfile + FROM bitnami/node:12-prod - COPY build/[custom]-assets/install_app.sh /install_app + COPY build/[custom]-nginx/install_app.sh /install_app - RUN /install_app [custom] https://github.com/[username]/[custom] + RUN /install_app [custom] https://github.com/[username]/[custom] - FROM frappe/erpnext-assets:edge + FROM frappe/erpnext-nginx:edge - COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/ - COPY --from=0 /rsync /rsync - RUN echo -n "\nerpnext" >> /var/www/html/apps.txt + COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/ + COPY --from=0 /rsync /rsync + RUN echo -n "\n[custom]" >> /var/www/html/apps.txt - VOLUME [ "/assets" ] + VOLUME [ "/assets" ] - ENTRYPOINT ["/docker-entrypoint.sh"] - CMD ["nginx", "-g", "daemon off;"] - ``` + ENTRYPOINT ["/docker-entrypoint.sh"] + CMD ["nginx", "-g", "daemon off;"] + ``` -4. Copy over the `install_app.sh` file from `./build/erpnext-assets` +4. Copy over the `install_app.sh` file from `./build/erpnext-nginx` - ```bash - cp ./build/erpnext-assets/install.sh ./build/[custom]-assets - ``` + ```bash + cp ./build/erpnext-nginx/install.sh ./build/[custom]-nginx + ``` 5. Open up `./installation/docker-compose-custom.yml` and replace all instances of `[app]` with the name of your app. - ```bash - sed -i "s#\[app\]#[custom]#" ./installation/docker-compose-custom.yml - ``` + ```bash + sed -i "s#\[app\]#[custom]#" ./installation/docker-compose-custom.yml + ``` 6. Install like usuall, except that when you set the `INSTALL_APPS` variable set it to `erpnext,[custom]`. diff --git a/build/erpnext-nginx/Dockerfile b/build/erpnext-nginx/Dockerfile index 70c9f47d..0bbd2dc6 100644 --- a/build/erpnext-nginx/Dockerfile +++ b/build/erpnext-nginx/Dockerfile @@ -4,7 +4,7 @@ COPY build/erpnext-nginx/install_app.sh /install_app RUN /install_app erpnext https://github.com/frappe/erpnext -FROM frappe/frappe-assets:develop +FROM frappe/frappe-nginx:develop COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/ COPY --from=0 /rsync /rsync From b6eb3ccde263b1fe264bcefc1ef48c55f391367e Mon Sep 17 00:00:00 2001 From: chabad360 Date: Fri, 6 Mar 2020 06:29:12 +0000 Subject: [PATCH 11/14] bug fix in install_apps.sh --- build/common/worker/install_app.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/common/worker/install_app.sh b/build/common/worker/install_app.sh index e3b9b629..ac71cc6a 100755 --- a/build/common/worker/install_app.sh +++ b/build/common/worker/install_app.sh @@ -8,10 +8,10 @@ cd /home/frappe/frappe-bench/ . env/bin/activate -cd apps +cd ./apps [ "${APP_BRANCH}" ] && \ BRANCH="-b ${APP_BRANCH}" git clone --depth 1 -o upstream ${APP_REPO} ${BRANCH} -pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/APP_NAME \ No newline at end of file +pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/${APP_NAME} \ No newline at end of file From 4b87e507790ffdb95dbfb37673e504adc214390a Mon Sep 17 00:00:00 2001 From: chabad360 Date: Fri, 6 Mar 2020 06:43:28 +0000 Subject: [PATCH 12/14] ambiguous stage names for faster builds --- .travis.yml | 78 ++++++++++++++++++++++++++--------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.travis.yml b/.travis.yml index a36d334e..8410199c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,93 +20,93 @@ after_success: jobs: include: - - name: "Build Frappe bench development environment (latest)" + - stage: "Build Frappe bench development environment (latest)" if: branch = develop AND type != pull_request script: - docker build -t frappe/bench:latest -f build/bench/Dockerfile . - docker push frappe/bench:latest - - name: "Build Frappe python environment (edge)" + - stage: "Frappe (edge)" if: branch = develop AND type != pull_request script: - ./travis.py frappe --nginx --tag edge - ./travis.py frappe --nginx --tag develop--tag-only - - name: "Build Frappe nginx + static assets (edge)" + - stage: "Frappe (edge)" if: branch = develop AND type != pull_request script: - ./travis.py frappe --nginx --tag edge - ./travis.py frappe --nginx --tag develop--tag-only - - stage: "Build ERPNext python environment (edge)" - if: branch = develop AND type != pull_request - script: - - ./travis.py erpnext --worker --tag edge - - ./travis.py erpnext --worker --tag develop --tag-only - - stage: "Build ERPNext nginx + static assets (edge)" - if: branch = develop AND type != pull_request - script: - - ./travis.py erpnext --nginx --tag edge - - ./travis.py erpnext --nginx --tag develop --tag-only - - stage: "Build Frappe socketio service (edge)" + - stage: "Frappe (edge)" if: branch = develop AND type != pull_request script: - ./travis.py frappe --socketio --tag edge - ./travis.py frappe --socketio --tag develop --tag-only - - stage: "Build Frappe python environment (v12)" + - stage: "ERPNext (edge)" + if: branch = develop AND type != pull_request + script: + - ./travis.py erpnext --worker --tag edge + - ./travis.py erpnext --worker --tag develop --tag-only + - stage: "ERPNext (edge)" + if: branch = develop AND type != pull_request + script: + - ./travis.py erpnext --nginx --tag edge + - ./travis.py erpnext --nginx --tag develop --tag-only + - stage: "Frappe (v12)" if: branch = master AND type != pull_request script: - ./travis.py frappe --worker --git-branch 12 - ./travis.py frappe --worker --tag v12 --tag-only - ./travis.py frappe --worker --tag version-12 --tag-only - - stage: "Build Frappe nginx + static assets (v12)" + - stage: "Frappe (v12)" if: branch = master AND type != pull_request script: - ./travis.py frappe --nginx --git-branch 12 - ./travis.py frappe --nginx --tag v12 --tag-only - ./travis.py frappe --nginx --tag version-12 --tag-only - - stage: "Build ERPNext python environment (v12)" + - stage: "Frappe (v12)" + if: branch = master AND type != pull_request + script: + - ./travis.py frappe --socketio --git-branch 12 + - ./travis.py frappe --socketio --tag v12 --tag-only + - ./travis.py frappe --socketio --tag version-12 --tag-only + - stage: "ERPNext (v12)" if: branch = master AND type != pull_request script: - ./travis.py erpnext --worker --git-branch 12 - ./travis.py erpnext --worker --tag v12 --tag-only - ./travis.py erpnext --worker --tag version-12 --tag-only - - stage: "Build ERPNext nginx + static assets (v12)" + - stage: "ERPNext (v12)" if: branch = master AND type != pull_request script: - ./travis.py erpnext --nginx --git-branch 12 - ./travis.py erpnext --nginx --tag v12 --tag-only - ./travis.py erpnext --nginx --tag version-12 --tag-only - - stage: "Build Frappe socketio service (v11)" - if: branch = master AND type != pull_request - script: - - ./travis.py frappe --socketio --git-branch 11 - - ./travis.py frappe --socketio --tag v11 --tag-only - - ./travis.py frappe --socketio --tag version-11 --tag-only - - stage: "Build Frappe python environment (v11)" + - stage: "Frappe (v11)" if: branch = master AND type != pull_request script: - ./travis.py frappe --worker --git-branch 11 - ./travis.py frappe --worker --tag v11 --tag-only - ./travis.py frappe --worker --tag version-11 --tag-only - - stage: "Build Frappe nginx + static assets (v11)" + - stage: "Frappe (v11)" if: branch = master AND type != pull_request script: - ./travis.py erpnext frappe --nginx --git-branch 11 - ./travis.py erpnext frappe --nginx --tag v11 --tag-only - ./travis.py erpnext frappe --nginx --tag version-11 --tag-only - - stage: "Build ERPNext python environment (v11)" - if: branch = master AND type != pull_request - script: - - ./travis.py erpnext --worker --git-branch 11 - - ./travis.py erpnext --worker --tag v11 --tag-only - - ./travis.py erpnext --worker --tag version-11 --tag-only - - stage: "Build ERPNext nginx + static assets (v11)" - if: branch = master AND type != pull_request - script: - - ./travis.py erpnext --nginx --git-branch 11 - - ./travis.py erpnext --nginx --tag v11 --tag-only - - ./travis.py erpnext --nginx --tag version-11 --tag-only - - stage: "Build Frappe socketio service (v11)" + - stage: "Frappe (v11)" if: branch = master AND type != pull_request script: - ./travis.py frappe --socketio --git-branch 11 - ./travis.py frappe --socketio --tag v11 --tag-only - ./travis.py frappe --socketio --tag version-11 --tag-only + - stage: "ERPNext (v11)" + if: branch = master AND type != pull_request + script: + - ./travis.py erpnext --worker --git-branch 11 + - ./travis.py erpnext --worker --tag v11 --tag-only + - ./travis.py erpnext --worker --tag version-11 --tag-only + - stage: "ERPNext (v11)" + if: branch = master AND type != pull_request + script: + - ./travis.py erpnext --nginx --git-branch 11 + - ./travis.py erpnext --nginx --tag v11 --tag-only + - ./travis.py erpnext --nginx --tag version-11 --tag-only \ No newline at end of file From d00770e42f347279fe4fb10e9e995cc6ffceaaeb Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Sat, 7 Mar 2020 05:33:32 +0530 Subject: [PATCH 13/14] fix: install_app set branch --- build/common/worker/install_app.sh | 3 +-- build/erpnext-nginx/install_app.sh | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/build/common/worker/install_app.sh b/build/common/worker/install_app.sh index ac71cc6a..c378be17 100755 --- a/build/common/worker/install_app.sh +++ b/build/common/worker/install_app.sh @@ -10,8 +10,7 @@ cd /home/frappe/frappe-bench/ cd ./apps -[ "${APP_BRANCH}" ] && \ - BRANCH="-b ${APP_BRANCH}" +[ "${APP_BRANCH}" ] && BRANCH="-b ${APP_BRANCH}" git clone --depth 1 -o upstream ${APP_REPO} ${BRANCH} pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/${APP_NAME} \ No newline at end of file diff --git a/build/erpnext-nginx/install_app.sh b/build/erpnext-nginx/install_app.sh index aa3cd98c..a01e957b 100644 --- a/build/erpnext-nginx/install_app.sh +++ b/build/erpnext-nginx/install_app.sh @@ -4,8 +4,7 @@ APP_NAME=${1} APP_REPO=${2} APP_BRANCH=${3} -[ "${APP_BRANCH}" ] && \ - BRANCH="-b ${APP_BRANCH}" +[ "${APP_BRANCH}" ] && BRANCH="-b ${APP_BRANCH}" cd /home/frappe/frappe-bench mkdir -p /home/frappe/frappe-bench/sites @@ -13,7 +12,7 @@ echo "frappe\n${APP_NAME}" > /home/frappe/frappe-bench/sites/apps.txt install_packages git python2 -mkdir -p apps sites/assets +mkdir -p apps sites/assets cd apps git clone --depth 1 https://github.com/frappe/frappe ${BRANCH} git clone --depth 1 ${APP_REPO} ${BRANCH} From 845f8546ff5aaecc19891e57aabfbdce611cfe09 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Sat, 7 Mar 2020 05:34:06 +0530 Subject: [PATCH 14/14] fix: travis duplicate stages --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8410199c..9d232816 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,8 +28,8 @@ jobs: - stage: "Frappe (edge)" if: branch = develop AND type != pull_request script: - - ./travis.py frappe --nginx --tag edge - - ./travis.py frappe --nginx --tag develop--tag-only + - ./travis.py frappe --worker --tag edge + - ./travis.py frappe --worker --tag develop--tag-only - stage: "Frappe (edge)" if: branch = develop AND type != pull_request script: