Add ERPNext

This commit is contained in:
Emil Dabrowski 2022-12-19 15:23:40 +01:00
parent 016c8b0e56
commit 76831934ff
9 changed files with 128 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "erpnext/frappe_docker"]
path = erpnext/frappe_docker
url = https://github.com/frappe/frappe_docker

3
erpnext/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.env
secret.env
docker-compose.yml

3
erpnext/README.md Normal file
View File

@ -0,0 +1,3 @@
# ERPNext
Containerfile for the ERPNext backend with the HRMS module included as well as a generator for the Docker Compose config used by JILITS.

View File

@ -0,0 +1,17 @@
ARG ERPNEXT_VERSION
FROM alpine:latest
RUN \
cd /tmp; \
apk add tar wget; \
wget https://github.com/frappe/hrms/archive/refs/tags/v1.0.0.tar.gz -O "release.tgz"; \
mkdir "release"; \
tar -zxvf "release.tgz" -C "release"; \
mv "$(find release -mindepth 1 -maxdepth 1 -type d)" "/app";
FROM frappe/erpnext-worker:${ERPNEXT_VERSION}
ARG APP_NAME="hrms"
USER root
COPY --from=0 /app/ ../apps/${APP_NAME}/
RUN chown -R frappe:frappe ../apps/${APP_NAME}/
RUN --mount=type=cache,target=/root/.cache/pip install-app ${APP_NAME}
USER frappe

View File

@ -0,0 +1,21 @@
x-erpnext-backend-image: &erpnext_backend_image
image: git.jilits.se/jilits/erpnext-worker:${ERPNEXT_VERSION:?No ERPNext version set}
services:
configurator:
<<: *erpnext_backend_image
backend:
<<: *erpnext_backend_image
queue-short:
<<: *erpnext_backend_image
queue-default:
<<: *erpnext_backend_image
queue-long:
<<: *erpnext_backend_image
scheduler:
<<: *erpnext_backend_image

1
erpnext/frappe_docker Submodule

@ -0,0 +1 @@
Subproject commit d85f54cd7beaf38e4c553ee354bdc4ff3a4d009e

40
erpnext/main.env Normal file
View File

@ -0,0 +1,40 @@
# Reference: https://github.com/frappe/frappe_docker/blob/main/docs/images-and-compose-files.md
FRAPPE_VERSION=v14.19.1
# Only with ERPNext override
ERPNEXT_VERSION=v14.10.1
DB_PASSWORD=somethingelse
# Only if you use external database
DB_HOST=
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=erp.jilits.se
# 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=

26
erpnext/mk-compose.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
#
# Build Docker Compose configuration
#
script_dir="$(
cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit 1
pwd -P
)"
cd "$script_dir" || exit 1
cat main.env secret.env >.env || exit 2
ln -sfn ../.env frappe_docker/.env || exit 3
. .env || exit 4
cd "$script_dir/frappe_docker" || exit 5
# Generate YAML
docker compose -p erpnext \
-f compose.yaml \
-f overrides/compose.erpnext.yaml \
-f overrides/compose.mariadb.yaml \
-f overrides/compose.redis.yaml \
-f overrides/compose.noproxy.yaml \
-f ../compose.override.yaml \
config >../docker-compose.yml

14
erpnext/mk-container.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
#
# Build custom backend container
#
script_dir="$(
cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit 1
pwd -P
)"
cd "$script_dir" || exit 1
. main.env || exit 2
DOCKER_BUILDKIT=1 docker build . -f backend.Containerfile --build-arg ERPNEXT_VERSION="${ERPNEXT_VERSION:?}" -t "jilits/erpnext-worker:${ERPNEXT_VERSION}" -t "git.jilits.se/jilits/erpnext-worker:${ERPNEXT_VERSION}"