Skip to content

Commit

Permalink
refactor: build only one frappe/erpnext image (#1032)
Browse files Browse the repository at this point in the history
* ci: skip frappe builds

* refactor: build only one frappe/erpnext image

* fix: lint nginx entrypoint script

* docs: update and organize docs

* docs: fix lint errors

* fix(custom): pass base64 encoded apps json

* ci: update dependabot

* docs: update contributing

* docs: remove info about multi image setup

* fix: initiate empty common_site_config.json

default config has host keys set to localhost
causes connection errors

* docs: add details for pwd volumes

* fix: symlink assets instead of copy

* fix: nginx private files

* ci: skip docker compose v2 install for ubuntu-latest

* fix: organize layers

* feat: allow remove git remote for custom image

* docs: allow remove git remote for custom image

* fix: remove duplicate --apps_path
  • Loading branch information
revant authored Jan 15, 2023
1 parent f8e43a3 commit e6088af
Show file tree
Hide file tree
Showing 55 changed files with 931 additions and 936 deletions.
14 changes: 2 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,12 @@ updates:
interval: daily

- package-ecosystem: docker
directory: images/nginx
directory: images/production
schedule:
interval: daily

- package-ecosystem: docker
directory: images/worker
schedule:
interval: daily

- package-ecosystem: docker
directory: images/socketio
schedule:
interval: daily

- package-ecosystem: npm
directory: images/socketio
directory: images/custom
schedule:
interval: daily

Expand Down
9 changes: 3 additions & 6 deletions .github/scripts/update_pwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ def get_versions():
def update_pwd(frappe_version: str, erpnext_version: str):
with open("pwd.yml", "r+") as f:
content = f.read()
for image, version in (
("frappe/frappe-socketio", frappe_version),
("frappe/erpnext-worker", erpnext_version),
("frappe/erpnext-nginx", erpnext_version),
):
content = re.sub(rf"{image}:.*", f"{image}:{version}", content)
content = re.sub(
rf"frappe/erpnext:.*", f"frappe/erpnext:{erpnext_version}", content
)
f.seek(0)
f.truncate()
f.write(content)
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ jobs:
with:
python-version: "3.10"

- name: Install Docker Compose v2
uses: ndeloof/install-compose-action@4a33bc31f327b8231c4f343f6fba704fedc0fa23

- name: Install dependencies
run: |
python -m venv venv
Expand Down
6 changes: 0 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,10 @@ Run pytest:
pytest
```

> We also have `requirements-dev.txt` file that contains development requirements for backend image (you can find it in `images/worker/` directory).
# Documentation

Place relevant markdown files in the `docs` directory and index them in README.md located at the root of repo.

# Wiki

Add alternatives that can be used optionally along with frappe_docker. Add articles to list on home page as well.

# Frappe and ERPNext updates

Each Frappe/ERPNext release triggers new stable images builds as well as bump to helm chart.
43 changes: 21 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,39 @@ cd frappe_docker

Wait for 5 minutes for ERPNext site to be created or check `create-site` container logs before opening browser on port 8080. (username: `Administrator`, password: `admin`)

# Development
# Documentation

We have baseline for developing in VSCode devcontainer with [frappe/bench](https://github.com/frappe/bench). [Start development](development).
### [Production](#production)

# Production
- [List of containers](docs/list-of-containers.md)
- [Single Compose Setup](docs/single-compose-setup.md)
- [Environment Variables](docs/environment-variables.md)
- [Single Server Example](docs/single-server-example.md)
- [Setup Options](docs/setup-options.md)
- [Site Operations](docs/site-operations.md)
- [Backup and Push Cron Job](docs/backup-and-push-cronjob.md)
- [Port Based Multi Tenancy](docs/port-based-multi-tenancy.md)
- [Migrate from multi-image setup](docs/migrate-from-multi-image-setup.md)

We provide simple and intuitive production setup with prebuilt Frappe and ERPNext images and compose files. To learn more about those, [read the docs](docs/images-and-compose-files.md).
### [Custom Images](#custom-images)

Also, there's docs to help with deployment:
- [Custom Apps](docs/custom-apps.md)
- [Build Version 10 Images](docs/build-version-10-images.md)

- Examples:
- [Single Server](docs/single-server-example.md)
- [Setup options](docs/setup-options.md)
- [Kubernetes (frappe/helm)](https://helm.erpnext.com)
- [Site operations](docs/site-operations.md).
- Other
- [backup and push cron jobs](docs/backup-and-push-cronjob.md)
- [bench console and vscode debugger](docs/bench-console-and-vscode-debugger.md)
- [build version 10](docs/build-version-10-images.md)
- [connect to localhost services from containers for local app development](docs/connect-to-localhost-services-from-containers-for-local-app-development.md)
- [patch code from images](docs/patch-code-from-images.md)
- [port based multi tenancy](docs/port-based-multi-tenancy.md)
- [Troubleshoot](docs/troubleshoot.md)
### [Development](#development)

# Custom app
- [Development using containers](docs/development.md)
- [Bench Console and VSCode Debugger](docs/bench-console-and-vscode-debugger.md)
- [Connect to localhost services](docs/connect-to-localhost-services-from-containers-for-local-app-development.md)

Learn how to containerize your custom Frappe app(s) in [this guide](custom_app/README.md).
### [Troubleshoot](docs/troubleshoot.md)

# Contributing

If you want to contribute to this repo refer to [CONTRIBUTING.md](CONTRIBUTING.md)

This repository is only for Docker related stuff. You also might want to contribute to:
This repository is only for container related stuff. You also might want to contribute to:

- [Frappe framework](https://github.com/frappe/frappe#contributing),
- [ERPNext](https://github.com/frappe/erpnext#contributing),
- or [Frappe Bench](https://github.com/frappe/bench).
- [Frappe Bench](https://github.com/frappe/bench).
28 changes: 20 additions & 8 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@ x-depends-on-configurator: &depends_on_configurator

x-backend-defaults: &backend_defaults
<<: *depends_on_configurator
image: frappe/frappe-worker:${FRAPPE_VERSION:?No Frappe version set}
image: frappe/erpnext:${ERPNEXT_VERSION:?No ERPNext version set}
volumes:
- sites:/home/frappe/frappe-bench/sites
- assets:/home/frappe/frappe-bench/sites/assets:ro

services:
configurator:
<<: *backend_defaults
command: configure.py
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;
environment:
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
Expand All @@ -27,7 +36,9 @@ services:
<<: *backend_defaults

frontend:
image: frappe/frappe-nginx:${FRAPPE_VERSION}
image: frappe/erpnext:${ERPNEXT_VERSION}
command:
- nginx-entrypoint.sh
environment:
BACKEND: backend:8000
SOCKETIO: websocket:9000
Expand All @@ -38,15 +49,17 @@ services:
PROXY_READ_TIMOUT: ${PROXY_READ_TIMOUT:-120}
CLIENT_MAX_BODY_SIZE: ${CLIENT_MAX_BODY_SIZE:-50m}
volumes:
- sites:/usr/share/nginx/html/sites
- assets:/usr/share/nginx/html/assets
- sites:/home/frappe/frappe-bench/sites
depends_on:
- backend
- websocket

websocket:
<<: *depends_on_configurator
image: frappe/frappe-socketio:${FRAPPE_VERSION}
image: frappe/erpnext:${ERPNEXT_VERSION}
command:
- node
- /home/frappe/frappe-bench/apps/frappe/socketio.js
volumes:
- sites:/home/frappe/frappe-bench/sites

Expand All @@ -69,4 +82,3 @@ services:
# ERPNext requires local assets access (Frappe does not)
volumes:
sites:
assets:
46 changes: 0 additions & 46 deletions custom_app/README.md

This file was deleted.

14 changes: 0 additions & 14 deletions custom_app/backend.Dockerfile

This file was deleted.

21 changes: 0 additions & 21 deletions custom_app/compose.override.yaml

This file was deleted.

27 changes: 0 additions & 27 deletions custom_app/docker-bake.hcl

This file was deleted.

37 changes: 0 additions & 37 deletions custom_app/frontend.Dockerfile

This file was deleted.

Loading

0 comments on commit e6088af

Please sign in to comment.