From 627426645d9ec8b5b47bfdc234695092de3c3c99 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Wed, 18 Jan 2023 22:59:10 +0530 Subject: [PATCH 01/45] refactor: add documentation --- .github/dependabot.yml | 6 +- .github/workflows/build_latest.yaml | 58 ----- .github/workflows/build_tags.yaml | 64 ------ .gitlab-ci.yml | 67 ------ LICENSE | 2 +- README.md | 57 +---- base_versions.json | 4 - ci/clone-apps.sh | 22 -- compose/configure-erpnext.yml | 32 +++ compose/create-site.yml | 36 +++ compose/erpnext-backup.yml | 58 +++++ compose/erpnext.yml | 207 ++++++++++++++++++ compose/mariadb.yml | 28 +++ compose/portainer-dind.yml | 34 +++ compose/portainer.yml | 52 +++++ compose/swarm-cron.yml | 15 ++ compose/traefik-dind.yml | 60 +++++ compose/traefik-host.yml | 60 +++++ devcontainer/compose.yml | 6 +- development/setup.sh | 4 +- dind-devcontainer/Dockerfile | 7 + dind-devcontainer/compose.yml | 63 ++++++ dind-devcontainer/devcontainer.json | 15 ++ dind-devcontainer/setup-docker-env.sh | 8 + docker-bake.hcl | 44 ---- development/README.md => docs/devcontainer.md | 9 +- docs/docker-swarm.md | 177 +++++++++++++++ docs/{k8s-bench.md => kube-devcontainer.md} | 81 +++---- images/backend.Dockerfile | 13 -- images/frontend.Dockerfile | 41 ---- kube-devcontainer/Dockerfile | 17 ++ kube-devcontainer/compose.yml | 79 +++++++ kube-devcontainer/devcontainer.json | 15 ++ kube-devcontainer/entrypoint.sh | 7 + kube-devcontainer/registries.yaml | 4 + version.txt | 1 - 36 files changed, 1022 insertions(+), 431 deletions(-) delete mode 100644 .github/workflows/build_latest.yaml delete mode 100644 .github/workflows/build_tags.yaml delete mode 100644 .gitlab-ci.yml delete mode 100644 base_versions.json delete mode 100755 ci/clone-apps.sh create mode 100644 compose/configure-erpnext.yml create mode 100644 compose/create-site.yml create mode 100644 compose/erpnext-backup.yml create mode 100644 compose/erpnext.yml create mode 100644 compose/mariadb.yml create mode 100644 compose/portainer-dind.yml create mode 100644 compose/portainer.yml create mode 100644 compose/swarm-cron.yml create mode 100644 compose/traefik-dind.yml create mode 100644 compose/traefik-host.yml create mode 100644 dind-devcontainer/Dockerfile create mode 100644 dind-devcontainer/compose.yml create mode 100644 dind-devcontainer/devcontainer.json create mode 100755 dind-devcontainer/setup-docker-env.sh delete mode 100644 docker-bake.hcl rename development/README.md => docs/devcontainer.md (80%) create mode 100644 docs/docker-swarm.md rename docs/{k8s-bench.md => kube-devcontainer.md} (75%) delete mode 100644 images/backend.Dockerfile delete mode 100644 images/frontend.Dockerfile create mode 100644 kube-devcontainer/Dockerfile create mode 100644 kube-devcontainer/compose.yml create mode 100644 kube-devcontainer/devcontainer.json create mode 100755 kube-devcontainer/entrypoint.sh create mode 100644 kube-devcontainer/registries.yaml delete mode 100644 version.txt diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ca298ce..270b809 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,11 +1,11 @@ version: 2 updates: - - package-ecosystem: github-actions - directory: / + - package-ecosystem: docker + directory: devcontainer schedule: interval: daily - package-ecosystem: docker - directory: images + directory: kube-devcontainer schedule: interval: daily diff --git a/.github/workflows/build_latest.yaml b/.github/workflows/build_latest.yaml deleted file mode 100644 index 40a1e7e..0000000 --- a/.github/workflows/build_latest.yaml +++ /dev/null @@ -1,58 +0,0 @@ -name: Build latest images - -on: - push: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Clone custom apps - run: ./ci/clone-apps.sh - env: - PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - - - name: Setup QEMU - uses: docker/setup-qemu-action@v2 - with: - image: tonistiigi/binfmt:latest - platforms: all - - - name: Setup Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Get Base Versions - id: get-base-versions - run: | - echo "::set-output name=FRAPPE_VERSION::$(jq -r .frappe base_versions.json)" - echo "::set-output name=ERPNEXT_VERSION::$(jq -r .erpnext base_versions.json)" - - - name: Get Repo - id: get-repo - run: echo "::set-output name=REPOSITORY::${GITHUB_REPOSITORY#*/}" - - - name: Push - uses: docker/bake-action@v2.3.0 - with: - push: true - no-cache: true - # set: "*.platform=linux/amd64,linux/arm64" - env: - FRAPPE_VERSION: ${{ steps.get-base-versions.outputs.FRAPPE_VERSION }} - ERPNEXT_VERSION: ${{ steps.get-base-versions.outputs.ERPNEXT_VERSION }} - REGISTRY_NAME: ghcr.io/${{ github.repository_owner }} - VERSION: latest - BACKEND_IMAGE_NAME: ${{ steps.get-repo.outputs.REPOSITORY }}/worker - FRONTEND_IMAGE_NAME: ${{ steps.get-repo.outputs.REPOSITORY }}/nginx diff --git a/.github/workflows/build_tags.yaml b/.github/workflows/build_tags.yaml deleted file mode 100644 index f936d47..0000000 --- a/.github/workflows/build_tags.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: Build tagged images - -on: - push: - branches: - - main - paths: - - version.txt - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Clone custom apps - run: ./ci/clone-apps.sh - env: - PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - - - name: Setup QEMU - uses: docker/setup-qemu-action@v2 - with: - image: tonistiigi/binfmt:latest - platforms: all - - - name: Setup Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Get Base Versions - id: get-base-versions - run: | - echo "::set-output name=FRAPPE_VERSION::$(jq -r .frappe base_versions.json)" - echo "::set-output name=ERPNEXT_VERSION::$(jq -r .erpnext base_versions.json)" - - - name: Get Version - id: get-version - run: echo "::set-output name=VERSION::$(cat version.txt)" - - - name: Get Repo - id: get-repo - run: echo "::set-output name=REPOSITORY::${GITHUB_REPOSITORY#*/}" - - - name: Push - uses: docker/bake-action@v2.3.0 - with: - push: true - no-cache: true - # set: "*.platform=linux/amd64,linux/arm64" - env: - FRAPPE_VERSION: ${{ steps.get-base-versions.outputs.FRAPPE_VERSION }} - ERPNEXT_VERSION: ${{ steps.get-base-versions.outputs.ERPNEXT_VERSION }} - REGISTRY_NAME: ghcr.io/${{ github.repository_owner }} - VERSION: ${{ steps.get-version.outputs.VERSION }} - BACKEND_IMAGE_NAME: ${{ steps.get-repo.outputs.REPOSITORY }}/worker - FRONTEND_IMAGE_NAME: ${{ steps.get-repo.outputs.REPOSITORY }}/nginx diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 9ca85b2..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,67 +0,0 @@ -image: docker:latest - -stages: - - build - - deploy - -services: - - docker:dind - -build_latest: - stage: build - only: - - main - before_script: - # Install os dependencies - - apk --update add openssh-client git jq curl - # Login to container registry - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com - # Install buildx - - mkdir -p $HOME/.docker/cli-plugins - - curl -sSLo $HOME/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.8.2/buildx-v0.8.2.linux-amd64 - - chmod +x ~/.docker/cli-plugins/docker-buildx - - docker buildx create --name ci_build_latest --use - script: - - ./ci/clone-apps.sh - - export FRAPPE_VERSION=$(jq -r .frappe base_versions.json) - - export ERPNEXT_VERSION=$(jq -r .erpnext base_versions.json) - - export VERSION=latest - - export REGISTRY_NAME=${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME} - - export BACKEND_IMAGE_NAME=worker - - export FRONTEND_IMAGE_NAME=nginx - - docker buildx bake --push - # Cleanup runner - - docker buildx stop ci_build_latest - - docker buildx rm ci_build_latest - - docker volume prune -f - -build_version: - stage: build - only: - refs: - - main - changes: - - version.txt - before_script: - # Install os dependencies - - apk --update add openssh-client git jq curl - # Login to container registry - - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com - # Install buildx - - mkdir -p $HOME/.docker/cli-plugins - - curl -sSLo $HOME/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.8.2/buildx-v0.8.2.linux-amd64 - - chmod +x ~/.docker/cli-plugins/docker-buildx - - docker buildx create --name ci_build_version --use - script: - - ./ci/clone-apps.sh - - export FRAPPE_VERSION=$(jq -r .frappe base_versions.json) - - export ERPNEXT_VERSION=$(jq -r .erpnext base_versions.json) - - export VERSION=$(cat version.txt) - - export REGISTRY_NAME=${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME} - - export BACKEND_IMAGE_NAME=worker - - export FRONTEND_IMAGE_NAME=nginx - - docker buildx bake --push - # Cleanup runner - - docker buildx stop ci_build_version - - docker buildx rm ci_build_version - - docker volume prune -f diff --git a/LICENSE b/LICENSE index 5bcd546..c0021fb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2021 Castlecraft Ecommerce Pvt. Ltd. +Copyright 2023 Castlecraft Ecommerce Pvt. Ltd. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index 6809b37..cc7dfb3 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,9 @@ -### Introduction +#### Note: For old custom image building references and links check `compat-2022` branch -- This repo is based on official frappe_docker documentation to build [custom apps](https://github.com/frappe/frappe_docker/blob/main/custom_app/README.md). -- Fork this repo to build your own image with ERPNext and list of custom Frappe apps. -- Change the `frappe` and `erpnext` versions in `base_versions.json` to use them as base. These values correspond to tags and branch names on the github frappe and erpnext repo. e.g. `version-14`, `v14.18.1` -- Change `ci/clone-apps.sh` script to clone your private and public apps. Read comments in the file to update it as per need. This repo will install following apps: - - https://github.com/castlecraft/cfe - - https://github.com/castlecraft/microsoft_integration -- Change `images/backend.Dockerfile` to copy and install required apps with `install-app`. -- Change `images/frontend.Dockerfile` to install ERPNext if required. -- Change `docker-bake.hcl` for builds as per need. -- Workflows from `.github/workflows` will build latest or tagged images using GitHub. Change as per need. -- Runner will build images automatically and publish to container registry. -- Use `gitlab-ci.yml` in case of Gitlab CI. +From Jan 2023, Official frappe_docker has easy process to build custom images. Refer the [official guide](https://github.com/frappe/frappe_docker/blob/main/docs/custom-apps.md). -### Manually Build images +## Topics -Execute from root of app repo - -Clone, - -```shell -./ci/clone-apps.sh -``` - -Set environment variables, - -- `FRAPPE_VERSION` set to use frappe version during building images. Default is `version-14`. -- `ERPNEXT_VERSION` set to use erpnext version during building images. Default is `version-14`. -- `VERSION` set the tag version. Default is `latest`. -- `REGISTRY_NAME` set the registry name. Default is `custom_app`. -- `BACKEND_IMAGE_NAME` set worker image name. Default is `custom_worker`. -- `FRONTEND_IMAGE_NAME` set nginx image name. Default is `custom_nginx`. - -Build, - -```shell -docker buildx bake -f docker-bake.hcl --load -``` - -Note: - -- Use `docker buildx bake --load` to load images for usage with docker. -- Use `docker buildx bake --push` to push images to registry. -- Use `docker buildx bake --help` for more information. -- Change version in `version.txt` to build tagged images from the changed version. - -### Development - -Refer development directory to [start development](development/README.md) - -### K8s Bench - -Refer docs directory to use [Kubernetes Bench Operator](docs/k8s-bench.md) +- [Frappe apps on Kubernetes](docs/kube-devcontainer.md) +- [Frappe apps on Docker Swarm](docs/docker-swarm.md) +- [Custom Devcontainer](docs/devcontainer.md) diff --git a/base_versions.json b/base_versions.json deleted file mode 100644 index b4e0a1f..0000000 --- a/base_versions.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "frappe": "v14.18.1", - "erpnext": "v14.10.0" -} diff --git a/ci/clone-apps.sh b/ci/clone-apps.sh deleted file mode 100755 index 51d494e..0000000 --- a/ci/clone-apps.sh +++ /dev/null @@ -1,22 +0,0 @@ -# !/bin/bash - -# Use PAT or ssh for private repos. - -## To use SSH keys place the private key as ssh-keys/ci and uncomment following -# mkdir -p repos ~/.ssh -# chown 0600 ssh-keys/ci -# chown 0700 ~/.ssh -# ssh-keyscan -t rsa git.example.com >> ~/.ssh/known_hosts -# eval $(ssh-agent -s) -# ssh-add ssh-keys/ci - -## To clone private repos through ssh use following instead of https. -# git clone --depth 1 --branch master ssh://git@github.com/frappe/twilio-integration repos/twilio_integration - -## To use PAT use PERSONAL_ACCESS_TOKEN environment variable which is set through CI secret. -# git clone --depth 1 --branch master https://username:${PERSONAL_ACCESS_TOKEN}@github.com/frappe/twilio-integration repos/twilio_integration - -# Following are public repositories. - -git clone --depth 1 --branch main https://github.com/castlecraft/cfe repos/castlecraft -git clone --depth 1 --branch main https://github.com/castlecraft/microsoft_integration repos/microsoft_integration diff --git a/compose/configure-erpnext.yml b/compose/configure-erpnext.yml new file mode 100644 index 0000000..2b68298 --- /dev/null +++ b/compose/configure-erpnext.yml @@ -0,0 +1,32 @@ +version: '3.7' + +services: + configurator: + image: frappe/erpnext:${VERSION:?No image version set} + volumes: + - sites:/home/frappe/frappe-bench/sites + entrypoint: ["bash", "-c"] + command: + - > + 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_SOCKETIO"; + bench set-config -gp socketio_port $$SOCKETIO_PORT; + deploy: + restart_policy: + condition: none + environment: + DB_HOST: mariadb_db + DB_PORT: 3306 + REDIS_CACHE: redis-cache:6379 + REDIS_QUEUE: redis-queue:6379 + REDIS_SOCKETIO: redis-socketio:6379 + SOCKETIO_PORT: 9000 + +volumes: + sites: + external: true + # set to name of the sites volume + name: ${BENCH_NAME:-erpnext}_sites diff --git a/compose/create-site.yml b/compose/create-site.yml new file mode 100644 index 0000000..0b4b678 --- /dev/null +++ b/compose/create-site.yml @@ -0,0 +1,36 @@ +version: '3.7' + +services: + configurator: + image: frappe/erpnext:${VERSION:?No image version set} + volumes: + - sites:/home/frappe/frappe-bench/sites + command: + - bench + - new-site + - --no-mariadb-socket + - --install-app=payments + - --install-app=erpnext + - --db-root-password=admin + - --admin-password=admin + - erp.example.com + deploy: + restart_policy: + condition: none + networks: + - mariadb-network + - bench-network + +volumes: + sites: + external: true + # set to name of the sites volume + name: ${BENCH_NAME:-erpnext}_sites + +networks: + bench-network: + name: ${BENCH_NAME:-erpnext} + external: true + mariadb-network: + name: mariadb-network + external: true diff --git a/compose/erpnext-backup.yml b/compose/erpnext-backup.yml new file mode 100644 index 0000000..4ccf0eb --- /dev/null +++ b/compose/erpnext-backup.yml @@ -0,0 +1,58 @@ +version: "3.7" +services: + backup-sites: + deploy: + mode: replicated + replicas: 0 + labels: + - "swarm.cronjob.enable=true" + - "swarm.cronjob.schedule=0 */6 * * *" + - "swarm.cronjob.skip-running=false" + restart_policy: + condition: none + image: frappe/erpnext:${VERSION:?No image version set} + entrypoint: ["bash", "-c"] + command: + - | + bench backup-all-sites + + ## Uncomment for restic snapshots + # restic snapshots || restic init + # restic backup sites + + ## Uncomment to delete last snapshot number more than 10 + # SNAPSHOT_COUNT=`restic -q list snapshots | wc -l`; export SNAPSHOT_COUNT + # if [[ $$SNAPSHOT_COUNT -gt 10 ]]; then + # restic forget `restic -q list snapshots | tail -1` + # restic prune + # fi + environment: + - RESTIC_REPOSITORY=s3:https://s3.endpoint.com/restic + - AWS_ACCESS_KEY_ID=access_key + - AWS_SECRET_ACCESS_KEY=secret_access_key + - RESTIC_PASSWORD=secret_restic_password + volumes: + - "sites:/home/frappe/frappe-bench/sites" + +networks: + bench-network: + name: ${BENCH_NAME:-erpnext} + external: true + mariadb-network: + name: mariadb-network + external: true + +volumes: + sites: + external: true + # set to name of the sites volume + name: ${BENCH_NAME:-erpnext}_sites + +# Set following environment variables +# VERSION +# RESTIC_REPOSITORY +# AWS_ACCESS_KEY_ID +# AWS_SECRET_ACCESS_KEY +# RESTIC_PASSWORD +# BENCH_NAME +# SITES_VOLUME_NAME diff --git a/compose/erpnext.yml b/compose/erpnext.yml new file mode 100644 index 0000000..5029a10 --- /dev/null +++ b/compose/erpnext.yml @@ -0,0 +1,207 @@ +version: "3.7" + +services: + backend: + image: frappe/erpnext:${VERSION:?No image version set} + deploy: + restart_policy: + condition: on-failure + volumes: + - sites:/home/frappe/frappe-bench/sites + - logs:/home/frappe/frappe-bench/logs + networks: + - mariadb-network + - bench-network + + frontend: + image: frappe/erpnext:${VERSION} + command: + - nginx-entrypoint.sh + deploy: + restart_policy: + condition: on-failure + labels: + - traefik.enable=true + - traefik.docker.network=traefik-public + - traefik.constraint-label=traefik-public + - traefik.http.middlewares.prod-redirect.redirectscheme.scheme=https + # Change router name prefix from erpnext to the name of stack in case of multi bench setup + - traefik.http.routers.${BENCH_NAME:-erpnext}-http.rule=Host(${SITES:?No sites set}) + - traefik.http.routers.${BENCH_NAME:-erpnext}-http.entrypoints=http + # Remove following lines in case of local setup + - traefik.http.routers.${BENCH_NAME:-erpnext}-http.middlewares=prod-redirect + - traefik.http.routers.${BENCH_NAME:-erpnext}-https.rule=Host(${SITES}) + - traefik.http.routers.${BENCH_NAME:-erpnext}-https.entrypoints=https + - traefik.http.routers.${BENCH_NAME:-erpnext}-https.tls=true + - traefik.http.routers.${BENCH_NAME:-erpnext}-https.tls.certresolver=le + # Remove above lines in case of local setup + # Uncomment and change domain for non-www to www redirect + # - traefik.http.routers.${BENCH_NAME:-erpnext}-https.middlewares=nonwwwtowww + # - traefik.http.middlewares.nonwwwtowww.redirectregex.regex=^https?://(?:www\.)?(.*) + # - traefik.http.middlewares.nonwwwtowww.redirectregex.replacement=https://www.$$1 + - traefik.http.services.${BENCH_NAME:-erpnext}.loadbalancer.server.port=8080 + environment: + BACKEND: backend:8000 + FRAPPE_SITE_NAME_HEADER: $$host + SOCKETIO: websocket:9000 + UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1 + UPSTREAM_REAL_IP_HEADER: X-Forwarded-For + UPSTREAM_REAL_IP_RECURSIVE: "off" + volumes: + - sites:/home/frappe/frappe-bench/sites + - logs:/home/frappe/frappe-bench/logs + networks: + - bench-network + - traefik-public + + queue-default: + image: frappe/erpnext:${VERSION} + deploy: + restart_policy: + condition: on-failure + command: + - bench + - worker + - --queue + - default + volumes: + - sites:/home/frappe/frappe-bench/sites + - logs:/home/frappe/frappe-bench/logs + networks: + - mariadb-network + - bench-network + + queue-long: + image: frappe/erpnext:${VERSION} + deploy: + restart_policy: + condition: on-failure + command: + - bench + - worker + - --queue + - long + volumes: + - sites:/home/frappe/frappe-bench/sites + - logs:/home/frappe/frappe-bench/logs + networks: + - mariadb-network + - bench-network + + queue-short: + image: frappe/erpnext:${VERSION} + deploy: + restart_policy: + condition: on-failure + command: + - bench + - worker + - --queue + - short + volumes: + - sites:/home/frappe/frappe-bench/sites + - logs:/home/frappe/frappe-bench/logs + networks: + - mariadb-network + - bench-network + + scheduler: + image: frappe/erpnext:${VERSION} + deploy: + restart_policy: + condition: on-failure + command: + - bench + - schedule + volumes: + - sites:/home/frappe/frappe-bench/sites + - logs:/home/frappe/frappe-bench/logs + networks: + - mariadb-network + - bench-network + + websocket: + image: frappe/erpnext:${VERSION} + command: + - node + - /home/frappe/frappe-bench/apps/frappe/socketio.js + deploy: + restart_policy: + condition: on-failure + volumes: + - sites:/home/frappe/frappe-bench/sites + - logs:/home/frappe/frappe-bench/logs + networks: + - mariadb-network + - bench-network + + migration: + image: frappe/erpnext:${VERSION} + deploy: + restart_policy: + condition: none + entrypoint: ["bash", "-c"] + command: + - | + bench --site all set-config -p maintenance_mode 1 + bench --site all set-config -p pause_scheduler 1 + bench --site all migrate + bench --site all set-config -p maintenance_mode 0 + bench --site all set-config -p pause_scheduler 0 + volumes: + - sites:/home/frappe/frappe-bench/sites + - logs:/home/frappe/frappe-bench/logs + networks: + - mariadb-network + - bench-network + + redis-cache: + image: redis:6.2-alpine + deploy: + restart_policy: + condition: on-failure + volumes: + - redis-cache-data:/data + networks: + - bench-network + + redis-queue: + image: redis:6.2-alpine + deploy: + restart_policy: + condition: on-failure + volumes: + - redis-queue-data:/data + networks: + - bench-network + + redis-socketio: + image: redis:6.2-alpine + deploy: + restart_policy: + condition: on-failure + volumes: + - redis-socketio-data:/data + networks: + - bench-network + +volumes: + db-data: + redis-cache-data: + redis-queue-data: + redis-socketio-data: + sites: + logs: + +networks: + bench-network: + name: ${BENCH_NAME:-erpnext} + external: false + mariadb-network: + name: mariadb-network + external: true + traefik-public: + name: traefik-public + external: true + +# Note: set VERSION, BENCH_NAME and SITES diff --git a/compose/mariadb.yml b/compose/mariadb.yml new file mode 100644 index 0000000..45a920c --- /dev/null +++ b/compose/mariadb.yml @@ -0,0 +1,28 @@ +version: "3.7" + +services: + db: + image: mariadb:10.6 + healthcheck: + test: mysqladmin ping -h localhost --password=${DB_PASSWORD:-admin} + interval: 1s + retries: 15 + command: + - --character-set-server=utf8mb4 + - --collation-server=utf8mb4_unicode_ci + - --skip-character-set-client-handshake + - --skip-innodb-read-only-compressed + environment: + MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-admin} + volumes: + - db-data:/var/lib/mysql + networks: + - mariadb-network + +volumes: + db-data: + +networks: + mariadb-network: + name: mariadb-network + attachable: true diff --git a/compose/portainer-dind.yml b/compose/portainer-dind.yml new file mode 100644 index 0000000..66d052d --- /dev/null +++ b/compose/portainer-dind.yml @@ -0,0 +1,34 @@ +version: '3.7' + +services: + portainer: + image: portainer/portainer-ce:2.16.2 + command: --tlsskipverify + volumes: + - portainer-data:/data + networks: + - traefik-public + deploy: + placement: + constraints: + - node.role == manager + - node.labels.portainer.portainer-data == true + labels: + - traefik.enable=true + - traefik.docker.network=traefik-public + - traefik.constraint-label=traefik-public + - traefik.http.routers.portainer-http.rule=Host(`${PORTAINER_DOMAIN?Variable not set}`) + - traefik.http.routers.portainer-http.entrypoints=http + - traefik.http.routers.portainer-http.middlewares=https-redirect + - traefik.http.routers.portainer-https.rule=Host(`${PORTAINER_DOMAIN}`) + - traefik.http.routers.portainer-https.entrypoints=https + - traefik.http.routers.portainer-https.tls=true + - traefik.http.routers.portainer-https.tls.certresolver=le + - traefik.http.services.portainer.loadbalancer.server.port=9000 + +networks: + traefik-public: + external: true + +volumes: + portainer-data: diff --git a/compose/portainer.yml b/compose/portainer.yml new file mode 100644 index 0000000..a3c74df --- /dev/null +++ b/compose/portainer.yml @@ -0,0 +1,52 @@ +version: '3.7' + +services: + agent: + image: portainer/agent:2.16.2 + environment: + AGENT_CLUSTER_ADDR: tasks.agent + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - /var/lib/docker/volumes:/var/lib/docker/volumes + networks: + - agent-network + deploy: + mode: global + placement: + constraints: + - node.platform.os == linux + + portainer: + image: portainer/portainer-ce:2.16.2 + command: -H tcp://tasks.agent:9001 --tlsskipverify + volumes: + - portainer-data:/data + networks: + - agent-network + - traefik-public + deploy: + placement: + constraints: + - node.role == manager + - node.labels.portainer.portainer-data == true + labels: + - traefik.enable=true + - traefik.docker.network=traefik-public + - traefik.constraint-label=traefik-public + - traefik.http.routers.portainer-http.rule=Host(`${PORTAINER_DOMAIN?Variable not set}`) + - traefik.http.routers.portainer-http.entrypoints=http + - traefik.http.routers.portainer-http.middlewares=https-redirect + - traefik.http.routers.portainer-https.rule=Host(`${PORTAINER_DOMAIN}`) + - traefik.http.routers.portainer-https.entrypoints=https + - traefik.http.routers.portainer-https.tls=true + - traefik.http.routers.portainer-https.tls.certresolver=le + - traefik.http.services.portainer.loadbalancer.server.port=9000 + +networks: + agent-network: + attachable: true + traefik-public: + external: true + +volumes: + portainer-data: diff --git a/compose/swarm-cron.yml b/compose/swarm-cron.yml new file mode 100644 index 0000000..1ff2d1c --- /dev/null +++ b/compose/swarm-cron.yml @@ -0,0 +1,15 @@ +version: "3.2" + +services: + swarm-cronjob: + image: crazymax/swarm-cronjob + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + environment: + - "TZ=Asia/Kolkata" + - "LOG_LEVEL=info" + - "LOG_JSON=false" + deploy: + placement: + constraints: + - node.role == manager diff --git a/compose/traefik-dind.yml b/compose/traefik-dind.yml new file mode 100644 index 0000000..c0fcd9b --- /dev/null +++ b/compose/traefik-dind.yml @@ -0,0 +1,60 @@ +version: '3.7' + +services: + traefik: + image: traefik:${TRAEFIK_VERSION:-v2.9} + ports: + - target: 80 + published: 80 + mode: host + - target: 443 + published: 443 + mode: host + deploy: + placement: + constraints: + # Required for the TLS certificates + - node.labels.traefik-public.traefik-public-certificates == true + labels: + - traefik.enable=true + - traefik.docker.network=traefik-public + - traefik.constraint-label=traefik-public + - traefik.http.middlewares.admin-auth.basicauth.users=admin:${HASHED_PASSWORD?Variable not set} + - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https + - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true + - traefik.http.routers.traefik-public-http.rule=Host(`${TRAEFIK_DOMAIN?Variable not set}`) + - traefik.http.routers.traefik-public-http.entrypoints=http + - traefik.http.routers.traefik-public-http.middlewares=https-redirect + - traefik.http.routers.traefik-public-https.rule=Host(`${TRAEFIK_DOMAIN}`) + - traefik.http.routers.traefik-public-https.entrypoints=https + - traefik.http.routers.traefik-public-https.tls=true + - traefik.http.routers.traefik-public-https.service=api@internal + - traefik.http.routers.traefik-public-https.tls.certresolver=le + - traefik.http.routers.traefik-public-https.middlewares=admin-auth + - traefik.http.services.traefik-public.loadbalancer.server.port=8080 + volumes: + - traefik-public-certificates:/certificates + command: + - --providers.docker + - --providers.docker.constraints=Label(`traefik.constraint-label`, `traefik-public`) + - --providers.docker.exposedbydefault=false + - --providers.docker.endpoint=tcp://${DOCKER_API} + - --providers.docker.swarmmode + - --entrypoints.http.address=:80 + - --entrypoints.https.address=:443 + - --certificatesresolvers.le.acme.email=${EMAIL?Variable not set} + - --certificatesresolvers.le.acme.storage=/certificates/acme.json + - --certificatesresolvers.le.acme.tlschallenge=true + - --accesslog + - --log + - --api + networks: + - traefik-public + +volumes: + traefik-public-certificates: + +networks: + traefik-public: + name: traefik-public + attachable: true diff --git a/compose/traefik-host.yml b/compose/traefik-host.yml new file mode 100644 index 0000000..31e974c --- /dev/null +++ b/compose/traefik-host.yml @@ -0,0 +1,60 @@ +version: '3.7' + +services: + traefik: + image: traefik:${TRAEFIK_VERSION:-v2.9} + ports: + - target: 80 + published: 80 + mode: host + - target: 443 + published: 443 + mode: host + deploy: + placement: + constraints: + # Required for the TLS certificates + - node.labels.traefik-public.traefik-public-certificates == true + labels: + - traefik.enable=true + - traefik.docker.network=traefik-public + - traefik.constraint-label=traefik-public + - traefik.http.middlewares.admin-auth.basicauth.users=admin:${HASHED_PASSWORD?Variable not set} + - traefik.http.middlewares.https-redirect.redirectscheme.scheme=https + - traefik.http.middlewares.https-redirect.redirectscheme.permanent=true + - traefik.http.routers.traefik-public-http.rule=Host(`${TRAEFIK_DOMAIN?Variable not set}`) + - traefik.http.routers.traefik-public-http.entrypoints=http + - traefik.http.routers.traefik-public-http.middlewares=https-redirect + - traefik.http.routers.traefik-public-https.rule=Host(`${TRAEFIK_DOMAIN}`) + - traefik.http.routers.traefik-public-https.entrypoints=https + - traefik.http.routers.traefik-public-https.tls=true + - traefik.http.routers.traefik-public-https.service=api@internal + - traefik.http.routers.traefik-public-https.tls.certresolver=le + - traefik.http.routers.traefik-public-https.middlewares=admin-auth + - traefik.http.services.traefik-public.loadbalancer.server.port=8080 + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + - traefik-public-certificates:/certificates + command: + - --providers.docker + - --providers.docker.constraints=Label(`traefik.constraint-label`, `traefik-public`) + - --providers.docker.exposedbydefault=false + - --providers.docker.swarmmode + - --entrypoints.http.address=:80 + - --entrypoints.https.address=:443 + - --certificatesresolvers.le.acme.email=${EMAIL?Variable not set} + - --certificatesresolvers.le.acme.storage=/certificates/acme.json + - --certificatesresolvers.le.acme.tlschallenge=true + - --accesslog + - --log + - --api + networks: + - traefik-public + +volumes: + traefik-public-certificates: + +networks: + traefik-public: + name: traefik-public + attachable: true diff --git a/devcontainer/compose.yml b/devcontainer/compose.yml index d911a91..8b4f244 100644 --- a/devcontainer/compose.yml +++ b/devcontainer/compose.yml @@ -27,12 +27,12 @@ services: # volumes: # - "/tmp/.X11-unix:/tmp/.X11-unix:rw" # ports: - # - "8080:8080" + # - "9090:9090" # environment: # MODE: tcp # XPRA_HTML: "yes" # DISPLAY: ":14" - # XPRA_TCP_PORT: "8080" + # XPRA_TCP_PORT: "9090" # # This password can be anything you want. # XPRA_PASSWORD: admin @@ -59,7 +59,7 @@ services: # - 3143:3143 # - 3465:3465 # - 3993:3993 - # - 8800:8080 + # - 8080:8080 # # Enable PostgreSQL only if you use it, see development/README.md for more information. # postgresql: diff --git a/development/setup.sh b/development/setup.sh index 7f9afa9..dc292b0 100755 --- a/development/setup.sh +++ b/development/setup.sh @@ -22,11 +22,9 @@ echo "Set redis_socketio to redis://redis-socketio:6379" bench set-config -g redis_socketio redis://redis-socketio:6379 # Create custom.localhost site -echo "Create custom.localhost, install apps castlecraft, microsoft_integration" +echo "Create http://custom.localhost:8000 site" bench new-site \ --no-mariadb-socket \ --db-root-password=123 \ --admin-password=admin \ - --install-app=castlecraft \ - --install-app=microsoft_integration \ custom.localhost diff --git a/dind-devcontainer/Dockerfile b/dind-devcontainer/Dockerfile new file mode 100644 index 0000000..40771c0 --- /dev/null +++ b/dind-devcontainer/Dockerfile @@ -0,0 +1,7 @@ +FROM frappe/bench:latest + +# Install Docker +RUN sudo apt-get update && sudo apt-get install -y jq httpie && \ + curl -fsSL https://get.docker.com | sudo bash + +ENV DOCKER_HOST=docker diff --git a/dind-devcontainer/compose.yml b/dind-devcontainer/compose.yml new file mode 100644 index 0000000..2ddc8cb --- /dev/null +++ b/dind-devcontainer/compose.yml @@ -0,0 +1,63 @@ +version: "3.7" + +services: + mariadb: + image: bitnami/mariadb:10.6 + environment: + MARIADB_CHARACTER_SET: utf8mb4 + MARIADB_COLLATE: utf8mb4_unicode_ci + MARIADB_ROOT_PASSWORD: 123 + MARIADB_EXTRA_FLAGS: --skip-character-set-client-handshake --skip-innodb-read-only-compressed + volumes: + - mariadb:/bitnami/mariadb + restart: unless-stopped + + redis-cache: + image: redis:alpine + + redis-queue: + image: redis:alpine + + redis-socketio: + image: redis:alpine + + frappe: + build: . + command: ["tail", "-f", "/dev/null"] + environment: + - SHELL=/bin/bash + - DOCKER_HOST=docker + volumes: + - ..:/workspace + - ${HOME}/.ssh:/home/frappe/.ssh + working_dir: /workspace/development + ports: + - 8000-8005:8000-8005 + - 9000-9005:9000-9005 + extra_hosts: + - custom.localhost:172.17.0.1 + + registry: + image: registry:2 + volumes: + - registry:/var/lib/registry + environment: + - REGISTRY_STORAGE_DELETE_ENABLED=true + + docker: + image: docker:20.10.16-dind + command: + - dockerd + - --host=0.0.0.0:2375 + - --insecure-registry=registry:5000 + privileged: true + volumes: + - docker:/var/lib/docker + ports: + - 443:443 + - 80:80 + +volumes: + mariadb: + registry: + docker: diff --git a/dind-devcontainer/devcontainer.json b/dind-devcontainer/devcontainer.json new file mode 100644 index 0000000..e3d60c6 --- /dev/null +++ b/dind-devcontainer/devcontainer.json @@ -0,0 +1,15 @@ +{ + "name": "Frappe Bench for Kube dev", + "remoteUser": "frappe", + "settings": { + "debug.node.autoAttach": "disabled" + }, + "dockerComposeFile": "./compose.yml", + "service": "frappe", + "workspaceFolder": "/workspace/development", + "shutdownAction": "stopCompose", + "extensions": [ + "ms-python.python", + "visualstudioexptteam.vscodeintellicode" + ] +} diff --git a/dind-devcontainer/setup-docker-env.sh b/dind-devcontainer/setup-docker-env.sh new file mode 100755 index 0000000..7e68eff --- /dev/null +++ b/dind-devcontainer/setup-docker-env.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +DOCKER_IP=$(ping -c 2 docker | awk -F '[()]' '/PING/ { print $2}') +export DOCKER_IP +DOCKER_PORT=2375 +export DOCKER_PORT +DOCKER_API="${DOCKER_IP}:${DOCKER_PORT}" +export DOCKER_API diff --git a/docker-bake.hcl b/docker-bake.hcl deleted file mode 100644 index f4e5b4d..0000000 --- a/docker-bake.hcl +++ /dev/null @@ -1,44 +0,0 @@ -variable "FRAPPE_VERSION" { - default = "version-14" -} - -variable "ERPNEXT_VERSION" { - default = "version-14" -} - -variable "REGISTRY_NAME" { - default = "custom_images" -} - -variable "BACKEND_IMAGE_NAME" { - default = "custom_worker" -} - -variable "FRONTEND_IMAGE_NAME" { - default = "custom_nginx" -} - -variable "VERSION" { - default = "latest" -} - -group "default" { - targets = ["backend", "frontend"] -} - -target "backend" { - dockerfile = "images/backend.Dockerfile" - tags = ["${REGISTRY_NAME}/${BACKEND_IMAGE_NAME}:${VERSION}"] - args = { - "ERPNEXT_VERSION" = ERPNEXT_VERSION - } -} - -target "frontend" { - dockerfile = "images/frontend.Dockerfile" - tags = ["${REGISTRY_NAME}/${FRONTEND_IMAGE_NAME}:${VERSION}"] - args = { - "FRAPPE_VERSION" = FRAPPE_VERSION - "ERPNEXT_VERSION" = ERPNEXT_VERSION - } -} diff --git a/development/README.md b/docs/devcontainer.md similarity index 80% rename from development/README.md rename to docs/devcontainer.md index 097e72b..161d2fd 100644 --- a/development/README.md +++ b/docs/devcontainer.md @@ -1,11 +1,4 @@ -## Prerequisites - -- Install docker and docker compose cli plugin -- Add SSH keys to git for easy access to repo -- Copy `devcontainer` directory to `.devcontainer`. -- Copy `development/vscode-example` to `development/.vscode`. - -## Setup +## Setup VS Code devcontainers Reopen in VS Code devcontainer, enter the `frappe` container. diff --git a/docs/docker-swarm.md b/docs/docker-swarm.md new file mode 100644 index 0000000..b42173c --- /dev/null +++ b/docs/docker-swarm.md @@ -0,0 +1,177 @@ +## Topics + +- [Install Prerequisites](#install-prerequisites) +- [Setup Docker Swarm](#setup-docker-swarm) +- [Setup Traefik](#setup-traefik) +- [Setup Portainer](#setup-portainer) +- [Setup MariaDB](#setup-mariadb) +- [Setup Swarm CRON](#setup-swarm-cron) +- [Setup ERPNext](#setup-erpnext) + +### Install Prerequisites + +These steps are required for production server. For dind/local setup copy `dind-devcontainer` to `.devcontainer` and reopen in devcontainer. + +Use files from `compose` directory. + +Setup assumes you are using Debian based Linux distribution. + +Update packages + +```shell +apt-get update && apt-get dist-upgrade -y +``` + +Setup unattended upgrades + +```shell +dpkg-reconfigure --priority=low unattended-upgrades +``` + +Add non-root sudo user + +```shell +adduser -D craft +usermod -aG sudo craft +curl -fsSL https://get.docker.com | bash +usermod -aG docker craft +su - craft +``` + +### Setup Docker Swarm + +Initialize swarm + +```shell +docker swarm init --advertise-addr=X.X.X.X +``` + +Note: Make sure the advertise-address does not change if you wish to add multiple nodes to this manager. + +Comprehensive guide available at [dockerswarm.rocks](https://dockerswarm.rocks) + +### Setup Traefik + +Label the master node to install Traefik + +```shell +docker node update --label-add traefik-public.traefik-public-certificates=true $(docker info -f '{{.Swarm.NodeID}}') +``` + +Set email and traefik domain + +```shell +export EMAIL=admin@example.com +export TRAEFIK_DOMAIN=traefik.example.com +# or for dind +export TRAEFIK_DOMAIN=traefik.localhost +``` + +Set `HASHED_PASSWORD` + +```shell +export HASHED_PASSWORD=$(openssl passwd -apr1) +Password: $ enter your password here +Verifying - Password: $ re enter your password here +``` + +Note: + +Install Traefik in production + +```shell +docker stack deploy -c compose/traefik-host.yml traefik +``` + +Install Traefik in dind + +```shell +source /workspace/dind-devcontainer/setup-docker-env.sh +docker stack deploy -c /workspace/compose/traefik-dind.yml traefik +``` + +More on [Traefik](https://dockerswarm.rocks/traefik/) + +### Setup Portainer + +Label the master node to install portainer + +```shell +docker node update --label-add portainer.portainer-data=true $(docker info -f '{{.Swarm.NodeID}}') +``` + +Set portainer domain + +```shell +export PORTAINER_DOMAIN=portainer.example.com +# or +export PORTAINER_DOMAIN=portainer.localhost +``` + +Install Portainer in production + +```shell +docker stack deploy -c compose/portainer.yml portainer +``` + +Install Portainer in dind + +```shell +docker stack deploy -c /workspace/compose/portainer-dind.yml portainer +``` + +
+ +Additional commands for dind only + +Initialize portainer + +```shell +export PORTAINER_PASSWORD=supersecretpassword +http POST https://docker/api/users/admin/init "Host: portainer.localhost" Username="admin" Password="${PORTAINER_PASSWORD}" --follow --verify=no +``` + +Get bearer token + +```shell +export TOKEN=$(http POST https://docker/api/auth "Host: portainer.localhost" Username=admin Password=${PORTAINER_PASSWORD} --follow --verify=no | jq -r .jwt) +``` + +Add endpoint + +```shell +source /workspace/dind-devcontainer/setup-docker-env.sh +http POST \ + https://docker/api/endpoints \ + "Authorization:Bearer $TOKEN" \ + "Host:portainer.localhost" \ + Name=dind EndpointCreationType=1 URL=tcp://$DOCKER_API \ + --follow \ + --form \ + --verify=no +``` + +
+ +More on [portainer](https://dockerswarm.rocks/portainer) + +### Setup MariaDB + +- Go to Stacks > Add and create stack called `mariadb`. +- Set `DB_PASSWORD` environment variable to set mariadb root password. Defaults to `admin`. +- Use `compose/mariadb.yml` to create the stack. + +### Setup Swarm CRON + +In case of docker setup there is not CRON scheduler running. It is needed to take periodic backups. + +- Go to Stacks > Add and create stack called `swarm-cron`. +- Use `compose/swarm-cron.yml` to create the stack. +- Change the `TZ` environment variable as per your timezone. + +### Setup ERPNext + +- `compose/erpnext.yml`: Use to create the `erpnext` stack. Set `VERSION` to version of choice. e.g. `v14.13.0`. Set `SITES` variable as list of sites quoted in back tick (`` ` ``) and separated by comma (`,`). Example ``SITES=`one.example.com`,`two.example.com` ``. +- `compose/configure-erpnext.yml`: Use to setup `sites/common_site_config.json`. Set `VERSION` and `SITES_VOLUME_NAME` environment variables. +- Exec into the `backend` container and create sites with `bench new-site --no-mariadb-socket` command. +- `compose/erpnext-backup.yml`: Use to setup automatic backups add with appropriate changes in file for restic snapshots and snapshot pruning diff --git a/docs/k8s-bench.md b/docs/kube-devcontainer.md similarity index 75% rename from docs/k8s-bench.md rename to docs/kube-devcontainer.md index ee27202..fc3b1bc 100644 --- a/docs/k8s-bench.md +++ b/docs/kube-devcontainer.md @@ -1,4 +1,4 @@ -## Topics +## K3s + frappe framework with VS Code devcontainers - [Provision K8s](#provision-k8s) - [Provision Loadbalancer Service](#provision-loadbalancer-service) @@ -7,26 +7,30 @@ - [Setup ERPNext](#setup-erpnext) - [Setup Bench Operator](#setup-bench-operator) - [ReST API Call](#rest-api-call) +- [Teardown](#teardown) ### Provision K8s -For local testing we'll use k3d. For more information and installation guide refer https://k3d.io +For local development we'll use k3s in container. It can be used with VS Code devcontainer for ease of use. + +Clone this repo and copy example directory to begin. ```shell -k3d cluster create devcluster \ - --api-port 127.0.0.1:6443 \ - -p 80:80@loadbalancer \ - -p 443:443@loadbalancer \ - --k3s-arg "--disable=traefik@server:0" \ - --k3s-arg '--kubelet-arg=eviction-hard=imagefs.available<1%,nodefs.available<1%@agent:*' \ - --k3s-arg '--kubelet-arg=eviction-minimum-reclaim=imagefs.available=1%,nodefs.available=1%@agent:*' \ - --k3s-arg '--kubelet-arg=eviction-hard=imagefs.available<1%,nodefs.available<1%@server:0' \ - --k3s-arg '--kubelet-arg=eviction-minimum-reclaim=imagefs.available=1%,nodefs.available=1%@server:0' +git clone https://github.com/castlecraft/custom_frappe_docker +cd custom_frappe_docker +cp -R kube-devcontainer .devcontainer ``` +Reopen in VS Code devcontainer. +Or start `.devcontainer/compose.yml` and enter `frappe` container. + +All the necessary cli tools and k3s based cluster will be available for development. `kubectl` and `git` plugin for zsh is also installed. Check or update the `.devcontainer/Dockerfile` for more. + ### Provision Loadbalancer Service -We're using ingress-nginx from https://kubernetes.github.io/ingress-nginx/deploy/#gce-gke. On installation it will add a LoadBalancer service to cluster and provision cloud load balancer from provider. +Port 80 and 443 of k3s container is published but no service runs there. We'll add ingress controller which will simulate a LoadBalancer service and start serving port 80 and 443. + +We're using ingress-nginx from https://kubernetes.github.io/ingress-nginx/deploy/#gce-gke. On installation it will add a LoadBalancer service to cluster and provision cloud load balancer from provider in production. ```shell kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.5.1/deploy/static/provider/cloud/deploy.yaml @@ -37,7 +41,7 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/cont In case of Production setup use HA file system like AWS EFS, Google Filestore, Managed NFS, Ceph, etc. If you choose such service then backups, snapshots and restores are taken care of and no need for frappe/erpnext to manage it. -For local, evaluation or basic setup we will use in-cluster NFS server and provision Storage Class. +For local, evaluation, development or basic setup we will use in-cluster NFS server and provision Storage Class. ```shell kubectl create namespace nfs @@ -48,12 +52,11 @@ helm upgrade --install -n nfs in-cluster nfs-ganesha-server-and-external-provisi Notes: - Change the persistence.size from 8Gi to required specification. -- In case of in-cluster nfs server make sure you setup a backup CronJob refer: https://gist.github.com/revant/2414cedce8e19d209d5d337ea19efabc - +- In case of in-cluster nfs server that runs in production make sure you setup a backup CronJob refer: https://gist.github.com/revant/2414cedce8e19d209d5d337ea19efabc ### Provision Database -In case of production setup use AWS RDS, Google Sky SQL, or Managed MariaDB Service that is configurable for frappe specific param group properties. +In case of production setup use AWS RDS, Google Sky SQL, or Managed MariaDB Service that is configurable for frappe specific param group properties. For simple or development setup we will install in-cluster MariaDB Helm chart with following command: ```shell export FRAPPE_MARIADB_CNF=$(cat <"${KUBECONFIG}" +fi + +exec "$@" diff --git a/kube-devcontainer/registries.yaml b/kube-devcontainer/registries.yaml new file mode 100644 index 0000000..21b79df --- /dev/null +++ b/kube-devcontainer/registries.yaml @@ -0,0 +1,4 @@ +mirrors: + "registry:5000": + endpoint: + - http://registry:5000 diff --git a/version.txt b/version.txt deleted file mode 100644 index afaf360..0000000 --- a/version.txt +++ /dev/null @@ -1 +0,0 @@ -1.0.0 \ No newline at end of file From 40697456a09d0eb7dbc2dae4101dc45b91afe4bc Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Wed, 18 Jan 2023 23:20:05 +0530 Subject: [PATCH 02/45] docs: docker swarm backup and new-site --- compose/erpnext-backup.yml | 1 - docs/docker-swarm.md | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/compose/erpnext-backup.yml b/compose/erpnext-backup.yml index 4ccf0eb..8aa6da4 100644 --- a/compose/erpnext-backup.yml +++ b/compose/erpnext-backup.yml @@ -55,4 +55,3 @@ volumes: # AWS_SECRET_ACCESS_KEY # RESTIC_PASSWORD # BENCH_NAME -# SITES_VOLUME_NAME diff --git a/docs/docker-swarm.md b/docs/docker-swarm.md index b42173c..98e1cc9 100644 --- a/docs/docker-swarm.md +++ b/docs/docker-swarm.md @@ -171,7 +171,7 @@ In case of docker setup there is not CRON scheduler running. It is needed to tak ### Setup ERPNext -- `compose/erpnext.yml`: Use to create the `erpnext` stack. Set `VERSION` to version of choice. e.g. `v14.13.0`. Set `SITES` variable as list of sites quoted in back tick (`` ` ``) and separated by comma (`,`). Example ``SITES=`one.example.com`,`two.example.com` ``. -- `compose/configure-erpnext.yml`: Use to setup `sites/common_site_config.json`. Set `VERSION` and `SITES_VOLUME_NAME` environment variables. -- Exec into the `backend` container and create sites with `bench new-site --no-mariadb-socket` command. -- `compose/erpnext-backup.yml`: Use to setup automatic backups add with appropriate changes in file for restic snapshots and snapshot pruning +- `compose/erpnext.yml`: Use to create the `erpnext` stack. Set `VERSION` to version of choice. e.g. `v14.13.0`. Set `SITES` variable as list of sites quoted in back tick (`` ` ``) and separated by comma (`,`). Example ``SITES=`one.example.com`,`two.example.com` ``. Set `BENCH_NAME` optionally in case of multiple benches, defaults to `erpnext`. +- `compose/configure-erpnext.yml`: Use to setup `sites/common_site_config.json`. Set `VERSION` and optionally `BENCH_NAME` environment variables. +- `compose/create-site.yml`: Use to create a site. Set `VERSION` and optionally `BENCH_NAME` environment variables. +- `compose/erpnext-backup.yml`: Use to backup and push snapshots. Set environment variables mentioned in comments in the file. From 29bb72480b637825d542eb9fba9ded6825b58d0b Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Wed, 18 Jan 2023 23:21:58 +0530 Subject: [PATCH 03/45] docs: fix create-site command info --- docs/docker-swarm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docker-swarm.md b/docs/docker-swarm.md index 98e1cc9..993dfd2 100644 --- a/docs/docker-swarm.md +++ b/docs/docker-swarm.md @@ -173,5 +173,5 @@ In case of docker setup there is not CRON scheduler running. It is needed to tak - `compose/erpnext.yml`: Use to create the `erpnext` stack. Set `VERSION` to version of choice. e.g. `v14.13.0`. Set `SITES` variable as list of sites quoted in back tick (`` ` ``) and separated by comma (`,`). Example ``SITES=`one.example.com`,`two.example.com` ``. Set `BENCH_NAME` optionally in case of multiple benches, defaults to `erpnext`. - `compose/configure-erpnext.yml`: Use to setup `sites/common_site_config.json`. Set `VERSION` and optionally `BENCH_NAME` environment variables. -- `compose/create-site.yml`: Use to create a site. Set `VERSION` and optionally `BENCH_NAME` environment variables. +- `compose/create-site.yml`: Use to create a site. Set `VERSION` and optionally `BENCH_NAME` environment variables. Change the command for site name, apps to be installed, admin password and db root password. - `compose/erpnext-backup.yml`: Use to backup and push snapshots. Set environment variables mentioned in comments in the file. From d6ad07fc3caa2098d7cf6ac94d62978d2b6d1e84 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Mon, 23 Jan 2023 18:36:09 +0530 Subject: [PATCH 04/45] docs: non interactive unattended-upgrade --- docs/docker-swarm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docker-swarm.md b/docs/docker-swarm.md index 993dfd2..ea3ba17 100644 --- a/docs/docker-swarm.md +++ b/docs/docker-swarm.md @@ -25,7 +25,7 @@ apt-get update && apt-get dist-upgrade -y Setup unattended upgrades ```shell -dpkg-reconfigure --priority=low unattended-upgrades +dpkg-reconfigure --priority=medium unattended-upgrades ``` Add non-root sudo user From f668958eec612caecc10ab429686b3e4a419d2df Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Mon, 23 Jan 2023 22:28:59 +0530 Subject: [PATCH 05/45] docs: documentation k3s setup for gitlab runner gitlab job with api trigger --- README.md | 2 ++ docs/k3s-cluster.md | 71 +++++++++++++++++++++++++++++++++++++++++++++ docs/runner-api.md | 63 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 docs/k3s-cluster.md create mode 100644 docs/runner-api.md diff --git a/README.md b/README.md index cc7dfb3..9132e0f 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,5 @@ From Jan 2023, Official frappe_docker has easy process to build custom images. R - [Frappe apps on Kubernetes](docs/kube-devcontainer.md) - [Frappe apps on Docker Swarm](docs/docker-swarm.md) - [Custom Devcontainer](docs/devcontainer.md) +- [Setup Kubernetes cluster with k3s](docs/k3s-cluster.md) +- [CI Runner Build API](docs/runner-api.md) \ No newline at end of file diff --git a/docs/k3s-cluster.md b/docs/k3s-cluster.md new file mode 100644 index 0000000..52a3001 --- /dev/null +++ b/docs/k3s-cluster.md @@ -0,0 +1,71 @@ +## Topics + +- [Install Prerequisites](#install-prerequisites) +- [Create K3s configuration](#create-k3s-configuration) +- [Setup K3s](#setup-k3s) +- [Setup Calico net](#setup-calico-net) + +### Install Prerequisites + +Update packages + +```shell +apt-get update && apt-get dist-upgrade -y +``` + +Setup unattended upgrades + +```shell +dpkg-reconfigure --priority=medium unattended-upgrades +``` + +Add swap for dev/CI setup + +```shell +sudo fallocate -l 4G /swapfile +sudo chmod 600 /swapfile +sudo mkswap /swapfile +sudo swapon /swapfile +sudo cp /etc/fstab /etc/fstab.bak +echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab +``` + +### Create K3s configuration + +Create file `/etc/rancher/k3s/config.yaml` with following. + +```yaml +write-kubeconfig-mode: "0644" +disable: traefik +cluster-init: true +flannel-backend: none +disable-network-policy: true +token: "changeit" +``` + +Place the file in all servers and agents. + +### Setup K3s + +Add odd number of server(s), start with 1. + +```shell +curl -sfL https://get.k3s.io | sh - +``` + +Add agents (optional) + +```shell +curl -sfL https://get.k3s.io | K3S_URL=https://${SERVER_IP}:6443 sh +``` + +Note: set `$SERVER_IP` to ip of the server / internal lb + +### Setup Calico net + +Source: https://projectcalico.docs.tigera.io/getting-started/kubernetes/k3s/quickstart + +```shell +kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/tigera-operator.yaml +kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.25.0/manifests/custom-resources.yaml +``` diff --git a/docs/runner-api.md b/docs/runner-api.md new file mode 100644 index 0000000..f488080 --- /dev/null +++ b/docs/runner-api.md @@ -0,0 +1,63 @@ +## Gitlab + +```yaml +stages: + - build + +build_version: + stage: build + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + only: + refs: + - main + script: + - | + mkdir -p /kaniko/.docker + export BASIC_AUTH=$(echo -n ${CI_REGISTRY_USER}:${CI_JOB_TOKEN} | base64) + echo "{ + \"auths\": { + \"${CI_REGISTRY:-registry.gitlab.com}\":{ + \"auth\": \"${BASIC_AUTH}\" + } + } + }" > /kaniko/.docker/config.json + /kaniko/executor \ + --dockerfile=images/custom/Containerfile \ + --context=${BUILD_CONTEXT:-git://github.com/frappe/frappe_docker} \ + --build-arg=FRAPPE_PATH=${FRAPPE_PATH:-https://github.com/frappe/frappe} \ + --build-arg=FRAPPE_BRANCH=${FRAPPE_BRANCH:-v14.23.0} \ + --build-arg=PYTHON_VERSION=${PYTHON_VERSION:-3.10.5} \ + --build-arg=NODE_VERSION=${NODE_VERSION:-16.18.0} \ + --build-arg=APPS_JSON_BASE64=${APPS_JSON_BASE64:-$(base64 -w 0 apps.json)} \ + --destination=${IMAGE_NAME:-registry.gitlab.com/castlecraft/cepl-erpnext-images/apps:${VERSION:-$(cat version.txt)}} \ + --cache=true +``` + +#### Variables Used + +- `VERSION`, set it for the tag version of image to be built and pushed, default reads from version.txt file from repo. +- `CI_REGISTRY_USER`, set it to the container registry user +- `CI_JOB_TOKEN`, set it to the container registry password +- `CI_REGISTRY`, set it to the container registry url. (compatible with docker hub) +- `BUILD_CONTEXT`, set it to the kaniko build context, default: `git://github.com/frappe/frappe_docker` +- `FRAPPE_PATH`, set it to the frappe repo url, default `https://github.com/frappe/frappe` +- `FRAPPE_BRANCH`, set it to the frappe repo branch, default `v14.23.0` +- `PYTHON_VERSION`, set it to python version to be used, default `3.10.5` +- `NODE_VERSION`, set it to nodejs version to be used, default `16.18.0` +- `APPS_JSON_BASE64`, set it to base64 encoded apps.json, default apps.json from repo will be used. +- `IMAGE_NAME`, set it to image name without the tag. default `registry.gitlab.com/castlecraft/cepl-erpnext-images/apps` + +#### Curl command + +```shell +curl -X POST \ + --fail \ + -F token=$TOKEN \ + -F "ref=$REF_NAME" \ + -F "variables[VERSION]=nightly" \ + -F "variables[IMAGE_NAME]=registry.gitlab.com/orgname/project/image" \ + -F "variables[APPS_JSON_BASE64]=W3sidXJsIjoiaHR0cHM6Ly9naXRodWIuY29tL2ZyYXBwZS9wYXltZW50cyIsImJyYW5jaCI6ImRldmVsb3AifV0=" \ + https://gitlab.com/api/v4/projects/$PROJECT_ID/trigger/pipeline +``` From 4745129f02d20045f5c5f39dcc45cf41d0c6bc56 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 24 Jan 2023 06:36:43 +0530 Subject: [PATCH 06/45] ci: add github and gitlab ci --- .github/dependabot.yml | 5 +++ .github/workflows/build.yaml | 81 ++++++++++++++++++++++++++++++++++++ .gitlab-ci.yml | 35 ++++++++++++++++ ci/apps.json | 14 +++++++ ci/build.env | 9 ++++ ci/version.txt | 1 + 6 files changed, 145 insertions(+) create mode 100644 .github/workflows/build.yaml create mode 100644 .gitlab-ci.yml create mode 100644 ci/apps.json create mode 100644 ci/build.env create mode 100644 ci/version.txt diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 270b809..5d22377 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,3 +9,8 @@ updates: directory: kube-devcontainer schedule: interval: daily + + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..909e829 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,81 @@ +name: Build Image + +on: + push: + branches: + - main + + workflow_dispatch: + inputs: + image: + description: Image name + type: string + version: + description: Image version tag + type: string + frappe-repo: + description: Frappe repo + type: string + frappe-version: + description: Frappe branch + type: string + py-version: + description: Python version + type: string + nodejs-version: + description: NodeJS version + type: string + apps-json-base64: + description: base64 encoded string of apps.json + type: string + context: + description: kaniko context + type: string + dockerfile: + description: dockerfile path from context + type: string + registry-user: + description: registry username + required: false + + secrets: + REGISTRY_PASSWORD: + description: registry password + required: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Source Build Env + id: source-build-env + run: | + cat ./ci/build.env >> $GITHUB_ENV + echo "VERSION=$(cat ./ci/version.txt)" >> $GITHUB_ENV + echo "APPS_JSON_BASE64=$(base64 -w 0 ./ci/apps.json)" >> $GITHUB_ENV + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ inputs.registry || env.REGISTRY }} + username: ${{ inputs.registry-user || github.actor }} + password: ${{ secrets.REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }} + + - uses: int128/kaniko-action@v1 + with: + push: true + tags: | + ghcr.io/${{ github.repository }}/${{ inputs.image || env.IMAGE }}:${{ inputs.version || env.VERSION }}, + ghcr.io/${{ github.repository }}/${{ inputs.image || env.IMAGE }}:latest + cache: true + build-args: | + FRAPPE_PATH=${{ inputs.frappe-repo || env.FRAPPE_REPO }} + FRAPPE_BRANCH=${{ inputs.frappe-version || env.FRAPPE_VERSION }} + PYTHON_VERSION=${{ inputs.py-version || env.PY_VERSION }} + NODE_VERSION=${{ inputs.nodejs-version || env.NODEJS_VERSION }} + APPS_JSON_BASE64=${{ inputs.apps-json-base64 || env.APPS_JSON_BASE64 }} + context: ${{ inputs.context || env.CONTEXT }} + file: ${{ inputs.dockerfile || env.DOCKERFILE }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..596211c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,35 @@ +stages: + - build + +build_version: + stage: build + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + only: + refs: + - main + script: + - | + source ./ci/build.env + mkdir -p /kaniko/.docker + export IMAGE_NAME=${CI_REGISTRY:-${REGISTRY}}/${CI_PROJECT_NAMESPACE:-${PROJECT_NAMESPACE}}/${IMAGE_NAME:-${IMAGE}} + export BASIC_AUTH=$(echo -n ${CI_REGISTRY_USER}:${CI_JOB_TOKEN} | base64) + echo "{ + \"auths\": { + \"${CI_REGISTRY:-${REGISTRY}}\":{ + \"auth\": \"${BASIC_AUTH}\" + } + } + }" > /kaniko/.docker/config.json + /kaniko/executor \ + --dockerfile=${CONTAINERFILE:-${DOCKERFILE}} \ + --context=${BUILD_CONTEXT:-${CONTEXT}} \ + --build-arg=FRAPPE_PATH=${FRAPPE_PATH:-${FRAPPE_REPO}} \ + --build-arg=FRAPPE_BRANCH=${FRAPPE_BRANCH:-${FRAPPE_VERSION}} \ + --build-arg=PYTHON_VERSION=${PYTHON_VERSION:-${PY_VERSION}} \ + --build-arg=NODE_VERSION=${NODE_VERSION:-${NODEJS_VERSION}} \ + --build-arg=APPS_JSON_BASE64=${APPS_JSON_BASE64:-$(base64 -w 0 ./ci/apps.json)} \ + --destination=${IMAGE_NAME}:${VERSION:-$(cat ./ci/version.txt)} \ + --destination=${IMAGE_NAME}:latest \ + --cache=true diff --git a/ci/apps.json b/ci/apps.json new file mode 100644 index 0000000..ca37ea3 --- /dev/null +++ b/ci/apps.json @@ -0,0 +1,14 @@ +[ + { + "url": "https://github.com/frappe/payments.git", + "branch": "develop" + }, + { + "url": "https://github.com/frappe/erpnext.git", + "branch": "v14.13.0" + }, + { + "url": "https://github.com/resilient-tech/india-compliance.git", + "branch": "v14.1.1" + } +] diff --git a/ci/build.env b/ci/build.env new file mode 100644 index 0000000..18abf2b --- /dev/null +++ b/ci/build.env @@ -0,0 +1,9 @@ +REGISTRY=ghcr.io +PROJECT_NAMESPACE=castlecraft +IMAGE=apps +FRAPPE_REPO=https://github.com/frappe/frappe +FRAPPE_VERSION=v14.23.0 +PY_VERSION=3.10.5 +NODEJS_VERSION=16.18.0 +CONTEXT=git://github.com/frappe/frappe_docker +DOCKERFILE=images/custom/Containerfile diff --git a/ci/version.txt b/ci/version.txt new file mode 100644 index 0000000..98b0fc5 --- /dev/null +++ b/ci/version.txt @@ -0,0 +1 @@ +14.13.0 \ No newline at end of file From f0aa0a1a33c804b181713de376e234334f216381 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 24 Jan 2023 06:42:54 +0530 Subject: [PATCH 07/45] ci: install docker --- .github/workflows/build.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 909e829..bd738cd 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -57,6 +57,9 @@ jobs: echo "VERSION=$(cat ./ci/version.txt)" >> $GITHUB_ENV echo "APPS_JSON_BASE64=$(base64 -w 0 ./ci/apps.json)" >> $GITHUB_ENV + - name: Install docker + run: curl -fsSL https://get.docker.com | bash + - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: From 0703f4d2aafcb4a1be2791609a5f213686a5706e Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 24 Jan 2023 06:45:05 +0530 Subject: [PATCH 08/45] ci: link docker --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bd738cd..f2c2d1e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -57,8 +57,8 @@ jobs: echo "VERSION=$(cat ./ci/version.txt)" >> $GITHUB_ENV echo "APPS_JSON_BASE64=$(base64 -w 0 ./ci/apps.json)" >> $GITHUB_ENV - - name: Install docker - run: curl -fsSL https://get.docker.com | bash + - name: Link docker + run: ln -s `which docker` /usr/bin/docker - name: Login to GitHub Container Registry uses: docker/login-action@v2 From 2c759afe46947b0d9f4ecf108d229399b5e5e7b6 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 24 Jan 2023 06:45:57 +0530 Subject: [PATCH 09/45] ci: remove docker step --- .github/workflows/build.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f2c2d1e..909e829 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -57,9 +57,6 @@ jobs: echo "VERSION=$(cat ./ci/version.txt)" >> $GITHUB_ENV echo "APPS_JSON_BASE64=$(base64 -w 0 ./ci/apps.json)" >> $GITHUB_ENV - - name: Link docker - run: ln -s `which docker` /usr/bin/docker - - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: From bea38c9b4ef32d66535e76d15de3400296e8b0c6 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 24 Jan 2023 06:47:47 +0530 Subject: [PATCH 10/45] ci: comma separate build args --- .github/workflows/build.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 909e829..20a759c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -72,10 +72,10 @@ jobs: ghcr.io/${{ github.repository }}/${{ inputs.image || env.IMAGE }}:latest cache: true build-args: | - FRAPPE_PATH=${{ inputs.frappe-repo || env.FRAPPE_REPO }} - FRAPPE_BRANCH=${{ inputs.frappe-version || env.FRAPPE_VERSION }} - PYTHON_VERSION=${{ inputs.py-version || env.PY_VERSION }} - NODE_VERSION=${{ inputs.nodejs-version || env.NODEJS_VERSION }} - APPS_JSON_BASE64=${{ inputs.apps-json-base64 || env.APPS_JSON_BASE64 }} + FRAPPE_PATH=${{ inputs.frappe-repo || env.FRAPPE_REPO }}, + FRAPPE_BRANCH=${{ inputs.frappe-version || env.FRAPPE_VERSION }}, + PYTHON_VERSION=${{ inputs.py-version || env.PY_VERSION }}, + NODE_VERSION=${{ inputs.nodejs-version || env.NODEJS_VERSION }}, + APPS_JSON_BASE64=${{ inputs.apps-json-base64 || env.APPS_JSON_BASE64 }}, context: ${{ inputs.context || env.CONTEXT }} file: ${{ inputs.dockerfile || env.DOCKERFILE }} From 0113546b01b5cbbae3451ad2e340454f002a6da4 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 24 Jan 2023 06:51:54 +0530 Subject: [PATCH 11/45] ci: set default context --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 20a759c..0fe3843 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -77,5 +77,5 @@ jobs: PYTHON_VERSION=${{ inputs.py-version || env.PY_VERSION }}, NODE_VERSION=${{ inputs.nodejs-version || env.NODEJS_VERSION }}, APPS_JSON_BASE64=${{ inputs.apps-json-base64 || env.APPS_JSON_BASE64 }}, - context: ${{ inputs.context || env.CONTEXT }} + context: ${{ inputs.context || "git://github.com/frappe/frappe_docker" }} file: ${{ inputs.dockerfile || env.DOCKERFILE }} From 839286bc5a5d81a7115f4f31e7624e2710778a26 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 24 Jan 2023 06:53:56 +0530 Subject: [PATCH 12/45] ci: set context thru args --- .github/workflows/build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0fe3843..208d92d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -77,5 +77,6 @@ jobs: PYTHON_VERSION=${{ inputs.py-version || env.PY_VERSION }}, NODE_VERSION=${{ inputs.nodejs-version || env.NODEJS_VERSION }}, APPS_JSON_BASE64=${{ inputs.apps-json-base64 || env.APPS_JSON_BASE64 }}, - context: ${{ inputs.context || "git://github.com/frappe/frappe_docker" }} + kaniko-args: | + --context=${{ inputs.context || env.CONTEXT }} file: ${{ inputs.dockerfile || env.DOCKERFILE }} From 43b8ef0c592847072271c014a3d640c1cf8e5e48 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 24 Jan 2023 06:56:22 +0530 Subject: [PATCH 13/45] ci: set dest thru args --- .github/workflows/build.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 208d92d..d9e262c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -67,9 +67,6 @@ jobs: - uses: int128/kaniko-action@v1 with: push: true - tags: | - ghcr.io/${{ github.repository }}/${{ inputs.image || env.IMAGE }}:${{ inputs.version || env.VERSION }}, - ghcr.io/${{ github.repository }}/${{ inputs.image || env.IMAGE }}:latest cache: true build-args: | FRAPPE_PATH=${{ inputs.frappe-repo || env.FRAPPE_REPO }}, @@ -78,5 +75,7 @@ jobs: NODE_VERSION=${{ inputs.nodejs-version || env.NODEJS_VERSION }}, APPS_JSON_BASE64=${{ inputs.apps-json-base64 || env.APPS_JSON_BASE64 }}, kaniko-args: | - --context=${{ inputs.context || env.CONTEXT }} + --context=${{ inputs.context || env.CONTEXT }}, + --destination=ghcr.io/${{ github.repository }}/${{ inputs.image || env.IMAGE }}:${{ inputs.version || env.VERSION }}, + --destination=ghcr.io/${{ github.repository }}/${{ inputs.image || env.IMAGE }}:latest file: ${{ inputs.dockerfile || env.DOCKERFILE }} From b695b2394e2b8bcd7f26debb80f53f74410e13cb Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 24 Jan 2023 07:00:26 +0530 Subject: [PATCH 14/45] ci: set all args thru kaniko-args --- .github/workflows/build.yaml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d9e262c..ffb8a8f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -68,14 +68,13 @@ jobs: with: push: true cache: true - build-args: | - FRAPPE_PATH=${{ inputs.frappe-repo || env.FRAPPE_REPO }}, - FRAPPE_BRANCH=${{ inputs.frappe-version || env.FRAPPE_VERSION }}, - PYTHON_VERSION=${{ inputs.py-version || env.PY_VERSION }}, - NODE_VERSION=${{ inputs.nodejs-version || env.NODEJS_VERSION }}, - APPS_JSON_BASE64=${{ inputs.apps-json-base64 || env.APPS_JSON_BASE64 }}, kaniko-args: | - --context=${{ inputs.context || env.CONTEXT }}, - --destination=ghcr.io/${{ github.repository }}/${{ inputs.image || env.IMAGE }}:${{ inputs.version || env.VERSION }}, + --build-arg=FRAPPE_PATH=${{ inputs.frappe-repo || env.FRAPPE_REPO }} + --build-arg=FRAPPE_BRANCH=${{ inputs.frappe-version || env.FRAPPE_VERSION }} + --build-arg=PYTHON_VERSION=${{ inputs.py-version || env.PY_VERSION }} + --build-arg=NODE_VERSION=${{ inputs.nodejs-version || env.NODEJS_VERSION }} + --build-arg=APPS_JSON_BASE64=${{ inputs.apps-json-base64 || env.APPS_JSON_BASE64 }} + --context=${{ inputs.context || env.CONTEXT }} + --destination=ghcr.io/${{ github.repository }}/${{ inputs.image || env.IMAGE }}:${{ inputs.version || env.VERSION }} --destination=ghcr.io/${{ github.repository }}/${{ inputs.image || env.IMAGE }}:latest file: ${{ inputs.dockerfile || env.DOCKERFILE }} From f2dd036c4f7eb8a0c9a72af983b87a247a859045 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 24 Jan 2023 12:29:36 +0530 Subject: [PATCH 15/45] docs: ci for github and gitlab fixes #17 --- .gitlab-ci.yml | 2 +- ci/build.env | 1 + docs/runner-api.md | 108 ++++++++++++++++++++++++++------------------- 3 files changed, 64 insertions(+), 47 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 596211c..b6659d4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ build_version: - | source ./ci/build.env mkdir -p /kaniko/.docker - export IMAGE_NAME=${CI_REGISTRY:-${REGISTRY}}/${CI_PROJECT_NAMESPACE:-${PROJECT_NAMESPACE}}/${IMAGE_NAME:-${IMAGE}} + export IMAGE_NAME=${CI_REGISTRY:-${REGISTRY}}/${CI_PROJECT_NAMESPACE:-${PROJECT_NAMESPACE}}/${CI_PROJECT_NAME:-${PROJECT_NAME}}/${IMAGE_NAME:-${IMAGE}} export BASIC_AUTH=$(echo -n ${CI_REGISTRY_USER}:${CI_JOB_TOKEN} | base64) echo "{ \"auths\": { diff --git a/ci/build.env b/ci/build.env index 18abf2b..d8c8ee3 100644 --- a/ci/build.env +++ b/ci/build.env @@ -1,5 +1,6 @@ REGISTRY=ghcr.io PROJECT_NAMESPACE=castlecraft +PROJECT_NAME=ff-ctr IMAGE=apps FRAPPE_REPO=https://github.com/frappe/frappe FRAPPE_VERSION=v14.23.0 diff --git a/docs/runner-api.md b/docs/runner-api.md index f488080..65be01a 100644 --- a/docs/runner-api.md +++ b/docs/runner-api.md @@ -1,63 +1,79 @@ +## General Setup + +- Default variables are taken from `ci/build.env` file if no input is provided. +- `ci/version.txt` stores the image version tag. Change the file to change the output tag. It can be overridden by job inputs. + ## Gitlab -```yaml -stages: - - build - -build_version: - stage: build - image: - name: gcr.io/kaniko-project/executor:debug - entrypoint: [""] - only: - refs: - - main - script: - - | - mkdir -p /kaniko/.docker - export BASIC_AUTH=$(echo -n ${CI_REGISTRY_USER}:${CI_JOB_TOKEN} | base64) - echo "{ - \"auths\": { - \"${CI_REGISTRY:-registry.gitlab.com}\":{ - \"auth\": \"${BASIC_AUTH}\" - } - } - }" > /kaniko/.docker/config.json - /kaniko/executor \ - --dockerfile=images/custom/Containerfile \ - --context=${BUILD_CONTEXT:-git://github.com/frappe/frappe_docker} \ - --build-arg=FRAPPE_PATH=${FRAPPE_PATH:-https://github.com/frappe/frappe} \ - --build-arg=FRAPPE_BRANCH=${FRAPPE_BRANCH:-v14.23.0} \ - --build-arg=PYTHON_VERSION=${PYTHON_VERSION:-3.10.5} \ - --build-arg=NODE_VERSION=${NODE_VERSION:-16.18.0} \ - --build-arg=APPS_JSON_BASE64=${APPS_JSON_BASE64:-$(base64 -w 0 apps.json)} \ - --destination=${IMAGE_NAME:-registry.gitlab.com/castlecraft/cepl-erpnext-images/apps:${VERSION:-$(cat version.txt)}} \ - --cache=true -``` +Check the `.gitlab-ci.yml` file. -#### Variables Used +Input Variables -- `VERSION`, set it for the tag version of image to be built and pushed, default reads from version.txt file from repo. +- `CI_REGISTRY`, set it to the container registry url. (compatible with docker hub) +- `CI_PROJECT_NAMESPACE`, set it to the group name on gitlab +- `CI_PROJECT_NAME`, set it to the project name on gitlab +- `IMAGE_NAME`, set it to image name without the tag. default `registry.gitlab.com/castlecraft/cepl-erpnext-images/apps` - `CI_REGISTRY_USER`, set it to the container registry user - `CI_JOB_TOKEN`, set it to the container registry password -- `CI_REGISTRY`, set it to the container registry url. (compatible with docker hub) +- `CONTAINERFILE`, set it to the Dockerfile path in kaniko context - `BUILD_CONTEXT`, set it to the kaniko build context, default: `git://github.com/frappe/frappe_docker` - `FRAPPE_PATH`, set it to the frappe repo url, default `https://github.com/frappe/frappe` - `FRAPPE_BRANCH`, set it to the frappe repo branch, default `v14.23.0` - `PYTHON_VERSION`, set it to python version to be used, default `3.10.5` - `NODE_VERSION`, set it to nodejs version to be used, default `16.18.0` - `APPS_JSON_BASE64`, set it to base64 encoded apps.json, default apps.json from repo will be used. -- `IMAGE_NAME`, set it to image name without the tag. default `registry.gitlab.com/castlecraft/cepl-erpnext-images/apps` +- `VERSION`, set it for the tag version of image to be built and pushed, default reads from version.txt file from repo. + -#### Curl command +Trigger using ReST API ```shell curl -X POST \ - --fail \ - -F token=$TOKEN \ - -F "ref=$REF_NAME" \ - -F "variables[VERSION]=nightly" \ - -F "variables[IMAGE_NAME]=registry.gitlab.com/orgname/project/image" \ - -F "variables[APPS_JSON_BASE64]=W3sidXJsIjoiaHR0cHM6Ly9naXRodWIuY29tL2ZyYXBwZS9wYXltZW50cyIsImJyYW5jaCI6ImRldmVsb3AifV0=" \ - https://gitlab.com/api/v4/projects/$PROJECT_ID/trigger/pipeline + --fail \ + -F token=$TOKEN \ + -F "ref=$REF_NAME" \ + -F "variables[VERSION]=nightly" \ + -F "variables[IMAGE_NAME]=apps" \ + -F "variables[APPS_JSON_BASE64]=W3sidXJsIjoiaHR0cHM6Ly9naXRodWIuY29tL2ZyYXBwZS9wYXltZW50cyIsImJyYW5jaCI6ImRldmVsb3AifV0=" \ + https://gitlab.com/api/v4/projects/$PROJECT_ID/trigger/pipeline ``` + +## GitHub + +Check the `.github/workflows/build.yaml` + +Job Inputs + +- `image`: Image name +- `version`: Image version tag +- `frappe-repo`: Frappe repo +- `frappe-version`: Frappe branch +- `py-version`: Python version +- `nodejs-version`: NodeJS version +- `apps-json-base64`: base64 encoded string of apps.json +- `context`: kaniko context +- `dockerfile`: dockerfile path from context +- `registry-user`: registry username + +Trigger using ReST API + +```shell +curl \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer "\ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${OWNER}/${REPO}/actions/workflows/${WORKFLOW_ID}/dispatches \ + -d '{ + "ref": "topic-branch", + "inputs": { + "image": "apps", + "apps-json-base64": "W3sidXJsIjoiaHR0cHM6Ly9naXRodWIuY29tL2ZyYXBwZS9wYXltZW50cyIsImJyYW5jaCI6ImRldmVsb3AifV0=" + } + }' +``` + +## Practices + +- `apps.json` may contain repo tokens for git https basic auth. You may commit them on private repos and make sure they are never made public. +- another alternative is to generate `apps.json` with CI secrets and then passing it to build arg. It can be done with `echo`, environment variables and shell pipes. Check how config.json is generated. It can be done as a step in job if it needs complex tools. From 6c73fd6e5c087a348e7763119fe20999bff9567f Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Mon, 30 Jan 2023 14:58:19 +0530 Subject: [PATCH 16/45] docs: create-site and cronjob --- compose/create-site.yml | 1 - docs/kube-devcontainer.md | 88 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/compose/create-site.yml b/compose/create-site.yml index 0b4b678..ffc14ea 100644 --- a/compose/create-site.yml +++ b/compose/create-site.yml @@ -9,7 +9,6 @@ services: - bench - new-site - --no-mariadb-socket - - --install-app=payments - --install-app=erpnext - --db-root-password=admin - --admin-password=admin diff --git a/docs/kube-devcontainer.md b/docs/kube-devcontainer.md index fc3b1bc..6b93faa 100644 --- a/docs/kube-devcontainer.md +++ b/docs/kube-devcontainer.md @@ -52,7 +52,93 @@ helm upgrade --install -n nfs in-cluster nfs-ganesha-server-and-external-provisi Notes: - Change the persistence.size from 8Gi to required specification. -- In case of in-cluster nfs server that runs in production make sure you setup a backup CronJob refer: https://gist.github.com/revant/2414cedce8e19d209d5d337ea19efabc +- In case of in-cluster nfs server that runs in production make sure you setup a backup CronJob refer + +
+ +cronjob.yaml + +```yaml +apiVersion: batch/v1 +kind: CronJob +metadata: + name: ${CRONJOB_NAME} + namespace: ${CRONJOB_NAMESPACE} +spec: + schedule: "0 */12 * * *" + jobTemplate: + spec: + backoffLimit: 0 + template: + spec: + securityContext: + supplementalGroups: [1000] + containers: + - name: backup-and-push + image: ${IMAGE}:${VERSION} + command: ["bash", "-c"] + args: + - | + bench --site all backup + restic snapshots || restic init + restic backup sites + restic forget --keep-last 30 --prune + imagePullPolicy: IfNotPresent + volumeMounts: + - name: sites-dir + mountPath: /home/frappe/frappe-bench/sites + env: + - name: RESTIC_REPOSITORY + value: ${RESTIC_REPOSITORY} + - name: "RESTIC_PASSWORD" + valueFrom: + secretKeyRef: + key: resticPassword + name: ${CRONJOB_NAME} + - name: "AWS_ACCESS_KEY_ID" + valueFrom: + secretKeyRef: + key: accessKey + name: ${CRONJOB_NAME} + - name: "AWS_SECRET_ACCESS_KEY" + valueFrom: + secretKeyRef: + key: secretKey + name: ${CRONJOB_NAME} + restartPolicy: OnFailure + volumes: + - name: sites-dir + persistentVolumeClaim: + claimName: erpnext-v14 + readOnly: false +--- +apiVersion: v1 +kind: Secret +metadata: + name: ${CRONJOB_NAME} + namespace: ${CRONJOB_NAMESPACE} +type: Opaque +stringData: + resticPassword: ${RESTIC_PASSWORD} + accessKey: ${AWS_ACCESS_KEY_ID} + secretKey: ${AWS_SECRET_ACCESS_KEY} +``` + +Create `CronJob` + +```shell +export CRONJOB_NAME=erpnext-backup +export CRONJOB_NAMESPACE=erpnext +export IMAGE=frappe/erpnext +export VERSION=v14 +export RESTIC_REPOSITORY=s3:https://s3.endpoint.com/bucket-name/path-in-bucket +export RESTIC_PASSWORD=password +export AWS_ACCESS_KEY_ID=changeit +export AWS_SECRET_ACCESS_KEY=secret +cat cronjob.yaml | envsubst | kubectl apply -f - +``` + +
### Provision Database From 7b1d9f38a3189fe7408ab47b2d577b77fca0cd81 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Mon, 30 Jan 2023 15:00:53 +0530 Subject: [PATCH 17/45] ci: update frappe, erpnext, india_compliance --- ci/apps.json | 8 ++------ ci/build.env | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ci/apps.json b/ci/apps.json index ca37ea3..c8d5fe9 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -1,14 +1,10 @@ [ - { - "url": "https://github.com/frappe/payments.git", - "branch": "develop" - }, { "url": "https://github.com/frappe/erpnext.git", - "branch": "v14.13.0" + "branch": "v14.14.0" }, { "url": "https://github.com/resilient-tech/india-compliance.git", - "branch": "v14.1.1" + "branch": "v14.1.2" } ] diff --git a/ci/build.env b/ci/build.env index d8c8ee3..7cb4885 100644 --- a/ci/build.env +++ b/ci/build.env @@ -3,7 +3,7 @@ PROJECT_NAMESPACE=castlecraft PROJECT_NAME=ff-ctr IMAGE=apps FRAPPE_REPO=https://github.com/frappe/frappe -FRAPPE_VERSION=v14.23.0 +FRAPPE_VERSION=v14.24.0 PY_VERSION=3.10.5 NODEJS_VERSION=16.18.0 CONTEXT=git://github.com/frappe/frappe_docker From 57153a579c360462d1aad35a7b6a82b6254c2747 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Mon, 30 Jan 2023 15:02:12 +0530 Subject: [PATCH 18/45] chore: bump image version --- ci/version.txt | 2 +- hugo-devcontainer/Dockerfile | 48 +++++++++++++++++++++++++++++ hugo-devcontainer/compose.yml | 10 ++++++ hugo-devcontainer/devcontainer.json | 11 +++++++ 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 hugo-devcontainer/Dockerfile create mode 100644 hugo-devcontainer/compose.yml create mode 100644 hugo-devcontainer/devcontainer.json diff --git a/ci/version.txt b/ci/version.txt index 98b0fc5..6ea03e0 100644 --- a/ci/version.txt +++ b/ci/version.txt @@ -1 +1 @@ -14.13.0 \ No newline at end of file +14.14.0 \ No newline at end of file diff --git a/hugo-devcontainer/Dockerfile b/hugo-devcontainer/Dockerfile new file mode 100644 index 0000000..933f538 --- /dev/null +++ b/hugo-devcontainer/Dockerfile @@ -0,0 +1,48 @@ +FROM debian:bullseye-slim +# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser" +# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs +# will be updated to match your local UID/GID (when using the dockerFile property). +# See https://aka.ms/vscode-remote/containers/non-root-user for details. +ARG USERNAME=hugo +ARG GROUPNAME=$USERNAME +ARG USER_UID=1000 +ARG USER_GID=$USER_UID +ENV DEBIAN_FRONTEND=noninteractive + +RUN groupadd -g ${USER_GID} ${USERNAME} && \ + useradd --no-log-init -r -m -u ${USER_UID} -g ${USER_GID} -G sudo ${USERNAME} -s /bin/zsh && \ + echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + +# Install Dependencies +RUN apt-get update \ + && apt-get install --no-install-recommends -y \ + ca-certificates \ + debian-keyring \ + debian-archive-keyring \ + apt-transport-https \ + gnupg2 \ + zsh \ + git \ + vim \ + curl \ + wget + +# Install caddy +RUN curl -1sLf https://dl.cloudsmith.io/public/caddy/stable/gpg.key | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg && \ + curl -1sLf https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt | tee /etc/apt/sources.list.d/caddy-stable.list && \ + apt-get update && apt-get install -y caddy + +# Install Hugo +RUN cd /tmp/ && \ + curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest \ + | grep "browser_download_url.*hugo_extended.*_Linux-64bit\.tar\.gz" \ + | cut -d ":" -f 2,3 \ + | tr -d '"' \ + | wget -qi - && \ + tar -xzf $(find . -name "*Linux-64bit.tar.gz") && \ + chmod 755 hugo && mv hugo /usr/local/bin/ && \ + cd - + +USER $USERNAME + +RUN curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh diff --git a/hugo-devcontainer/compose.yml b/hugo-devcontainer/compose.yml new file mode 100644 index 0000000..0c12c9a --- /dev/null +++ b/hugo-devcontainer/compose.yml @@ -0,0 +1,10 @@ +version: "3.7" + +services: + hugo: + build: . + command: ["tail", "-f", "/dev/null"] + volumes: + - ..:/workspace + - ${HOME}/.ssh:/home/hugo/.ssh + working_dir: /workspace diff --git a/hugo-devcontainer/devcontainer.json b/hugo-devcontainer/devcontainer.json new file mode 100644 index 0000000..d09147b --- /dev/null +++ b/hugo-devcontainer/devcontainer.json @@ -0,0 +1,11 @@ +{ + "name": "Hugo Static Site and Caddy", + "remoteUser": "hugo", + "settings": { + "debug.node.autoAttach": "disabled" + }, + "dockerComposeFile": "./compose.yml", + "service": "hugo", + "workspaceFolder": "/workspace", + "shutdownAction": "stopCompose" +} From 2f72eedbe0c594066eb483877b5c1c724cc01b81 Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Tue, 31 Jan 2023 06:00:32 +0530 Subject: [PATCH 19/45] docs: update restic command --- compose/erpnext-backup.yml | 14 ++++---------- docs/kube-devcontainer.md | 8 +++++--- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/compose/erpnext-backup.yml b/compose/erpnext-backup.yml index 8aa6da4..a9c4263 100644 --- a/compose/erpnext-backup.yml +++ b/compose/erpnext-backup.yml @@ -14,18 +14,12 @@ services: entrypoint: ["bash", "-c"] command: - | - bench backup-all-sites - - ## Uncomment for restic snapshots + bench --site all backup + ## Uncomment for restic snapshots. # restic snapshots || restic init # restic backup sites - - ## Uncomment to delete last snapshot number more than 10 - # SNAPSHOT_COUNT=`restic -q list snapshots | wc -l`; export SNAPSHOT_COUNT - # if [[ $$SNAPSHOT_COUNT -gt 10 ]]; then - # restic forget `restic -q list snapshots | tail -1` - # restic prune - # fi + ## Uncomment to keep only last 30 snapshots. + # restic forget --group-by=paths --keep-last=30 --prune environment: - RESTIC_REPOSITORY=s3:https://s3.endpoint.com/restic - AWS_ACCESS_KEY_ID=access_key diff --git a/docs/kube-devcontainer.md b/docs/kube-devcontainer.md index 6b93faa..da61f1d 100644 --- a/docs/kube-devcontainer.md +++ b/docs/kube-devcontainer.md @@ -82,7 +82,7 @@ spec: bench --site all backup restic snapshots || restic init restic backup sites - restic forget --keep-last 30 --prune + restic forget --group-by=paths --keep-last=30 --prune imagePullPolicy: IfNotPresent volumeMounts: - name: sites-dir @@ -124,6 +124,8 @@ stringData: secretKey: ${AWS_SECRET_ACCESS_KEY} ``` +Note: Change the number of restic snapshots to keep as per need. + Create `CronJob` ```shell @@ -254,7 +256,7 @@ curl -X POST -u admin:changeit http://0.0.0.0:3000/bench-command \ "command": null, "logs_pvc": null, "namespace": "erpnext", - "worker_image": "frappe/erpnext:v14.13.0", + "image": "frappe/erpnext:v14.13.0", "annotations": { "k8s-bench.castlecraft.in/job-type": "create-site", "k8s-bench.castlecraft.in/ingress-name": "frappe-localhost", @@ -289,7 +291,7 @@ curl -X POST -u admin:changeit http://0.0.0.0:3000/bench-command \ "command": null, "logs_pvc": null, "namespace": "erpnext", - "worker_image": "frappe/erpnext:v14.13.0", + "image": "frappe/erpnext:v14.13.0", "annotations": { "k8s-bench.castlecraft.in/job-type": "delete-site", "k8s-bench.castlecraft.in/ingress-name": "frappe-localhost", From 4bad595f8122cb603a60873401815d7f811d3ebc Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Thu, 9 Feb 2023 18:16:31 +0530 Subject: [PATCH 20/45] docs: change mariadb helm release command --- docs/kube-devcontainer.md | 54 +++++++++------------------------------ 1 file changed, 12 insertions(+), 42 deletions(-) diff --git a/docs/kube-devcontainer.md b/docs/kube-devcontainer.md index da61f1d..7880b11 100644 --- a/docs/kube-devcontainer.md +++ b/docs/kube-devcontainer.md @@ -147,49 +147,19 @@ cat cronjob.yaml | envsubst | kubectl apply -f - In case of production setup use AWS RDS, Google Sky SQL, or Managed MariaDB Service that is configurable for frappe specific param group properties. For simple or development setup we will install in-cluster MariaDB Helm chart with following command: ```shell -export FRAPPE_MARIADB_CNF=$(cat < Date: Sat, 25 Feb 2023 23:20:21 +0530 Subject: [PATCH 21/45] custom lens app 2023 --- ci/apps.json | 10 +++++++--- ci/build.env | 8 ++++---- ci/version.txt | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ci/apps.json b/ci/apps.json index c8d5fe9..dc2c0ef 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -1,10 +1,14 @@ [ { "url": "https://github.com/frappe/erpnext.git", - "branch": "v14.14.0" + "branch": "v14.11.1" }, { - "url": "https://github.com/resilient-tech/india-compliance.git", - "branch": "v14.1.2" + "url": "https://github.com/frappe/hrms.git", + "branch": "version-14" + }, + { + "url": "https://github.com/frappe/lms.git", + "branch": "main" } ] diff --git a/ci/build.env b/ci/build.env index 7cb4885..5c5b759 100644 --- a/ci/build.env +++ b/ci/build.env @@ -1,9 +1,9 @@ REGISTRY=ghcr.io -PROJECT_NAMESPACE=castlecraft -PROJECT_NAME=ff-ctr -IMAGE=apps +PROJECT_NAMESPACE=lmnaslimited +PROJECT_NAME=lensdocker +IMAGE=lens FRAPPE_REPO=https://github.com/frappe/frappe -FRAPPE_VERSION=v14.24.0 +FRAPPE_VERSION=v14.21.0 PY_VERSION=3.10.5 NODEJS_VERSION=16.18.0 CONTEXT=git://github.com/frappe/frappe_docker diff --git a/ci/version.txt b/ci/version.txt index 6ea03e0..2089547 100644 --- a/ci/version.txt +++ b/ci/version.txt @@ -1 +1 @@ -14.14.0 \ No newline at end of file +14.11.1 \ No newline at end of file From 744b0e5cb098f9ccd6890919b6f2604b39a843ec Mon Sep 17 00:00:00 2001 From: ArunG Date: Sun, 26 Feb 2023 01:03:33 +0530 Subject: [PATCH 22/45] added payments app --- ci/apps.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/apps.json b/ci/apps.json index dc2c0ef..4815994 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -1,4 +1,8 @@ [ + { + "url": "https://github.com/frappe/payments.git", + "branch": "develop" + }, { "url": "https://github.com/frappe/erpnext.git", "branch": "v14.11.1" From 9b1c13bb2c422539176f244b9698ec7da5385476 Mon Sep 17 00:00:00 2001 From: ArunG Date: Sun, 26 Feb 2023 08:50:37 +0530 Subject: [PATCH 23/45] bench site command missing --- ci/apps.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/apps.json b/ci/apps.json index 4815994..9d928c0 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -1,12 +1,12 @@ [ - { - "url": "https://github.com/frappe/payments.git", - "branch": "develop" - }, { "url": "https://github.com/frappe/erpnext.git", "branch": "v14.11.1" }, + { + "url": "https://github.com/frappe/payments.git", + "branch": "develop" + }, { "url": "https://github.com/frappe/hrms.git", "branch": "version-14" From b26df3143c3db77500bd79fc673b9a15e9719724 Mon Sep 17 00:00:00 2001 From: ArunG Date: Sun, 26 Feb 2023 09:46:35 +0530 Subject: [PATCH 24/45] Image lenshxm v14.11.1 with erpenext payment hrms and lms --- ci/build.env | 2 +- ci/version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/build.env b/ci/build.env index 5c5b759..58c8331 100644 --- a/ci/build.env +++ b/ci/build.env @@ -1,7 +1,7 @@ REGISTRY=ghcr.io PROJECT_NAMESPACE=lmnaslimited PROJECT_NAME=lensdocker -IMAGE=lens +IMAGE=lenshxm FRAPPE_REPO=https://github.com/frappe/frappe FRAPPE_VERSION=v14.21.0 PY_VERSION=3.10.5 diff --git a/ci/version.txt b/ci/version.txt index 2089547..88f8e3b 100644 --- a/ci/version.txt +++ b/ci/version.txt @@ -1 +1 @@ -14.11.1 \ No newline at end of file +v14.11.1 \ No newline at end of file From ab1fabede1a82c17b60f4afd4e86219a88286f03 Mon Sep 17 00:00:00 2001 From: ArunG Date: Sun, 26 Feb 2023 13:45:50 +0530 Subject: [PATCH 25/45] separate branch for lenshxm --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ffb8a8f..11ad35b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ name: Build Image on: push: branches: - - main + - lenshxm workflow_dispatch: inputs: From d353dbc076e133333ec56163a0c254b340c343f8 Mon Sep 17 00:00:00 2001 From: ArunG Date: Sat, 11 Mar 2023 20:13:21 +0530 Subject: [PATCH 26/45] Version 14.12.0 --- ci/apps.json | 2 +- ci/version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/apps.json b/ci/apps.json index 9d928c0..58df108 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -1,7 +1,7 @@ [ { "url": "https://github.com/frappe/erpnext.git", - "branch": "v14.11.1" + "branch": "v14.12.0" }, { "url": "https://github.com/frappe/payments.git", diff --git a/ci/version.txt b/ci/version.txt index 88f8e3b..69f9382 100644 --- a/ci/version.txt +++ b/ci/version.txt @@ -1 +1 @@ -v14.11.1 \ No newline at end of file +v14.12.0 \ No newline at end of file From fd15b2a6d00112010c15cf71ad277534dfa05cae Mon Sep 17 00:00:00 2001 From: Arunkumar Ganesan <67154864+arun-lmnas@users.noreply.github.com> Date: Sun, 19 Mar 2023 23:08:11 +0530 Subject: [PATCH 27/45] v14.12.0 --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 9132e0f..00b4e4f 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,7 @@ -#### Note: For old custom image building references and links check `compat-2022` branch - -From Jan 2023, Official frappe_docker has easy process to build custom images. Refer the [official guide](https://github.com/frappe/frappe_docker/blob/main/docs/custom-apps.md). - ## Topics - [Frappe apps on Kubernetes](docs/kube-devcontainer.md) - [Frappe apps on Docker Swarm](docs/docker-swarm.md) - [Custom Devcontainer](docs/devcontainer.md) - [Setup Kubernetes cluster with k3s](docs/k3s-cluster.md) -- [CI Runner Build API](docs/runner-api.md) \ No newline at end of file +- [CI Runner Build API](docs/runner-api.md) From 53a2e4cf33a189366fe4abed4da0406af8ec1206 Mon Sep 17 00:00:00 2001 From: ArunG Date: Sat, 8 Apr 2023 09:20:08 +0530 Subject: [PATCH 28/45] India compliance added to lenshxm --- ci/apps.json | 5 +++++ ci/version.txt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ci/apps.json b/ci/apps.json index 58df108..6b21b93 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -14,5 +14,10 @@ { "url": "https://github.com/frappe/lms.git", "branch": "main" + }, + { + "url": "https://github.com/resilient-tech/india-compliance.git", + "branch": "version-14" } + ] diff --git a/ci/version.txt b/ci/version.txt index 69f9382..26c2980 100644 --- a/ci/version.txt +++ b/ci/version.txt @@ -1 +1 @@ -v14.12.0 \ No newline at end of file +v14.12.1 \ No newline at end of file From b17cc00002b2eabb7ce698a41797865653dd0a3d Mon Sep 17 00:00:00 2001 From: ArunG Date: Wed, 19 Jul 2023 22:14:08 +0530 Subject: [PATCH 29/45] with desk app --- ci/apps.json | 6 +++++- ci/version.txt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ci/apps.json b/ci/apps.json index 6b21b93..9e12293 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -18,6 +18,10 @@ { "url": "https://github.com/resilient-tech/india-compliance.git", "branch": "version-14" - } + }, + { + "url": "https://github.com/frappe/helpdesk.git", + "branch": "main" + }, ] diff --git a/ci/version.txt b/ci/version.txt index 26c2980..443e527 100644 --- a/ci/version.txt +++ b/ci/version.txt @@ -1 +1 @@ -v14.12.1 \ No newline at end of file +v14.12.2 \ No newline at end of file From ca0c27cc6cdd5eb592844de5d7a992e4be323b4a Mon Sep 17 00:00:00 2001 From: ArunG Date: Thu, 20 Jul 2023 13:07:17 +0530 Subject: [PATCH 30/45] python version 3.11.4 used --- ci/build.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build.env b/ci/build.env index 58c8331..016ede5 100644 --- a/ci/build.env +++ b/ci/build.env @@ -4,7 +4,7 @@ PROJECT_NAME=lensdocker IMAGE=lenshxm FRAPPE_REPO=https://github.com/frappe/frappe FRAPPE_VERSION=v14.21.0 -PY_VERSION=3.10.5 +PY_VERSION=3.11.4 NODEJS_VERSION=16.18.0 CONTEXT=git://github.com/frappe/frappe_docker DOCKERFILE=images/custom/Containerfile From da7179b48fb6473d7b1a93515968e2de0c36e975 Mon Sep 17 00:00:00 2001 From: ArunG Date: Thu, 20 Jul 2023 13:15:59 +0530 Subject: [PATCH 31/45] with frappe v14.24.0 --- ci/build.env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/build.env b/ci/build.env index 016ede5..d2ce454 100644 --- a/ci/build.env +++ b/ci/build.env @@ -3,8 +3,8 @@ PROJECT_NAMESPACE=lmnaslimited PROJECT_NAME=lensdocker IMAGE=lenshxm FRAPPE_REPO=https://github.com/frappe/frappe -FRAPPE_VERSION=v14.21.0 -PY_VERSION=3.11.4 +FRAPPE_VERSION=v14.24.0 +PY_VERSION=3.10.5 NODEJS_VERSION=16.18.0 CONTEXT=git://github.com/frappe/frappe_docker DOCKERFILE=images/custom/Containerfile From 4248631dd17b895f2a3ae6f34a731fa3b0b9b7e3 Mon Sep 17 00:00:00 2001 From: ArunG Date: Thu, 20 Jul 2023 13:20:11 +0530 Subject: [PATCH 32/45] python version --- ci/build.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build.env b/ci/build.env index d2ce454..33ae99d 100644 --- a/ci/build.env +++ b/ci/build.env @@ -4,7 +4,7 @@ PROJECT_NAME=lensdocker IMAGE=lenshxm FRAPPE_REPO=https://github.com/frappe/frappe FRAPPE_VERSION=v14.24.0 -PY_VERSION=3.10.5 +PY_VERSION=3.10.12 NODEJS_VERSION=16.18.0 CONTEXT=git://github.com/frappe/frappe_docker DOCKERFILE=images/custom/Containerfile From 80e5648e20f734d832e2050a391d60208ad7eaca Mon Sep 17 00:00:00 2001 From: ArunG Date: Thu, 20 Jul 2023 13:29:04 +0530 Subject: [PATCH 33/45] apps.json fix --- ci/apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/apps.json b/ci/apps.json index 9e12293..4456007 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -22,6 +22,6 @@ { "url": "https://github.com/frappe/helpdesk.git", "branch": "main" - }, + } ] From c21e611eff0e11d834166e674103dd392e6d0518 Mon Sep 17 00:00:00 2001 From: ArunG Date: Thu, 20 Jul 2023 19:15:47 +0530 Subject: [PATCH 34/45] erpnext version with v14.24.0 --- ci/apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/apps.json b/ci/apps.json index 4456007..fd63481 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -1,7 +1,7 @@ [ { "url": "https://github.com/frappe/erpnext.git", - "branch": "v14.12.0" + "branch": "v14.24.0" }, { "url": "https://github.com/frappe/payments.git", From 9272f08f899f766a044b315074cd4ed9f5ca8d3e Mon Sep 17 00:00:00 2001 From: ArunG Date: Sat, 22 Jul 2023 16:13:20 +0530 Subject: [PATCH 35/45] python version fix --- ci/apps.json | 2 +- ci/build.env | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/apps.json b/ci/apps.json index fd63481..48cf215 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -1,7 +1,7 @@ [ { "url": "https://github.com/frappe/erpnext.git", - "branch": "v14.24.0" + "branch": "v14.20.0" }, { "url": "https://github.com/frappe/payments.git", diff --git a/ci/build.env b/ci/build.env index 33ae99d..0ea8766 100644 --- a/ci/build.env +++ b/ci/build.env @@ -4,7 +4,7 @@ PROJECT_NAME=lensdocker IMAGE=lenshxm FRAPPE_REPO=https://github.com/frappe/frappe FRAPPE_VERSION=v14.24.0 -PY_VERSION=3.10.12 +PY_VERSION=3.10.11 NODEJS_VERSION=16.18.0 CONTEXT=git://github.com/frappe/frappe_docker DOCKERFILE=images/custom/Containerfile From 090d6f69cc1f55683417f390e2c56b3ba57e629e Mon Sep 17 00:00:00 2001 From: ArunG Date: Sat, 22 Jul 2023 16:21:26 +0530 Subject: [PATCH 36/45] python v3.10.12 --- ci/build.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build.env b/ci/build.env index 0ea8766..33ae99d 100644 --- a/ci/build.env +++ b/ci/build.env @@ -4,7 +4,7 @@ PROJECT_NAME=lensdocker IMAGE=lenshxm FRAPPE_REPO=https://github.com/frappe/frappe FRAPPE_VERSION=v14.24.0 -PY_VERSION=3.10.11 +PY_VERSION=3.10.12 NODEJS_VERSION=16.18.0 CONTEXT=git://github.com/frappe/frappe_docker DOCKERFILE=images/custom/Containerfile From cafacc8627e8c67a600526f684ed65d8d269a6af Mon Sep 17 00:00:00 2001 From: ArunG Date: Mon, 20 Nov 2023 11:12:51 +0530 Subject: [PATCH 37/45] Rebuild lenshxm version v14.12.0 with payments app version 14 --- ci/apps.json | 12 ++---------- ci/version.txt | 2 +- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/ci/apps.json b/ci/apps.json index 48cf215..4721385 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -1,11 +1,11 @@ [ { "url": "https://github.com/frappe/erpnext.git", - "branch": "v14.20.0" + "branch": "v14.12.0" }, { "url": "https://github.com/frappe/payments.git", - "branch": "develop" + "branch": "version-14" }, { "url": "https://github.com/frappe/hrms.git", @@ -14,14 +14,6 @@ { "url": "https://github.com/frappe/lms.git", "branch": "main" - }, - { - "url": "https://github.com/resilient-tech/india-compliance.git", - "branch": "version-14" - }, - { - "url": "https://github.com/frappe/helpdesk.git", - "branch": "main" } ] diff --git a/ci/version.txt b/ci/version.txt index 443e527..69f9382 100644 --- a/ci/version.txt +++ b/ci/version.txt @@ -1 +1 @@ -v14.12.2 \ No newline at end of file +v14.12.0 \ No newline at end of file From 068a64bd30865da5ddd4c1c347995fca91e7b9db Mon Sep 17 00:00:00 2001 From: ArunG Date: Tue, 21 Nov 2023 13:00:56 +0530 Subject: [PATCH 38/45] reverted to python version 3.10.5 and frappe to v14.21.0 --- ci/build.env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/build.env b/ci/build.env index 33ae99d..58c8331 100644 --- a/ci/build.env +++ b/ci/build.env @@ -3,8 +3,8 @@ PROJECT_NAMESPACE=lmnaslimited PROJECT_NAME=lensdocker IMAGE=lenshxm FRAPPE_REPO=https://github.com/frappe/frappe -FRAPPE_VERSION=v14.24.0 -PY_VERSION=3.10.12 +FRAPPE_VERSION=v14.21.0 +PY_VERSION=3.10.5 NODEJS_VERSION=16.18.0 CONTEXT=git://github.com/frappe/frappe_docker DOCKERFILE=images/custom/Containerfile From 9142ac5b6d8f165ebf3037efaad23a1bf4869a9c Mon Sep 17 00:00:00 2001 From: ArunG Date: Tue, 21 Nov 2023 20:18:30 +0530 Subject: [PATCH 39/45] frappe version-14 --- ci/build.env | 6 +++--- ci/version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/build.env b/ci/build.env index 58c8331..6d1cf66 100644 --- a/ci/build.env +++ b/ci/build.env @@ -3,8 +3,8 @@ PROJECT_NAMESPACE=lmnaslimited PROJECT_NAME=lensdocker IMAGE=lenshxm FRAPPE_REPO=https://github.com/frappe/frappe -FRAPPE_VERSION=v14.21.0 -PY_VERSION=3.10.5 -NODEJS_VERSION=16.18.0 +FRAPPE_VERSION=version-14 +PY_VERSION=3.10.12 +NODEJS_VERSION=16.20.1 CONTEXT=git://github.com/frappe/frappe_docker DOCKERFILE=images/custom/Containerfile diff --git a/ci/version.txt b/ci/version.txt index 69f9382..7266ad9 100644 --- a/ci/version.txt +++ b/ci/version.txt @@ -1 +1 @@ -v14.12.0 \ No newline at end of file +version-14 \ No newline at end of file From 197266bc34283d66d65a7ebee5024405fe4cacd3 Mon Sep 17 00:00:00 2001 From: ArunG Date: Thu, 23 Nov 2023 07:37:38 +0530 Subject: [PATCH 40/45] frappe v14.36.0 erpnext v14.24.0 hrms v14.3.1 --- ci/apps.json | 6 +++--- ci/build.env | 2 +- ci/version.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ci/apps.json b/ci/apps.json index 4721385..3b2f448 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -1,7 +1,7 @@ [ { "url": "https://github.com/frappe/erpnext.git", - "branch": "v14.12.0" + "branch": "v14.24.0" }, { "url": "https://github.com/frappe/payments.git", @@ -9,11 +9,11 @@ }, { "url": "https://github.com/frappe/hrms.git", - "branch": "version-14" + "branch": "v14.3.1" }, { "url": "https://github.com/frappe/lms.git", - "branch": "main" + "branch": "v1.0.0" } ] diff --git a/ci/build.env b/ci/build.env index 6d1cf66..9a53d7d 100644 --- a/ci/build.env +++ b/ci/build.env @@ -3,7 +3,7 @@ PROJECT_NAMESPACE=lmnaslimited PROJECT_NAME=lensdocker IMAGE=lenshxm FRAPPE_REPO=https://github.com/frappe/frappe -FRAPPE_VERSION=version-14 +FRAPPE_VERSION=v14.36.0 PY_VERSION=3.10.12 NODEJS_VERSION=16.20.1 CONTEXT=git://github.com/frappe/frappe_docker diff --git a/ci/version.txt b/ci/version.txt index 7266ad9..b98650f 100644 --- a/ci/version.txt +++ b/ci/version.txt @@ -1 +1 @@ -version-14 \ No newline at end of file +v14.36.0 \ No newline at end of file From 24a49b70b7b404f39f896770a43f26ff29af589c Mon Sep 17 00:00:00 2001 From: ArunG Date: Thu, 23 Nov 2023 15:23:41 +0530 Subject: [PATCH 41/45] lenshxm-ind fv14.36.0, ev14.24.0, hrv14.3.1, icv14.7.0 --- .github/workflows/build.yaml | 2 +- ci/apps.json | 7 +++++-- ci/build.env | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 11ad35b..efcdc5a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ name: Build Image on: push: branches: - - lenshxm + - lenshxm-ind workflow_dispatch: inputs: diff --git a/ci/apps.json b/ci/apps.json index 3b2f448..a1f3ff8 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -14,6 +14,9 @@ { "url": "https://github.com/frappe/lms.git", "branch": "v1.0.0" - } - + }, + { + "url": "https://github.com/resilient-tech/india-compliance.git", + "branch": "v14.7.0" + } ] diff --git a/ci/build.env b/ci/build.env index 9a53d7d..0034fc2 100644 --- a/ci/build.env +++ b/ci/build.env @@ -1,7 +1,7 @@ REGISTRY=ghcr.io PROJECT_NAMESPACE=lmnaslimited PROJECT_NAME=lensdocker -IMAGE=lenshxm +IMAGE=lenshxm-ind FRAPPE_REPO=https://github.com/frappe/frappe FRAPPE_VERSION=v14.36.0 PY_VERSION=3.10.12 From a45074c0b0dc1c4809dabf7dc5d9d087b3717c40 Mon Sep 17 00:00:00 2001 From: ArunG Date: Thu, 22 Feb 2024 12:26:14 +0530 Subject: [PATCH 42/45] version 14.42.0 --- ci/apps.json | 10 +++++++--- ci/build.env | 2 +- ci/version.txt | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ci/apps.json b/ci/apps.json index a1f3ff8..c498fc6 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -1,7 +1,7 @@ [ { "url": "https://github.com/frappe/erpnext.git", - "branch": "v14.24.0" + "branch": "v14.33.2" }, { "url": "https://github.com/frappe/payments.git", @@ -17,6 +17,10 @@ }, { "url": "https://github.com/resilient-tech/india-compliance.git", - "branch": "v14.7.0" - } + "branch": "v14.15.2" + }, + { + "url": "https://github.com/frappe/helpdesk.git", + "branch": "version-14" + } ] diff --git a/ci/build.env b/ci/build.env index 0034fc2..d54cb67 100644 --- a/ci/build.env +++ b/ci/build.env @@ -3,7 +3,7 @@ PROJECT_NAMESPACE=lmnaslimited PROJECT_NAME=lensdocker IMAGE=lenshxm-ind FRAPPE_REPO=https://github.com/frappe/frappe -FRAPPE_VERSION=v14.36.0 +FRAPPE_VERSION=v14.42.0 PY_VERSION=3.10.12 NODEJS_VERSION=16.20.1 CONTEXT=git://github.com/frappe/frappe_docker diff --git a/ci/version.txt b/ci/version.txt index b98650f..588ec21 100644 --- a/ci/version.txt +++ b/ci/version.txt @@ -1 +1 @@ -v14.36.0 \ No newline at end of file +v14.42.0 \ No newline at end of file From 1bd6a26c5b2bfef34c6874328bd5ecd1e8647041 Mon Sep 17 00:00:00 2001 From: Fathima786Irfana Date: Mon, 26 Feb 2024 11:39:32 +0530 Subject: [PATCH 43/45] Changed the version of India_compliance --- ci/apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/apps.json b/ci/apps.json index c498fc6..372bcf4 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -17,7 +17,7 @@ }, { "url": "https://github.com/resilient-tech/india-compliance.git", - "branch": "v14.15.2" + "branch": "v14.14.1" }, { "url": "https://github.com/frappe/helpdesk.git", From b3a0f5ba26b3910d167b4c5a392711caaa76ef1c Mon Sep 17 00:00:00 2001 From: Fathima786Irfana Date: Thu, 29 Feb 2024 16:47:49 +0530 Subject: [PATCH 44/45] Removed the helpdesk app from lenshxm image in v14.42.0 --- ci/apps.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ci/apps.json b/ci/apps.json index 372bcf4..3637e49 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -18,9 +18,5 @@ { "url": "https://github.com/resilient-tech/india-compliance.git", "branch": "v14.14.1" - }, - { - "url": "https://github.com/frappe/helpdesk.git", - "branch": "version-14" } ] From d5ff8335e11c91a1c6bcb165b55348eefc5a1c39 Mon Sep 17 00:00:00 2001 From: Fathima786Irfana Date: Wed, 20 Mar 2024 16:02:21 +0530 Subject: [PATCH 45/45] lenshxm-ind:v14.51.0 with frappe-v14.51.0 and ERPNext-v14.44.0 --- ci/apps.json | 2 +- ci/build.env | 2 +- ci/version.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/apps.json b/ci/apps.json index 3637e49..6558d2a 100644 --- a/ci/apps.json +++ b/ci/apps.json @@ -1,7 +1,7 @@ [ { "url": "https://github.com/frappe/erpnext.git", - "branch": "v14.33.2" + "branch": "v14.44.0" }, { "url": "https://github.com/frappe/payments.git", diff --git a/ci/build.env b/ci/build.env index d54cb67..188baef 100644 --- a/ci/build.env +++ b/ci/build.env @@ -3,7 +3,7 @@ PROJECT_NAMESPACE=lmnaslimited PROJECT_NAME=lensdocker IMAGE=lenshxm-ind FRAPPE_REPO=https://github.com/frappe/frappe -FRAPPE_VERSION=v14.42.0 +FRAPPE_VERSION=v14.51.0 PY_VERSION=3.10.12 NODEJS_VERSION=16.20.1 CONTEXT=git://github.com/frappe/frappe_docker diff --git a/ci/version.txt b/ci/version.txt index 588ec21..b987d44 100644 --- a/ci/version.txt +++ b/ci/version.txt @@ -1 +1 @@ -v14.42.0 \ No newline at end of file +v14.51.0 \ No newline at end of file