* chore: resolve merge conflict * ci: changes for version 15 * chore: upgrade python and nodejs * ci: fix v15 build * fix: add redis_socketio for backward compatibility * ci: fix v15 build * ci: fix test endpoint changed to erpnext.templates.pages.search_help.get_help_results_sections
4.2 KiB
Images
There are 3 images that you can find in /images directory:
bench. It is used for development. Learn more how to start development.production.- Multi-purpose Python backend. Runs Werkzeug server with gunicorn, queues (via
bench worker), or schedule (viabench schedule). - Contains JS and CSS assets and routes incoming requests using nginx.
- Processes realtime websocket requests using Socket.IO.
- Multi-purpose Python backend. Runs Werkzeug server with gunicorn, queues (via
custom. It is used to build bench usingapps.jsonfile set with--apps_pathduring bench initialization.apps.jsonis a json array. e.g.[{"url":"{{repo_url}}","branch":"{{repo_branch}}"}]
Image has everything we need to be able to run all processes that Frappe framework requires (take a look at Bench Procfile reference). We follow Docker best practices and split these processes to different containers.
We use multi-stage builds and Docker Buildx to reuse as much things as possible and make our builds more efficient.
Compose files
After building the images we have to run the containers. The best and simplest way to do this is to use compose files.
We have one main compose file, compose.yaml. Services described, networking, volumes are also handled there.
Services
All services are described in compose.yaml
configurator. Updatescommon_site_config.jsonso Frappe knows how to access db and redis. It is executed on everydocker-compose up(and exited immediately). Other services start after this container exits successfully.backend. Werkzeug server.db. Optional service that runs MariaDB if you also useoverrides/compose.mariadb.yamlor Postgres if you also useoverrides/compose.postgres.yaml.redis. Optional service that runs Redis server with cache, Socket.IO and queues data.frontend. nginx server that serves JS/CSS assets and routes incoming requests.proxy. Traefik proxy. It is here for complicated setups or HTTPS override (withoverrides/compose.https.yaml).websocket. Node server that runs Socket.IO.queue-short,queue-long. Python servers that run job queues using rq.scheduler. Python server that runs tasks on schedule using schedule.
Overrides
We have several overrides:
overrides/compose.proxy.yaml. Adds traefik proxy to setup.overrides/compose.noproxy.yaml. Publishesfrontendports directly without any proxy.overrides/compose.https.yaml. Automatically sets up Let's Encrypt certificate and redirects all requests to directed to http, to https.overrides/compose.mariadb.yaml. Addsdbservice and sets its image to MariaDB.overrides/compose.postgres.yaml. Addsdbservice and sets its image to Postgres. Note that ERPNext currently doesn't support Postgres.overrides/compose.redis.yaml. Addsredisservice and sets its image toredis.
It is quite simple to run overrides. All we need to do is to specify compose files that should be used by docker-compose. For example, we want ERPNext:
# Point to main compose file (compose.yaml) and add one more.
docker-compose -f compose.yaml -f overrides/compose.redis.yaml config
⚠ Make sure to use docker-compose v2 (run docker-compose -v to check). If you want to use v1 make sure the correct $-signs as they get duplicated by the config command!
That's it! Of course, we also have to setup .env before all of that, but that's not the point.
Check environment variables for more.