How do I install the human resources module in a Docker setup?

Ok thanks I want to install Accounting and Hrms module i need their repositories

Check reply #17 How do I install the human resources module in a Docker setup? - #17 by revant_one

Accounting is part of ERPNext v14

Ok whats the next process when the command has finished to create the image @ custom/hrms:1.0.0 ?

use the image and start containers

read everything here frappe_docker/custom-apps.md at main · frappe/frappe_docker · GitHub

This is what it return when i pull the image

(HTTP code 404) unexpected - pull access denied for custom/hrms, repository does not exist or may require ‘docker login’: denied: requested access to the resource is denied

you cannot pull this image, you’ve built this locally and pushed nowhere.

you need to USE the image.

let me copy paste the relevant section:

Use Images

On the compose.yaml replace the image reference to the tag you used when you built it. Then, if you used a tag like custom_erpnext:staging the x-customizable-image section will look like this:

x-customizable-image: &customizable_image
  image: custom_erpnext:staging
  pull_policy: never

The pull_policy above is optional and prevents docker to try to download the image when that one has been built locally.

1 Like

i did it like this :point_down:t4::point_down:t4::point_down:t4:

x-customizable-image: &customizable_image

By default the image used only contains the frappe and erpnext apps.

See frappe_docker/custom-apps.md at main · frappe/frappe_docker · GitHub

about using custom images.

image: custom/hrms:staging
pull_policy: never

The tag i used is custom/hrms

When I try my custom image and build a container with it i get this errors:

Attaching to frappe_docker-backend-1, frappe_docker-configurator-1, frappe_docker-frontend-1, frappe_docker-queue-default-1, frappe_docker-queue-long-1, frappe_docker-queue-short-1, frappe_docker-scheduler-1, frappe_docker-websocket-1
frappe_docker-configurator-1   | Usage: bench  set-config [OPTIONS] KEY VALUE
frappe_docker-configurator-1   | Try 'bench  set-config --help' for help.
frappe_docker-configurator-1   |
frappe_docker-configurator-1   | Error: Missing argument 'VALUE'.
frappe_docker-configurator-1   | Usage: bench  set-config [OPTIONS] KEY VALUE
frappe_docker-configurator-1   | Try 'bench  set-config --help' for help.
frappe_docker-configurator-1   |
frappe_docker-configurator-1   | Error: Missing argument 'VALUE'.
frappe_docker-configurator-1 exited with code 0
frappe_docker-frontend-1       | PROXY_READ_TIMEOUT defaulting to 120

my compose file has the changes:

x-customizable-image: &customizable_image
  image: custom/hrms:1.0.0
  pull_policy: never

logs from the configurator:

docker logs frappe_docker-configurator-1
Usage: bench  set-config [OPTIONS] KEY VALUE
Try 'bench  set-config --help' for help.

Error: Missing argument 'VALUE'.
Usage: bench  set-config [OPTIONS] KEY VALUE
Try 'bench  set-config --help' for help.

logs from other containers:

docker logs frappe_docker-websocket-1
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
Emitted 'error' event on RedisClient instance at:
    at RedisClient.on_error (/home/frappe/frappe-bench/apps/frappe/node_modules/redis/index.js:342:14)
    at Socket.<anonymous> (/home/frappe/frappe-bench/apps/frappe/node_modules/redis/index.js:223:14)
    at Socket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 6379
}

The most important things that i noticed is while doing the export of apps json, when i try and export encoded variable it gives me this error:

export APPS_JSON='[
  {
    "url": "https://github.com/frappe/erpnext",
    "branch": "v14.21.0"
  },
  {
    "url": "https://github.com/frappe/hrms",
    "branch": "v14.2.2"
  }
]'

export APPS_JSON_BASE64=$(echo ${APPS_JSON} | base64 -w 0)
base64: invalid argument -w
Usage:	base64 [-hDd] [-b num] [-i in_file] [-o out_file]
  -h, --help     display this message
  -Dd, --decode   decodes input
  -b, --break    break encoded string into num character lines
  -i, --input    input file (default: "-" for stdin)
  -o, --output   output file (default: "-" for stdout)

Kindly Advise.

It may be difference with your shell, env variables picked up by shell.

bench set-config sets config values from env vars, if the var is missing or not picked up by your shell it’ll result in command error.

If -w doesn’t work try --wrap or check docs/man/help for your base64 command

Works for me on Linux/bash/zsh.

I double checked the env variable. Here were my steps:

  1. Created custom image with the apps json.
  2. Modified the compose yml with the right image, i.e my local image.
  3. Run the docker compose command.

