Docker app installation

How i install app like this one GitHub - franknyarkoh/bookings: Hotel Management App for Erpnext on docker production site

Does this work for you? https://github.com/frappe/frappe_docker/blob/develop/docs/custom-apps-for-production.md

Live app with release script and builds using gitlab castlecraft / excel_erpnext · GitLab

1 Like

my site is in production and the command lines you gave are not working for me

Check the git repo link to find how that app is built into docker image.

Check the .gitlab-ci.yml file for commands that build the image.

It’s combination of building a py env and static assets

I configured all files as said in the document, but what command do i use to install the app

If your images are built and published to registry, change the image section of docker-compose.yml file

Check example Home · Wiki · castlecraft / excel_erpnext · GitLab

I have created this folders with docker file

I configured pos-worker docker file like this

        FROM frappe/erpnext-worker:edge

    RUN install_app https://github.com/yrestom/POS-Awesome.git
    # Only add the branch if you are using a specific tag or branch.

and nginx pos-worker docker file like this 

FROM bitnami/node:12-prod

COPY build/pos-nginx/install_app.sh /install_app

RUN /install_app https://github.com/yrestom/POS-Awesome.git 
FROM frappe/erpnext-nginx:edge

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" ]

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]

and also changed ersion: ‘3’

services:
POS-Awesome-assets:
image: POS-Awesome-assets
build:
context: …/build/POS-Awesome-nginx
restart: on-failure
environment:
- FRAPPE_PY=POS-Awesome-python
- FRAPPE_PY_PORT=8000
- FRAPPE_SOCKETIO=frappe-socketio
- SOCKETIO_PORT=9000
- LETSENCRYPT_HOST=${SITES}
- VIRTUAL_HOST=${SITES}
- LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}
depends_on:
- POS-Awesome-python
- frappe-socketio
- frappe-worker-default
- frappe-worker-long
- frappe-worker-short
links:
- POS-Awesome-python
- frappe-socketio
- frappe-worker-default
- frappe-worker-long
- frappe-worker-short
volumes:
- sites-vol:/var/www/html/sites:rw
- assets-vol:/assets:rw

POS-Awesome-python:
image: POS-Awesome-worker
build:
context: …/build/POS-Awesome-worker
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-vol:/home/frappe/frappe-bench/sites:rw
- logs-vol:/home/frappe/frappe-bench/logs:rw
- assets-vol:/home/frappe/frappe-bench/sites/assets:rw

frappe-socketio:
image: frappe/frappe-socketio:${FRAPPE_VERSION}
restart: on-failure
depends_on:
- redis-socketio
links:
- redis-socketio
volumes:
- sites-vol:/home/frappe/frappe-bench/sites:rw
- logs-vol:/home/frappe/frappe-bench/logs:rw

frappe-worker-default:
image: POS-Awesome-worker
restart: on-failure
command: worker
depends_on:
- redis-queue
- redis-cache
links:
- redis-queue
- redis-cache
volumes:
- sites-vol:/home/frappe/frappe-bench/sites:rw
- logs-vol:/home/frappe/frappe-bench/logs:rw

frappe-worker-short:
image: POS-Awesome-worker
restart: on-failure
command: worker
environment:
- WORKER_TYPE=short
depends_on:
- redis-queue
- redis-cache
links:
- redis-queue
- redis-cache
volumes:
- sites-vol:/home/frappe/frappe-bench/sites:rw
- logs-vol:/home/frappe/frappe-bench/logs:rw

frappe-worker-long:
image: POS-Awesome-worker
restart: on-failure
command: worker
environment:
- WORKER_TYPE=long
depends_on:
- redis-queue
- redis-cache
links:
- redis-queue
- redis-cache
volumes:
- sites-vol:/home/frappe/frappe-bench/sites:rw
- logs-vol:/home/frappe/frappe-bench/logs:rw

frappe-schedule:
image: POS-Awesome-worker
restart: on-failure
command: schedule
depends_on:
- redis-queue
- redis-cache
links:
- redis-queue
- redis-cache
volumes:
- sites-vol:/home/frappe/frappe-bench/sites:rw
- logs-vol:/home/frappe/frappe-bench/logs:rw

volumes:
assets-vol:
sites-vol:
logs-vol:

version: '3'

