Local Docker Deployment

i have been trying to install the erpnext via docker. i am not at expert with docker so thats why i am here :slight_smile:
So i tried setup a production environment
1: my env-production file is blow

LETSENCRYPT_EMAIL=email@example.com
ERPNEXT_VERSION=edge
FRAPPE_VERSION=edge
MARIADB_HOST=mariadb
MYSQL_ROOT_PASSWORD=admin
SITE_NAME=erp.localhost
SITES=`erp.localhost`
DB_ROOT_USER=root
ADMIN_PASSWORD=admin
INSTALL_APPS=erpnext
ENTRYPOINT_LABEL=traefik.http.routers.erpnext-nginx.entrypoints=websecure
CERT_RESOLVER_LABEL=traefik.http.routers.erpnext-nginx.tls.certresolver=myresolver
HTTPS_REDIRECT_RULE_LABEL=traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
HTTPS_REDIRECT_ENTRYPOINT_LABEL=traefik.http.routers.http-catchall.entrypoints=web
HTTPS_REDIRECT_MIDDLEWARE_LABEL=traefik.http.routers.http-catchall.middlewares=redirect-to-https
HTTPS_USE_REDIRECT_MIDDLEWARE_LABEL=traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https

2 : cp env-production .env
3 : docker-compose --project-name erpnext up -d
4 : docker logs erpnext_site-creator_1 -f
a

when i access my site at
http://localhost:443/
404
or
https://erp.localhost/
internal server

can some body help me fix the issue

1 Like

@revant_one can you have look at this …

use env-local instead of env-production

env-production is for live servers with ip and dns configured.

1 Like

thanks its working i have one another question @revant_one
how do i execute these multi line commands can you explain it a little thanks. i am using windows 10 power shell.

$ docker-compose \
    --project-name <project-name> \
    -f installation/docker-compose-common.yml \
    -f installation/docker-compose-erpnext.yml \
    -f installation/docker-compose-networks.yml \
    --project-directory installation up -d 

or

docker run \
    -e "SITE_NAME=$SITE_NAME" \
    -e "DB_ROOT_USER=$DB_ROOT_USER" \
    -e "MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD" \
    -e "ADMIN_PASSWORD=$ADMIN_PASSWORD" \
    -e "INSTALL_APPS=erpnext" \
    -v <project-name>_sites-vol:/home/frappe/frappe-bench/sites \
    --network <project-name>_default \
    frappe/erpnext-worker:$VERSION new

I don’t have windows.

I use docker on my Linux machines.