Post all this the containers start but tone container errors out as mentioned in the details of error logs.

I also verified the base64, encode and decode it gives me the right json string back.
On mac os ventura there is no -w or wrap flag that can be used with base64.

wait for someone with Mac to help you.

1 Like

Also does ERPnext and HRMS support postgresql instead of Maria and if so whats the best way to implement that please ?

Hello @revant_one ,

Thanks again for all the work and help, this time I managed to get the image build as I stepped away from mac and did this on centos. Here are my steps:

  1. build an image based on this: https://github.com/frappe/frappe_docker/blob/main/docs/custom-apps.md
  2. Post Build I made sure that i changed the compose.yml to point to my own image under:
x-customizable-image: &customizable_image
  # By default the image used only contains the `frappe` and `erpnext` apps.
  # See https://github.com/frappe/frappe_docker/blob/main/docs/custom-apps.md
  # about using custom images.
  image: rajverma1985/erpnext/custom:1.0.0
  1. I also made sure .env file is present but I did not make any changes to it at all.

  2. Now Whenever I run the compose command, the configurator fails, no matter what I do (I have a feeling i’m doing this totally wrong):

docker compose --env-file .env -f compose.yaml -f overrides/compose.redis.yaml up -d

I have also tried this:

docker compose --env-file .env -f compose.yaml up -d

Am I missing something due to which I keep getting this:

frappe_docker]# docker logs frappe_docker-configurator-1
Usage: bench  set-config [OPTIONS] KEY VALUE
Try 'bench  set-config --help' for help.

Error: Missing argument 'VALUE'.
Usage: bench  set-config [OPTIONS] KEY VALUE
Try 'bench  set-config --help' for help.

It seems the env vars are empty.

@revant_one The env file looks like this:

[root@pdc2app1002 frappe_docker]# cat .env
# Reference: https://github.com/frappe/frappe_docker/blob/main/docs/images-and-compose-files.md

ERPNEXT_VERSION=v14.34.3

DB_PASSWORD=123

# Only if you use external database
DB_HOST=127.0.0.1
DB_PORT=

# Only if you use external Redis
REDIS_CACHE=
REDIS_QUEUE=
REDIS_SOCKETIO=

# Only with HTTPS override
LETSENCRYPT_EMAIL=mail@example.com

# These environment variables are not required.

# Default value is `$$host` which resolves site by host. For example, if your host is `example.com`,
# site's name should be `example.com`, or if host is `127.0.0.1` (local debugging), it should be `127.0.0.1`.
# This variable allows to override described behavior. Let's say you create site named `mysite`
# and do want to access it by `127.0.0.1` host. Than you would set this variable to `mysite`.
FRAPPE_SITE_NAME_HEADER=

# Default value is `127.0.0.1`. Set IP address as our trusted upstream address.
UPSTREAM_REAL_IP_ADDRESS=

# Default value is `X-Forwarded-For`. Set request header field whose value will be used to replace the client address
UPSTREAM_REAL_IP_HEADER=

# Allowed values are on|off. Default value is `off`. If recursive search is disabled,
# the original client address that matches one of the trusted addresses
# is replaced by the last address sent in the request header field defined by the real_ip_header directive.
# If recursive search is enabled, the original client address that matches one of the trusted addresses is replaced by the last non-trusted address sent in the request header field.
UPSTREAM_REAL_IP_RECURSIVE=

# All Values Allowed by nginx proxy_read_timeout are allowed, default value is 120s
# Useful if you have longrunning print formats or slow loading sites
PROXY_READ_TIMEOUT=

# All Values allowed by nginx client_max_body_size are allowed, default value is 50m
# Necessary if the upload limit in the frappe application is increased
CLIENT_MAX_BODY_SIZE=

# List of sites for letsencrypt certificates quoted with backtick (`) and separated by comma (,)
# More https://doc.traefik.io/traefik/routing/routers/#rule
# About acme https://doc.traefik.io/traefik/https/acme/#domain-definition
SITES=`erp.example.com`

Should I be adding any DB names etc. ? I’m sorry but I was just following the docs to the dot. What do I need to specify in there? Do I spin up separate containers for DB?

According to this doc https://github.com/frappe/frappe_docker/blob/main/docs/environment-variables.md , it says “Set only if external service for database is used.”

This will think the mariadb is installed in container. use 172.17.0.1 for docker host ip on linux if it is setup on localhost.

bench set-config needs the other variables to have values to work as expected.

1 Like

@revant_one Thanks again for the reply, do you mind sharing a working docker compose command, just to make sure I’m not missing anything?

