Try ERPNext Buy Support Partners Foundation

Official Docker improvements discussion

Continued discussion from ERPNext Docker Image as an alternative to Official ERPNext Docker Repo

There is docker environment for development with bench. Refer this README
People from community are using it for quickly bootstrapping development setup.

One such attempt, Chinmay started with a production installation script called frappe-installer.

Makefile or shell script I don’t mind anything. I hope it’ll only help new comers.
Experts can already use and understand things with or without any abstraction.

Just be careful of adding complexity, may make it difficult for new users to report underlying errors.

As I said before, for development environment bench command is used. Today we even got a PR that allows one environment to host 5 benches.

Reasons for not using bench in production docker:

  • Immutability. All state is in database and volumes only. Adding custom app to container on the fly is not desirable in production because it creates state in container which will be lost.
  • bench image itself adds 1GB of dependencies. Frappe+ERPNext adds ~1.4GB more.
  • bench does a lot of development tooling as well.
  • Each command added as script is auto-tested daily. Ensures stability on production.
2 Likes

Here are the 2 basic goals and potential solutions,

Quick Local setup:

Setup env file, run docker-compose up and visit http://site-from-env-file.localhost

single docker-compose file is required with all redis, mariadb, frappe/erpnext services and port 80 published on host machine

Someone I interacted with on issue used it on LAN/WAN setup with self hosted internal DNS server. e.g. http://site-from-env-file.local-machine-01 was accessible within from LAN.

local setup is required for local api or ui development that needs to connect to erpnext server.

Quick production setup:

Setup env file, run docker-compose up and visit http://site-from-env-file.com

single docker-compose file is required with all redis, mariadb, frappe/erpnext services and some way to manage Letsencrypt.

Problem with current production setup on docker:

  • VERSION is not locked. It’s locked to either major version or edge.
  • VERSION can be separated into FRAPPE_VERSION and ERPNEXT_VERSION to be specific.

Way to achieve new site creation on first run:

docker-compose can have one run-once service to execute the new command to create a site.
It will anyway fail on additional runs as it will try to re-create same site again.

2 Likes

I’ve indeed, seen it, and tried it, and It’s just great a simple docker-compose up -d and you’re up and running. But when I meant something easy for developers, I mean something easy to also deploy, not only for develop. Therefore I agree with your proposal of a simple docker-compose command for production as well.

I would argue that having 3 files for a compose loses you a lot of flexibility even if avoiding repeating once self, since now running docker-compose {logs, dow, build, pull, ...} you have to specify 3 files and the project name.

I’m working on a compose file that uses the awesome linuxserver/letsencrypt container which is nginx and letsencrypt in one container with certifical renewal.

Also looking to modify the entrypoint in the default worker, to check if the app is not installed proceed and install into the database. Still I’m not very knowledgable of many things, but I’ll share what I accomplish, and if good enough will make a PR.

Thank you for your answer.

Docker installation has now one more choice for very simple single docker-compose file installation.

Checkout here https://github.com/frappe/frappe_docker/blob/develop/docs/single-bench.md

Steps in brief:

git clone https://github.com/revant/frappe_docker.git
cd frappe_docker
cp env-local .env
docker-compose up -d

Wait for some time. Or checkout logs to monitor progress of site creation

docker logs frappe_docker_site-creator_1 -f

visit http://mysite.localhost

5 Likes

develop is the branch where people land when they visit https://github.com/frappe/frappe_docker. It is also default branch when repo is cloned.

branches have significance for travis builds here. Not for code.

The important code, Dockerfile(s), config, scripts etc are exactly same on both branches. It is kept same.

master branch triggers versioned image builds. develop branch triggers develop/edge image builds on travis

Thank you @revant_one for this great work, deploying in production with docker-compose for small business now It’s easier than ever. :+1:

1 Like

Tested and works perfectly so far. Good work!

2 Likes

Try ERPNext for around 4 hours for free!

Try in PWD

Wait for 5 minutes or check site-creator container logs before opening browser on port 80.

5 Likes

Image sizes improved.

frappe-worker image is under 1 gb (~851MB) and erpnext-worker image is (~1.03GB)

1 Like

PostgreSQL support for frappe_docker

Note:

  • PostgreSQL is only available for Frappe Framework v12 onwards.
  • PostgreSQL NOT available for ERPNext sites. Refer: Support for PostgreSQL?
  • Bench commands for backup, restore, new site with custom host/port will be available in next minor/patch release of v12 PR#10873
3 Likes

How to install app available from frappe-bench on existing site?

app must be available in custom image, frappe-bench/apps, frappe-bench/sites/apps.txt

Use console command with python container

docker exec -it <erpnext-python-container-name> docker-entrypoint.sh console erp.site.com

once in console enter

from frappe.installer import install_app
# 'custom_app' is the app name
install_app('custom_app', verbose=True)
exit

Hi!, there is a wrapper to integrate MySql to PostgresSQL, may this feature work as a bridge whilst the PostreSQL-ERPNext support is in process. The link is right here: https://pgxn.org/dist/mysql_fdw/
We haven’t tested yet, as soon we have an insight or if someone else makes it work please share here. Regards from Mexico! Stay healthy!!!

Bench commands from frappe framework now work in docker

PR - https://github.com/frappe/frappe_docker/pull/334
Docs: https://github.com/frappe/frappe_docker/blob/develop/docs/site-operations.md#frappe-internal-commands-using-bench-helper

3 Likes