Hi, I’m not familiar with docker and I’ve got a similar difficulty with docker tutorial (https://github.com/frappe/frappe_docker/blob/develop/docs/single-bench.md).
I tried to install ERPNEXT in local mode but I’ve got an error in my.cnf after executing docker-compose with env-local setup.
Any idea?

docker logs pasfou20200823_site-creator_1 -f
Attempt 1 to connect to mariadb:3306
Attempt 2 to connect to mariadb:3306
Attempt 3 to connect to mariadb:3306
Attempt 4 to connect to mariadb:3306
Attempt 5 to connect to mariadb:3306
Attempt 1 to connect to redis-queue:6379
Attempt 1 to connect to redis-cache:6379
Attempt 1 to connect to redis-socketio:6379
Connections OK
Created user _69928f0f6369849a
Created database _69928f0f6369849a
Granted privileges to user _69928f0f6369849a and database _69928f0f6369849a
For key character_set_server. Expected value utf8mb4, found value latin1
For key collation_server. Expected value utf8mb4_unicode_ci, found value latin1_swedish_ci
================================================================================
Creation of your site - mysite.localhost failed because MariaDB is not properly
configured. If using version 10.2.x or earlier, make sure you use the
the Barracuda storage engine.
Please verify the settings above in MariaDB’s my.cnf. Restart MariaDB. And
then run bench new-site mysite.localhost again.
================================================================================
Database settings do not match expected values; stopping database setup.
Attempt 1 to connect to mariadb:3306
Attempt 1 to connect to redis-queue:6379
Attempt 1 to connect to redis-cache:6379
Attempt 1 to connect to redis-socketio:6379
Connections OK
Site mysite.localhost already exists
Attempt 1 to connect to mariadb:3306
Attempt 1 to connect to redis-queue:6379
Attempt 1 to connect to redis-cache:6379
Attempt 1 to connect to redis-socketio:6379
Connections OK

frappe.cnf needs to be mounted in mariadb container /etc/mysql/conf.d/frappe.cnf.

check if that is mounted in container.

No issue on daily cron tests related to config missing,

Travis CI - Test and Deploy with Confidence check your config.

Recommended to know about docker before using it.

Hi Revant_one, thanks for your response.
I tried many options to solve this problem and finally, I found that it doesn’t work on windows (I did not mentionned I was on W10).
WSL (required by docker desktop) is no equivalent as a linux native installation.
I tried with docker in a Linux VM machine and then the installation of the above procedure works fine. Unfortunately though I know the ip adress of the VM, I can’t acces to ERPNEXT from the host. I have the message “404 page not found” in the browser.

Site can only be accessed by sitename and not using ip address. It uses dns multi tenancy.

If you need to access by ip address you’ll need to configure traefik for your need. (I don’t know how to configure traefik for your case, check traefik docs)

To access from same machine, Add ip in hosts file mapped as the site you added.

If you need to access under lan, then setup a DNS server that can be used under private lan that has the site name entries mapped to windows machine ip. Remember to allow forwarded ports from vm to be accessible from lan.

I’ve not used all the above config for LAN usage from windows using vm.

Someone did setup local DNS server and got it working.
Check the frappe_docker issues, search for DNS.


What is the situation that I am installing with Docker

  1. Are you installing ERPNext over fresh site? It requires fresh site where wizard is not complete.
  2. Make sure frappe branch and erpnext branch is same. e.g. version-12 branch

I’m able to create new site and install erpnext without error on docker setup as well as native bench setup.

git clone GitHub - frappe/frappe_docker: Docker images for production and development setups of the Frappe framework and ERPNext
cd frappe_docker
https://github.com/frappe/frappe_docker/blob/develop/docs/single-bench.md
I installed it here. This doesn’t seem right.Can you tell me how to install it correctly

I can’t help you. I tried.

I can’t understand why it’s not working on your machine.
docker-test.sh are passing. My servers are working. Documentation is not wrong. (community corrects it and keeps docs updated).

Is this installed first and then under the installation
https://github.com/frappe/frappe_docker/blob/develop/docs/single-bench.md

@revant_one
i am working on my local computer using env-local file install erpnext. thanks to you i was able to install the erpnext via docker. recently i wanted to updated the erpnext follow the instruction on the erpnext docker guide the process was error free but i was unable access my site. so i remove each container manually from docker dashboard. now when i want to install the erpnext with the same project name the site creator container log says the the site already exists.
the command below
docker-compose --project-name erpnext up -d
Question : how do i remove the remove / uninstall/ delete the existing project from command prompt to avoid situation.

Situation 2
So when i manually deleted the each container from docker dashboard and created new project with another anime with same env-local. i have no running containers on my docker. the process is success but the site creator gives me following error. kindly point me right direction thanks

Attempt 1 to connect to mariadb:3306
Attempt 2 to connect to mariadb:3306
Attempt 3 to connect to mariadb:3306
Attempt 1 to connect to redis-queue:6379
Attempt 1 to connect to redis-cache:6379
Attempt 1 to connect to redis-socketio:6379
Connections OK
Created user _69928f0f6369849a
Created database _69928f0f6369849a
Granted privileges to user _69928f0f6369849a and database _69928f0f6369849a
For key character_set_server. Expected value utf8mb4, found value latin1
For key collation_server. Expected value utf8mb4_unicode_ci, found value latin1_swedish_ci

Creation of your site - mysite.localhost failed because MariaDB is not properly
configured. If using version 10.2.x or earlier, make sure you use the
the Barracuda storage engine.

Please verify the settings above in MariaDB’s my.cnf. Restart MariaDB. And
then run bench new-site mysite.localhost again.

Database settings do not match expected values; stopping database setup.

If you need to clean everything including volumes data, containers:

# Stop all containers
docker stop $(docker ps -a -q)
# Prune system
docker system prune -f
# Prune volumes
docker volume prune -f

Mariadb for frappe needs special config. It is mounted from file in mariadb container.

only after that frappe/erpnext databases for sites can be created.

1 Like

ok done the above steps … alot of cleaning has been done … thanks that was quite usefull
my frappe-mariadb.cnf in the installation folder is below

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4

what is missing here …

This error is because the custom .cnf is not loaded as config by mariadb container.

docker-compose up -d from frappe_docker directory takes care of mounting the volumes.

Is the config file mounted as volume in docker container which was created through dashboard?

Please go through docker basic commands. It’ll help if you need to use docker.

I am facing the similar kind of problem on setup of erpnext via docker. I have followed the below steps:

  1. git clone GitHub - frappe/frappe_docker: Docker images for production and development setups of the Frappe framework and ERPNext
  2. cd frappe_docker
  3. cp env-local .env (with changes to sitenames)
  4. docker-compose --project-name erpnext up -d
  5. docker logs erpnext_site-creator_1 -f

When I try to access it through the name given in SITE_NAME in env-local file, I am not able to access it. Could you please help on how to debug and check what went wrong or if you could flag the mistake from the above mentioned steps or screenshot, It would be great.

What is the site name used? Try adding it to /etc/hosts