Try ERPNext Buy Support Partners Foundation

Kubernetes: Decoupled Frappe/ERPNext docker images

Yes it should work for trying out things locally on your desktop machine/laptop.

For production setup where you need to access the site from domain name, refer this:

It sets up with auto renewing letsencrypt as long as your DNS points to static IP of production machine

I am trying my luck with a v12 instance but don’t quite understand how to set custom password entries with the docker exec command

docker exec -it \
    -e SITE_NAME=test.localhost \
    -e DB_ROOT_USER=root \
    -e DB_ROOT_PASSWORD=admin \
    -e ADMIN_PASSWORD=admin \
    -e INSTALL_ERPNEXT=1 \
    erpnext_kubernetes_erpnext-python_1 docker-entrypoint.sh new

if you just edit this command with custom passwords the creation fails with a reference to mariadb not accepting the password. There is some sort of reference to passwords (at least the MYSQL_ROOT_PASSWRD) in the .env file. So, how exactly would u have to set this up and match things between the .env file and the docker exec command options in order to work?

docker exec command for new site is like following command

bench new-site \
    test.localhost \
    --mariadb-root-username root \
    --mariadb-root-password admin \
    --admin-password admin \
    --install-app erpnext

This not where the root password and root user for mariadb is set. .env file sets the mariadb root password while starting the container

  • Above command will only use previously set mariadb user and password.
    • In case of docker, user is always root and password is what you set in .env
    • In case of managed db, use the appropriate user and password created on managed db here
  • The above command is correct to set ADMIN_PASSWORD=changeit for the new site to be created.

Example:

if you set MYSQL_ROOT_PASSWORD=somerandomstring in .env you can execute following command to create new site

# set MYSQL_ROOT_PASSWORD in environment
source .env

# Substitute password string with env var 
docker exec -it \
    -e SITE_NAME=test.localhost \
    -e DB_ROOT_USER=root \
    -e DB_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD \
    -e ADMIN_PASSWORD=admin \
    -e INSTALL_ERPNEXT=1 \
    erpnext_kubernetes_erpnext-python_1 docker-entrypoint.sh new

.env is only set once while starting the containers first time. It won’t have any effect if you change it later

To avoid passwords to be shown in shell history, also use $ADMIN_PASSWORD instead of string

1 Like

so you need to adjust the .env file to match your needs then and adjust the docker exec command according those changes when run, right? If that is so, and I can verify this I’ll add an explenation to the README once I am certain how it precisely works.

where exactly do you execute this command? inside the repository on the docker host?

Yes, right.
Thanks for verifying!

Any time there is a need to pass some secret as command line argument,
pass it as environment variable instead of plain string.
This ensures history will only show variable names instead of plain string passwords

e.g.

# "changeit" will remain in shell history
echo "changeit"

# Assuming SECRET_PASSWORD=changeit is set in .env
# $SECRET_PASSWORD will remain in shell history
echo "$SECRET_PASSWORD"

command is run on docker host, in the directory where .env file is available.

About source or . command: https://en.wikipedia.org/wiki/Dot_(command)

2 Likes

@revant_one Great work, I tried it.
But I have a question PLZ, about if we can using or building a docker image of ERPNExt in order to use it by the developers of the team?

docker based development environment already exists (https://github.com/frappe/frappe_docker).

I prefer traditional development install.
Perhaps that’s what helped me build these “production” docker images.

I hope to make these images official.

2 Likes