services:
  POS-Awesome-assets:
    image: POS-Awesome-assets
    build:
      context: ../build/POS-Awesome-nginx
    restart: on-failure
    environment:
      - FRAPPE_PY=POS-Awesome-python
      - FRAPPE_PY_PORT=8000
      - FRAPPE_SOCKETIO=frappe-socketio
      - SOCKETIO_PORT=9000
      - LETSENCRYPT_HOST=${SITES}
      - VIRTUAL_HOST=${SITES}
      - LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}
    depends_on:
      - POS-Awesome-python
      - frappe-socketio
      - frappe-worker-default
      - frappe-worker-long
      - frappe-worker-short
    links:
      - POS-Awesome-python
      - frappe-socketio
      - frappe-worker-default
      - frappe-worker-long
      - frappe-worker-short
    volumes:
      - sites-vol:/var/www/html/sites:rw
      - assets-vol:/assets:rw

  POS-Awesome-python:
    image: POS-Awesome-worker
    build:
      context: ../build/POS-Awesome-worker
    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-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw
      - assets-vol:/home/frappe/frappe-bench/sites/assets:rw

  frappe-socketio:
    image: frappe/frappe-socketio:${FRAPPE_VERSION}
    restart: on-failure
    depends_on:
      - redis-socketio
    links:
      - redis-socketio
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

  frappe-worker-default:
    image: POS-Awesome-worker
    restart: on-failure
    command: worker
    depends_on:
      - redis-queue
      - redis-cache
    links:
      - redis-queue
      - redis-cache
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

  frappe-worker-short:
    image: POS-Awesome-worker
    restart: on-failure
    command: worker
    environment:
      - WORKER_TYPE=short
    depends_on:
      - redis-queue
      - redis-cache
    links:
      - redis-queue
      - redis-cache
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

  frappe-worker-long:
    image: POS-Awesome-worker
    restart: on-failure
    command: worker
    environment:
      - WORKER_TYPE=long
    depends_on:
      - redis-queue
      - redis-cache
    links:
      - redis-queue
      - redis-cache
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

  frappe-schedule:
    image: POS-Awesome-worker
    restart: on-failure
    command: schedule
    depends_on:
      - redis-queue
      - redis-cache
    links:
      - redis-queue
      - redis-cache
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

volumes:
  assets-vol:
  sites-vol:
  logs-vol:

    version: '3'

    services:
      POS-Awesome-assets:
        image: POS-Awesome-assets
        build:
          context: ../build/POS-Awesome-nginx
        restart: on-failure
        environment:
          - FRAPPE_PY=POS-Awesome-python
          - FRAPPE_PY_PORT=8000
          - FRAPPE_SOCKETIO=frappe-socketio
          - SOCKETIO_PORT=9000
          - LETSENCRYPT_HOST=${SITES}
          - VIRTUAL_HOST=${SITES}
          - LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}
        depends_on:
          - POS-Awesome-python
          - frappe-socketio
          - frappe-worker-default
          - frappe-worker-long
          - frappe-worker-short
        links:
          - POS-Awesome-python
          - frappe-socketio
          - frappe-worker-default
          - frappe-worker-long
          - frappe-worker-short
        volumes:
          - sites-vol:/var/www/html/sites:rw
          - assets-vol:/assets:rw

      POS-Awesome-python:
        image: POS-Awesome-worker
        build:
          context: ../build/POS-Awesome-worker
        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-vol:/home/frappe/frappe-bench/sites:rw
          - logs-vol:/home/frappe/frappe-bench/logs:rw
          - assets-vol:/home/frappe/frappe-bench/sites/assets:rw

      frappe-socketio:
        image: frappe/frappe-socketio:${FRAPPE_VERSION}
        restart: on-failure
        depends_on:
          - redis-socketio
        links:
          - redis-socketio
        volumes:
          - sites-vol:/home/frappe/frappe-bench/sites:rw
          - logs-vol:/home/frappe/frappe-bench/logs:rw

      frappe-worker-default:
        image: POS-Awesome-worker
        restart: on-failure
        command: worker
        depends_on:
          - redis-queue
          - redis-cache
        links:
          - redis-queue
          - redis-cache
        volumes:
          - sites-vol:/home/frappe/frappe-bench/sites:rw
          - logs-vol:/home/frappe/frappe-bench/logs:rw

      frappe-worker-short:
        image: POS-Awesome-worker
        restart: on-failure
        command: worker
        environment:
          - WORKER_TYPE=short
        depends_on:
          - redis-queue
          - redis-cache
        links:
          - redis-queue
          - redis-cache
        volumes:
          - sites-vol:/home/frappe/frappe-bench/sites:rw
          - logs-vol:/home/frappe/frappe-bench/logs:rw

      frappe-worker-long:
        image: POS-Awesome-worker
        restart: on-failure
        command: worker
        environment:
          - WORKER_TYPE=long
        depends_on:
          - redis-queue
          - redis-cache
        links:
          - redis-queue
          - redis-cache
        volumes:
          - sites-vol:/home/frappe/frappe-bench/sites:rw
          - logs-vol:/home/frappe/frappe-bench/logs:rw

      frappe-schedule:
        image: POS-Awesome-worker
        restart: on-failure
        command: schedule
        depends_on:
          - redis-queue
          - redis-cache
        links:
          - redis-queue
          - redis-cache
        volumes:
          - sites-vol:/home/frappe/frappe-bench/sites:rw
          - logs-vol:/home/frappe/frappe-bench/logs:rw

    volumes:
      assets-vol:
      sites-vol:
      logs-vol:

What i am doing wrong ?

worker image

Dockerfile:

FROM frappe/erpnext-worker:edge

RUN install_app posawesome https://github.com/yrestom/POS-Awesome master

nginx image

install_app.sh:

#!/bin/bash

APP_NAME=${1}
APP_REPO=${2}
APP_BRANCH=${3}
FRAPPE_BRANCH=${4}

[ "${APP_BRANCH}" ] && BRANCH="-b ${APP_BRANCH}"
[ "${FRAPPE_BRANCH}" ] && FRAMEWORK_BRANCH="-b ${FRAPPE_BRANCH}"

mkdir -p /home/frappe/frappe-bench/sites/assets
cd /home/frappe/frappe-bench
echo -e "frappe\nerpnext\n${APP_NAME}" > /home/frappe/frappe-bench/sites/apps.txt

mkdir -p apps
cd apps
git clone --depth 1 https://github.com/frappe/frappe frappe ${FRAMEWORK_BRANCH}
git clone --depth 1 ${APP_REPO} ${APP_NAME} ${BRANCH}

cd /home/frappe/frappe-bench/apps/frappe && yarn
cd /home/frappe/frappe-bench/apps/${APP_NAME} && yarn

cd /home/frappe/frappe-bench/apps/frappe
yarn production
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/erpnext /assets" >> /rsync
echo "rsync -a --delete /var/www/html/assets/${APP_NAME} /assets" >> /rsync
chmod +x /rsync

rm /home/frappe/frappe-bench/sites/apps.txt

Dockerfile:

FROM node:12-buster

COPY install_app.sh /install_app

# /install_app <app_name> <repo> <app_branch> <frappe_branch>
RUN /install_app posawesome https://github.com/yrestom/POS-Awesome.git master develop

FROM frappe/erpnext-nginx:edge

COPY --from=0 /home/frappe/frappe-bench/sites/ /var/www/html/
COPY --from=0 /rsync /rsync
RUN echo -n "\nposawesome" >> /var/www/html/apps.txt

VOLUME [ "/assets" ]

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]

Directory structure

docker/
    worker/
        Dockerfile
    nginx/
        Dockerfile
        install_app.sh

Command to build images

docker build -t posawesome-worker:latest docker/worker
docker build -t posawesome-nginx:latest docker/nginx

I got this error when i run the first command
unable to prepare context: path "docker/worker" not found

what is the directory structure.

Command is relative to the structure. docker/worker is the path.

copy paste will not help much.

I run the command in root:~/frappe_docker#

Check the path. (path in this case is location on disk)

is there frappe_docker/docker? then docker build -t posawesome-worker:latest docker/worker will work.

the error reads unable to prepare context: path "docker/worker" not found

  • something was “unable to”
  • some “prepare context”
  • “path”. What must be path? it can’t be url path.
  • “docker/worker” not found. What can docker/worker be? path?

Check this sample repo I just created, It works on my end, It may not work on other machines.

It adds frappe, erpnext and 4 apps to the environment

What am i doing wrong when because i am getting the same error

Try pos-worker instead of docker/worker
And pos-nginx instead of docker/nginx

I’m assuming you’ve not understood anything about the change.

I can’t help you really if you don’t know anything about docker.

Copy paste without understanding docker.

If pos-worker and pos-nginx works, there will be different problem that I’ll have to solve for you.

This repo can help anyone who already knows docker (GitHub - castlecraft/custom_frappe_docker)

I generally do this commercially at castlecraft.in. This has nothing to do with improving core docker builds, instead you need image with custom apps from all over the community.