diff --git a/README.md b/README.md index c9d5e5cb..933d70a8 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Wait for 5 minutes for ERPNext site to be created or check `create-site` contain ### [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) @@ -38,19 +39,21 @@ Wait for 5 minutes for ERPNext site to be created or check `create-site` contain - [Custom Apps](docs/custom-apps.md) - [Build Version 10 Images](docs/build-version-10-images.md) + +### [Development](#development) + +- [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) -### [Development](docs/development.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). diff --git a/docs/list-of-containers.md b/docs/list-of-containers.md index c22da832..c4c3e701 100644 --- a/docs/list-of-containers.md +++ b/docs/list-of-containers.md @@ -3,13 +3,15 @@ There's 4 images that you can find in `/images` directory: - `bench`. It is used for development. [Learn more how to start development](../development/README.md). -- `nginx`. This image contains JS and CSS assets. Container using this image also routes incoming requests using [nginx](https://www.nginx.com). -- `socketio`. Container using this image processes realtime websocket requests using [Socket.IO](https://socket.io). -- `worker`. Multi-purpose Python backend. Runs [Werkzeug server](https://werkzeug.palletsprojects.com/en/2.0.x/) with [gunicorn](https://gunicorn.org), queues (via `bench worker`), or schedule (via `bench schedule`). +- `production`. + - Multi-purpose Python backend. Runs [Werkzeug server](https://werkzeug.palletsprojects.com/en/2.0.x/) with [gunicorn](https://gunicorn.org), queues (via `bench worker`), or schedule (via `bench schedule`). + - Contains JS and CSS assets and routes incoming requests using [nginx](https://www.nginx.com). + - Processes realtime websocket requests using [Socket.IO](https://socket.io). +- `custom`. It is used to build bench using `apps.json` file set with `--apps_path` during bench initialization. `apps.json` is a json array. e.g. `[{"url":"{{repo_url}}","branch":"{{repo_branch}}"}]` -> `nginx`, `socketio` and `worker` images — everything we need to be able to run all processes that Frappe framework requires (take a look at [Bench Procfile reference](https://frappeframework.com/docs/v13/user/en/bench/resources/bench-procfile)). We follow [Docker best practices](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#decouple-applications) and split these processes to different containers. +Image has everything we need to be able to run all processes that Frappe framework requires (take a look at [Bench Procfile reference](https://frappeframework.com/docs/v14/user/en/bench/resources/bench-procfile)). We follow [Docker best practices](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#decouple-applications) and split these processes to different containers. -> ERPNext images don't have their own Dockerfiles. We use [multi-stage builds](https://docs.docker.com/develop/develop-images/multistage-build/) and [Docker Buildx](https://docs.docker.com/engine/reference/commandline/buildx/) to reuse as much things as possible and make our builds more efficient. +> We use [multi-stage builds](https://docs.docker.com/develop/develop-images/multistage-build/) and [Docker Buildx](https://docs.docker.com/engine/reference/commandline/buildx/) to reuse as much things as possible and make our builds more efficient. # Compose files diff --git a/docs/single-compose-setup.md b/docs/single-compose-setup.md new file mode 100644 index 00000000..f5f8397d --- /dev/null +++ b/docs/single-compose-setup.md @@ -0,0 +1,33 @@ +# Single Compose Setup + +This setup is a very simple single compose file that does everything to start required services and a frappe-bench. It is used to start play with docker instance with a site. The file is located in the root of repo and named `pwd.yml`. + +## Services + +### frappe-bench components + +- backend, serves gunicorn backend +- frontend, serves static assets through nginx frontend reverse proxies websocket and gunicorn. +- queue-default, default rq worker. +- queue-long, long rq worker. +- queue-short, short rq worker. +- schedule, event scheduler. +- websocket, socketio websocket for realtime communication. + +### Run once configuration + +- configurator, configures `common_site_config.json` to set db and redis hosts. +- create-site, creates one site to serve as default site for the frappe-bench. + +### Service dependencies + +- db, mariadb, container with frappe specific configuration. +- redis-cache, redis for cache data. +- redis-queue, redis for rq data. +- redis-socketio, redis for socketio pubsub. + +If you understand containers use the `pwd.yml` as a reference to build more complex setup like, single server example, Docker Swarm stack, Kubernetes Helm chart, etc. + +This serves only site called `frontend` through the nginx. `FRAPPE_SITE_NAME_HEADER` is set to `frontend` and a default site called `frontend` is created. + +Change the `$$host` will allow container to accept any host header and serve that site. To escape `$` in compose yaml use it like `$$`. To unset default site remove `currentsite.txt` file from `sites` directory.