mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-23 00:05:09 +00:00
feat: update configuration
This commit is contained in:
parent
a58a274bc8
commit
2b2503635f
9 changed files with 304 additions and 28 deletions
|
|
@ -46,4 +46,4 @@ FRAPPE_SITE_NAME_HEADER=
|
|||
# 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.zapal.tech`
|
||||
SITES=`localhost`
|
||||
|
|
|
|||
43
.github/workflows/production-image.yml
vendored
Normal file
43
.github/workflows/production-image.yml
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
name: Create and publish a Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['production']
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-and-push-image:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: 'DOTENV_KEY=${{ secrets.DOTENV_KEY }}'
|
||||
11
compose.yaml
11
compose.yaml
|
|
@ -9,7 +9,7 @@ x-depends-on-configurator: &depends_on_configurator
|
|||
x-backend-defaults: &backend_defaults
|
||||
<<: [*depends_on_configurator, *customizable_image]
|
||||
volumes:
|
||||
- ./sites:/home/frappe/frappe-bench/sites
|
||||
- sites:/home/zapal/frappe-bench/sites
|
||||
|
||||
services:
|
||||
configurator:
|
||||
|
|
@ -52,7 +52,7 @@ services:
|
|||
PROXY_READ_TIMEOUT: ${PROXY_READ_TIMEOUT:-120}
|
||||
CLIENT_MAX_BODY_SIZE: ${CLIENT_MAX_BODY_SIZE:-50m}
|
||||
volumes:
|
||||
- ./sites:/home/frappe/frappe-bench/sites
|
||||
- sites:/home/zapal/frappe-bench/sites
|
||||
depends_on:
|
||||
- backend
|
||||
- websocket
|
||||
|
|
@ -61,9 +61,9 @@ services:
|
|||
<<: [*depends_on_configurator, *customizable_image]
|
||||
command:
|
||||
- node
|
||||
- /home/frappe/frappe-bench/apps/frappe/socketio.js
|
||||
- /home/zapal/frappe-bench/apps/frappe/socketio.js
|
||||
volumes:
|
||||
- ./sites:/home/frappe/frappe-bench/sites
|
||||
- sites:/home/zapal/frappe-bench/sites
|
||||
|
||||
queue-short:
|
||||
<<: *backend_defaults
|
||||
|
|
@ -76,3 +76,6 @@ services:
|
|||
scheduler:
|
||||
<<: *backend_defaults
|
||||
command: bench schedule
|
||||
|
||||
volumes:
|
||||
sites:
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ variable "HRMS_VERSION" {
|
|||
default = "version-15"
|
||||
}
|
||||
|
||||
variable "INSIGHTS_VERSION" {
|
||||
default = "develop"
|
||||
}
|
||||
|
||||
variable "FRAPPE_REPO" {
|
||||
default = "https://github.com/zapal-tech/erp-frappe"
|
||||
}
|
||||
|
|
@ -33,6 +37,10 @@ variable "HRMS_REPO" {
|
|||
default = "https://github.com/zapal-tech/erp-hrms"
|
||||
}
|
||||
|
||||
variable "INSIGHTS_REPO" {
|
||||
default = "https://github.com/zapal-tech/erp-insights"
|
||||
}
|
||||
|
||||
variable "BENCH_REPO" {
|
||||
default = "https://github.com/frappe/bench"
|
||||
}
|
||||
|
|
|
|||
211
docker-compose.yml
Normal file
211
docker-compose.yml
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
name: erp
|
||||
services:
|
||||
backend:
|
||||
depends_on:
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
required: true
|
||||
image: zapal-tech/erp:latest
|
||||
networks:
|
||||
default: null
|
||||
volumes:
|
||||
- type: volume
|
||||
source: sites
|
||||
target: /home/zapal/frappe-bench/sites
|
||||
volume: {}
|
||||
configurator:
|
||||
command:
|
||||
- |
|
||||
ls -1 apps > sites/apps.txt; bench set-config -g db_host $$DB_HOST; bench set-config -gp db_port $$DB_PORT; bench set-config -g redis_cache "redis://$$REDIS_CACHE"; bench set-config -g redis_queue "redis://$$REDIS_QUEUE"; bench set-config -g redis_socketio "redis://$$REDIS_QUEUE"; bench set-config -gp socketio_port $$SOCKETIO_PORT;
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
required: true
|
||||
redis-cache:
|
||||
condition: service_started
|
||||
required: true
|
||||
redis-queue:
|
||||
condition: service_started
|
||||
required: true
|
||||
entrypoint:
|
||||
- bash
|
||||
- -c
|
||||
environment:
|
||||
DB_HOST: db
|
||||
DB_PORT: "3306"
|
||||
REDIS_CACHE: redis-cache:6379
|
||||
REDIS_QUEUE: redis-queue:6379
|
||||
SOCKETIO_PORT: "9000"
|
||||
image: zapal-tech/erp:latest
|
||||
networks:
|
||||
default: null
|
||||
volumes:
|
||||
- type: volume
|
||||
source: sites
|
||||
target: /home/zapal/frappe-bench/sites
|
||||
volume: {}
|
||||
db:
|
||||
command:
|
||||
- --character-set-server=utf8mb4
|
||||
- --collation-server=utf8mb4_unicode_ci
|
||||
- --skip-character-set-client-handshake
|
||||
- --skip-innodb-read-only-compressed
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: "123"
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD-SHELL
|
||||
- mysqladmin ping -h localhost --password=123
|
||||
interval: 1s
|
||||
retries: 15
|
||||
image: mariadb:10.6
|
||||
networks:
|
||||
default: null
|
||||
volumes:
|
||||
- type: volume
|
||||
source: db-data
|
||||
target: /var/lib/mysql
|
||||
volume: {}
|
||||
frontend:
|
||||
command:
|
||||
- nginx-entrypoint.sh
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_started
|
||||
required: true
|
||||
websocket:
|
||||
condition: service_started
|
||||
required: true
|
||||
environment:
|
||||
BACKEND: backend:8000
|
||||
CLIENT_MAX_BODY_SIZE: 50m
|
||||
FRAPPE_SITE_NAME_HEADER: $$host
|
||||
PROXY_READ_TIMEOUT: "120"
|
||||
SOCKETIO: websocket:9000
|
||||
UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
|
||||
UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
|
||||
UPSTREAM_REAL_IP_RECURSIVE: "off"
|
||||
image: zapal-tech/erp:latest
|
||||
networks:
|
||||
default: null
|
||||
ports:
|
||||
- mode: ingress
|
||||
target: 8080
|
||||
published: "8080"
|
||||
protocol: tcp
|
||||
volumes:
|
||||
- type: volume
|
||||
source: sites
|
||||
target: /home/zapal/frappe-bench/sites
|
||||
volume: {}
|
||||
queue-long:
|
||||
command:
|
||||
- bench
|
||||
- worker
|
||||
- --queue
|
||||
- long,default,short
|
||||
depends_on:
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
required: true
|
||||
image: zapal-tech/erp:latest
|
||||
networks:
|
||||
default: null
|
||||
volumes:
|
||||
- type: volume
|
||||
source: sites
|
||||
target: /home/zapal/frappe-bench/sites
|
||||
volume: {}
|
||||
queue-short:
|
||||
command:
|
||||
- bench
|
||||
- worker
|
||||
- --queue
|
||||
- short,default
|
||||
depends_on:
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
required: true
|
||||
image: zapal-tech/erp:latest
|
||||
networks:
|
||||
default: null
|
||||
volumes:
|
||||
- type: volume
|
||||
source: sites
|
||||
target: /home/zapal/frappe-bench/sites
|
||||
volume: {}
|
||||
redis-cache:
|
||||
image: redis:6.2-alpine
|
||||
networks:
|
||||
default: null
|
||||
volumes:
|
||||
- type: volume
|
||||
source: redis-cache-data
|
||||
target: /data
|
||||
volume: {}
|
||||
redis-queue:
|
||||
image: redis:6.2-alpine
|
||||
networks:
|
||||
default: null
|
||||
volumes:
|
||||
- type: volume
|
||||
source: redis-queue-data
|
||||
target: /data
|
||||
volume: {}
|
||||
scheduler:
|
||||
command:
|
||||
- bench
|
||||
- schedule
|
||||
depends_on:
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
required: true
|
||||
image: zapal-tech/erp:latest
|
||||
networks:
|
||||
default: null
|
||||
volumes:
|
||||
- type: volume
|
||||
source: sites
|
||||
target: /home/zapal/frappe-bench/sites
|
||||
volume: {}
|
||||
websocket:
|
||||
command:
|
||||
- node
|
||||
- /home/zapal/frappe-bench/apps/frappe/socketio.js
|
||||
depends_on:
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
required: true
|
||||
image: zapal-tech/erp:latest
|
||||
networks:
|
||||
default: null
|
||||
volumes:
|
||||
- type: volume
|
||||
source: sites
|
||||
target: /home/zapal/frappe-bench/sites
|
||||
volume: {}
|
||||
networks:
|
||||
default:
|
||||
name: erp_default
|
||||
volumes:
|
||||
db-data:
|
||||
name: erp_db-data
|
||||
redis-cache-data:
|
||||
name: erp_redis-cache-data
|
||||
redis-queue-data:
|
||||
name: erp_redis-queue-data
|
||||
sites:
|
||||
name: erp_sites
|
||||
x-backend-defaults:
|
||||
depends_on:
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
image: zapal-tech/erp:latest
|
||||
volumes:
|
||||
- sites:/home/zapal/frappe-bench/sites
|
||||
x-customizable-image:
|
||||
image: zapal-tech/erp:latest
|
||||
x-depends-on-configurator:
|
||||
depends_on:
|
||||
configurator:
|
||||
condition: service_completed_successfully
|
||||
|
|
@ -121,19 +121,25 @@ RUN bench init \
|
|||
--no-backups \
|
||||
--skip-redis-config-generation \
|
||||
--verbose \
|
||||
/home/zapal/frappe-bench && \
|
||||
cd /home/zapal/frappe-bench && \
|
||||
bench get-app --branch=${ERPNEXT_BRANCH} --resolve-deps erpnext ${ERPNEXT_REPO} && \
|
||||
bench get-app --branch=${HRMS_BRANCH} --resolve-deps hrms ${HRMS_REPO} && \
|
||||
bench get-app --branch=${INSIGHTS_BRANCH} --resolve-deps insights ${INSIGHTS_REPO} && \
|
||||
echo "{}" > sites/common_site_config.json && \
|
||||
find apps -mindepth 1 -path "*/.git" | xargs rm -fr
|
||||
/home/zapal/frappe-bench
|
||||
|
||||
WORKDIR /home/zapal/frappe-bench
|
||||
|
||||
RUN bench get-app --branch=${ERPNEXT_BRANCH} --resolve-deps erpnext ${ERPNEXT_REPO}
|
||||
RUN bench get-app --branch=${HRMS_BRANCH} --resolve-deps hrms ${HRMS_REPO}
|
||||
# RUN bench get-app --branch=${INSIGHTS_BRANCH} --resolve-deps insights ${INSIGHTS_REPO}
|
||||
|
||||
RUN echo "frappe\nhrms\nerpnext" > sites/apps.txt
|
||||
RUN echo "{}" > sites/common_site_config.json
|
||||
RUN find apps -mindepth 1 -path "*/.git" | xargs rm -fr
|
||||
|
||||
FROM base as erp
|
||||
|
||||
USER zapal
|
||||
|
||||
COPY --from=builder --chown=zapal:zapal /home/zapal/frappe-bench /home/zapal/frappe-bench
|
||||
COPY /templates/nginx/erp.conf.template /templates/nginx/erp.conf.template
|
||||
COPY /usr/local/bin/nginx-entrypoint.sh /usr/local/bin/nginx-entrypoint.sh
|
||||
|
||||
WORKDIR /home/zapal/frappe-bench
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ ARG NODE_VERSION=18.18.2
|
|||
ENV NVM_DIR=/home/zapal/.nvm
|
||||
ENV PATH ${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}
|
||||
|
||||
COPY resources/nginx-template.conf /templates/nginx/erp.conf.template
|
||||
COPY resources/nginx-entrypoint.sh /usr/local/bin/nginx-entrypoint.sh
|
||||
|
||||
RUN useradd -ms /bin/bash zapal \
|
||||
&& apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
|
|
@ -64,10 +67,9 @@ RUN useradd -ms /bin/bash zapal \
|
|||
&& chown -R zapal:zapal /etc/nginx/nginx.conf \
|
||||
&& chown -R zapal:zapal /var/log/nginx \
|
||||
&& chown -R zapal:zapal /var/lib/nginx \
|
||||
&& chown -R zapal:zapal /run/nginx.pid
|
||||
|
||||
COPY resources/nginx-template.conf /templates/nginx/erp.conf.template
|
||||
COPY resources/nginx-entrypoint.sh /usr/local/bin/nginx-entrypoint.sh
|
||||
&& chown -R zapal:zapal /run/nginx.pid \
|
||||
&& chmod 755 /usr/local/bin/nginx-entrypoint.sh \
|
||||
&& chmod 644 /templates/nginx/erp.conf.template
|
||||
|
||||
FROM base AS builder
|
||||
|
||||
|
|
@ -113,13 +115,17 @@ RUN bench init \
|
|||
--no-backups \
|
||||
--skip-redis-config-generation \
|
||||
--verbose \
|
||||
/home/zapal/frappe-bench && \
|
||||
cd /home/zapal/frappe-bench && \
|
||||
bench get-app --branch=${ERPNEXT_BRANCH} --resolve-deps erpnext ${ERPNEXT_REPO} && \
|
||||
bench get-app --branch=${HRMS_BRANCH} --resolve-deps hrms ${HRMS_REPO} && \
|
||||
bench get-app --branch=${INSIGHTS_BRANCH} --resolve-deps insights ${INSIGHTS_REPO} && \
|
||||
echo "{}" > sites/common_site_config.json && \
|
||||
find apps -mindepth 1 -path "*/.git" | xargs rm -fr
|
||||
/home/zapal/frappe-bench
|
||||
|
||||
WORKDIR /home/zapal/frappe-bench
|
||||
|
||||
RUN bench get-app --branch=${ERPNEXT_BRANCH} --resolve-deps erpnext ${ERPNEXT_REPO}
|
||||
RUN bench get-app --branch=${HRMS_BRANCH} --resolve-deps hrms ${HRMS_REPO}
|
||||
# RUN bench get-app --branch=${INSIGHTS_BRANCH} --resolve-deps insights ${INSIGHTS_REPO}
|
||||
|
||||
RUN echo "frappe\nhrms\nerpnext" > sites/apps.txt
|
||||
RUN echo "{}" > sites/common_site_config.json
|
||||
RUN find apps -mindepth 1 -path "*/.git" | xargs rm -fr
|
||||
|
||||
FROM base as erp
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
# Set variables that do not exist
|
||||
if [[ -z "$BACKEND" ]]; then
|
||||
echo "BACKEND defaulting to 0.0.0.0:8900"
|
||||
export BACKEND=0.0.0.0:8900
|
||||
echo "BACKEND defaulting to 0.0.0.0:8000"
|
||||
export BACKEND=0.0.0.0:8000
|
||||
fi
|
||||
if [[ -z "$SOCKETIO" ]]; then
|
||||
echo "SOCKETIO defaulting to 0.0.0.0:8910"
|
||||
export SOCKETIO=0.0.0.0:8910
|
||||
echo "SOCKETIO defaulting to 0.0.0.0:9000"
|
||||
export SOCKETIO=0.0.0.0:9000
|
||||
fi
|
||||
if [[ -z "$UPSTREAM_REAL_IP_ADDRESS" ]]; then
|
||||
echo "UPSTREAM_REAL_IP_ADDRESS defaulting to 127.0.0.1"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ upstream socketio-server {
|
|||
|
||||
server {
|
||||
listen 8080;
|
||||
server_name ${FRAPPE_SITE_NAME_HEADER};
|
||||
root /home/zapal/frappe-bench/sites;
|
||||
|
||||
proxy_buffer_size 128k;
|
||||
|
|
|
|||
Loading…
Reference in a new issue