I use this setup https://github.com/castlecraft/custom_containers/blob/main/docs/docker-swarm.md

yaml here: https://github.com/castlecraft/custom_containers/blob/main/compose/erpnext.yml

There’s lot of options you can choose from. Only compose.yml on its own will not work.

Use the easy install script for quick auto config GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps

To know manual steps read https://github.com/frappe/frappe_docker/blob/main/docs/single-server-example.md

1 Like

Gotcha, btw this works for me now. I did some mods to the pwd.yml with some overrides.
I wanted to persist the data over some mounts on my server so i created some folder and added them to the yml like this:(example)

 redis-socketio:
    image: redis:6.2-alpine
    deploy:
      restart_policy:
        condition: on-failure
    volumes:
      - /erp/erp_data:/data

  scheduler:
    image: rajverma1985/erpnext_hrms:1.0.0
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - bench
      - schedule
    volumes:
      - /erp/erp_data:/home/frappe/frappe-bench/sites
      - /erp/erp_data:/home/frappe/frappe-bench/logs

  websocket:
    image: rajverma1985/erpnext_hrms:1.0.0
    deploy:
      restart_policy:
        condition: on-failure
    command:
      - node
      - /home/frappe/frappe-bench/apps/frappe/socketio.js
    volumes:
      - /erp/erp_data:/home/frappe/frappe-bench/sites
      - /erp/erp_data:/home/frappe/frappe-bench/logs

But now when i start it, it gives me this problem of permission denied on those folders, nothing changed except i just removed the docker volume and made folders mounted to the internal frappe directories.

Error messages here:

ctlabs-queue-short-1     |     return open_func(self.baseFilename, self.mode,
ctlabs-queue-short-1     | PermissionError: [Errno 13] Permission denied: '/home/frappe/frappe-bench/logs/bench.log'
ctlabs-queue-short-1     | Traceback (most recent call last):
ctlabs-queue-short-1     |   File "/usr/local/bin/bench", line 8, in <module>
ctlabs-queue-short-1     |     sys.exit(cli())
ctlabs-queue-short-1     |   File "/usr/local/lib/python3.10/site-packages/bench/cli.py", line 80, in cli
ctlabs-queue-short-1     |     logger = setup_logging()
ctlabs-queue-short-1     |   File "/usr/local/lib/python3.10/site-packages/bench/utils/__init__.py", line 185, in setup_logging
ctlabs-queue-short-1     |     hdlr = logging.FileHandler(log_file)
ctlabs-queue-short-1     |   File "/usr/local/lib/python3.10/logging/__init__.py", line 1169, in __init__
ctlabs-queue-short-1     |     StreamHandler.__init__(self, self._open())
ctlabs-queue-short-1     |   File "/usr/local/lib/python3.10/logging/__init__.py", line 1201, in _open
ctlabs-queue-short-1     |     return open_func(self.baseFilename, self.mode,
ctlabs-queue-short-1     | PermissionError: [Errno 13] Permission denied: '/home/frappe/frappe-bench/logs/bench.log'
ctlabs-queue-default-1   |     return open_func(self.baseFilename, self.mode,
ctlabs-queue-default-1   | PermissionError: [Errno 13] Permission denied: '/home/frappe/frappe-bench/logs/bench.log'
ctlabs-queue-default-1   | Traceback (most recent call last):
ctlabs-queue-default-1   |   File "/usr/local/bin/bench", line 8, in <module>
ctlabs-queue-default-1   |     sys.exit(cli())
ctlabs-queue-default-1   |   File "/usr/local/lib/python3.10/site-packages/bench/cli.py", line 80, in cli
ctlabs-queue-default-1   |     logger = setup_logging()
ctlabs-queue-default-1   |   File "/usr/local/lib/python3.10/site-packages/bench/utils/__init__.py", line 185, in setup_logging
ctlabs-queue-default-1   |     hdlr = logging.FileHandler(log_file)
ctlabs-queue-default-1   |   File "/usr/local/lib/python3.10/logging/__init__.py", line 1169, in __init__
ctlabs-queue-default-1   |     StreamHandler.__init__(self, self._open())
ctlabs-queue-default-1   |   File "/usr/local/lib/python3.10/logging/__init__.py", line 1201, in _open
ctlabs-queue-default-1   |     return open_func(self.baseFilename, self.mode,
ctlabs-queue-default-1   | PermissionError: [Errno 13] Permission denied: '/home/frappe/frappe-bench/logs/bench.log'

By the way, I just wanted to send Thanks and appreciation of all the great work &help!! Really really appreciate all the good work done by you and your team! Thanks again for all the help. @revant_one .