Running Frappe's ERPNext using a Docker Compose .yaml file is a confusing and, for me, a frustrating endeavour.
What I hope this gist will acheive is to enlighten others as well on how to run said wonderful software in their own servers.
In this example, we will be using Portainer to run the docker compose file, and store Frappe's data in the base directory /root/data-program/frappe
.
This method requires running a bit of shell script, which is risky. But the script is easily readable and is only a few short lines. Feel free to poke around though, as it is highly encouraged, for your own sake as well.
You need to have Portainer installed in your server. You need a bit of patience as well. Though, I hope that I will save you a lot of debugging through this gist.
You then need to download frappe-init.sh
(attached below) to your server.
Caution
The following commands will erase the directory and its contents that you give to said command
Run the following command to make the base directory and subdirectories where Frappe's data will be stored:
bash frappe-init.sh <base_directory>
Such that storing Frappe's data, you need to run the following command:
bash frappe-init.sh /root/data-program/frappe
I'm sorry, but you still have to modify the docker compose .yaml file. But only a bit!
You only need to replace two things in said file:
[base_directory]
: The base directory used above.[port]
: The port at which you are gonna be accessing your instance locally.
And now, you are ready to go! Go run that thing :3
So, what changed from the original docker compose .yaml file? Actually, now that I've looked at the diff between the original one and my own version, nothing has changed.
So what was the problem that I was trying to solve?
I don't actually remember anymore exactly. What I remember though is that I am having network issues. And then, I tried the solution in this Github issue comment, which does not work for my purposes (See Observations section below)
Ahh, the joys of debugging technology. It looks like I'm the dumb one in here!
As suggested in this Github issue comment, you need to do the following to solve the network issues:
- set the docker compose .yaml file's
services.frontend.environment.FRAPPE_SITE_NAME_HEADER
's value to$$host
; - set the docker compose .yaml file's
services.create-site.command
's last line to have the command's--set-default
option tosocketsite.localhost
However, if you need to access the site in other than socketsite.localhost
, such as the server's IP (an example of is 192.168.1.20
), then it would not work.
If you want to use those settings, then I guess we could make it work. The way I have made it work is by doing these things:
- set the docker compose .yaml file's
services.create-site.command
's last line to have the command's--set-default
option to the base URL from where you want to access the site. ex.:192.168.1.20
orfrappe.localhost.com
. - move
[sites]/socketsite.localhost
to[sites]/[base_URL]
, whereas:[sites]
is where the docker volumesites
is located at. In my config, it is located at/root/data-program/frappe/sites
.[base_URL]
is the base URL from where you want to access the site. ex.:192.168.1.20
orfrappe.localhost.com
.
And there you have it!
I think the app works as is though? I don't even know what I was trying to solve in the first place LMFAOOOO
I am stupid.