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

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 .

If you’re using bind mount then fix volume permission. Container Basics. The volume should be owned by 1000:1000 uid:gid

yes I already did that but it doesn’t seem to work. Could that be because i’m using a single folder for all the directories inside docker or for all the services. I called it erp_data and mapped every directory to this host directory.

Someone else who is using bind mount may help you.

1 Like

@rajv I don’t recommend using bind mount- permissions will be a pain. Better to use volumes.

If you need to persist the data after volume removal (instead of just backing up data to the host) then maybe look into local-persist volume driver: GitHub - MatchbookLab/local-persist: Create named local volumes that persist in the location(s) you want

Volume setup looks like this in the docker-compose.yml for the sites volume in the services sections (can do the same thing with other volumes as well):

services:
  backend:
    ...
    volumes:
    - type: volume
      source: sites
      target: /home/frappe/frappe-bench/sites
      volume: {}
...

And in the volumes section:

volumes:
  ...
  sites:
    name: frappe_docker_sites
    driver: local-persist
    driver_opts:
      mountpoint: /path/to/your/data/here
  ...
2 Likes