I’m trying to deploy ERPNext with nomad
in a LAN deployment (no reverse proxy and just http), with each container’s config loosly based on pwd.yml
It seems I got everything running, bench new-site
also seems to have worked correctly:
but when I point my browser at http://erpnext.ryzerv.gtnet.lan:19080/
(I made a vhost alias in the DNS forwarder of my router so nginx
can get a server name, but it doesn’t seem to make a difference, so same with http://ryzerv.gtnet.lan:19080/
). I get
> nomad alloc logs -f -task task-erpnext15-frontend -job 1nnolan-erpnext15
...
2024-12-14T22:29:05.286452738+01:00 stderr F 2024/12/14 21:29:05 [error] 4#4: *23 upstream timed out (110: Connection timed out) while connecting to upstream, client: 192.168.1.55, server: erpnext, request: "GET /favicon.ico HTTP/1.1", upstream: "http://192.168.1.114:28831/favicon.ico", host: "erpnext.ryzerv.gtnet.lan:19080", referrer: "http://erpnext.ryzerv.gtnet.lan:19080/"
2024-12-14T22:29:05.286524254+01:00 stdout F 192.168.1.55 - - [14/Dec/2024:21:29:05 +0000] "GET /favicon.ico HTTP/1.1" 504 569 "http://erpnext.ryzerv.gtnet.lan:19080/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
If I connect directly to the backend, I see this:
> curl -s "http://192.168.1.114:28831"
<!doctype html>
<html lang=en>
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>192.168.1.114 does not exist</p>
Any ideas?
frappe-bench will know which site to serve from the sites
directory as per the host header.
if you have your.site.name
under your sites
directory then try,
curl -H "Host: your.site.name" -s "http://192.168.1.114:28831/api/method/ping"
you will get {"message":"pong"}
.
If you cannot access the site like this? you need ip:port
access or some other domain pointing to existing site?
- you can override, host header at porxy/lb level as done here
- you can set the site as default site to serve from bench, in case your bench only serves 1 site then you can set it to default.
pwd.yml
does this with --set-default
here
- if you need advance nginx config then mount template at
/templates/nginx/frappe.conf.template
and it will be used to generate the nginx config when starting the container. Default template is like this
1 Like
Thanks that’s very helpful and brings me closer!
I already set the default at some point, but I just found out that there was another error which probably caused it to fail: bench new-site
actually results in:
Aborted connection 2139 to db: 'erpnext15' user: 'erpnext15' host: '172.26.64.1' (Got an error reading communication packets)
in my mariadb
logs, and the site database is never created!
In the end I’m not sure whether it was !
in some passwords (that may have messed with (un-escaped?) bash init code or an issue where bench set-mariadb-host "address:port"
should have had only the address (mind there is no bench set-mariadb-port
, so this assumption is logical) and ended up in the common_site_config.json
. There were no logs whatsoever though that could have pointed to DB connection errors in new-site
, even with --verbose
, which is a bit problematic.
Further it seems that nomad/consul messed up with substituting the correct (internal) backend address in the frontend’s config, so it was a template/nomad/consul issue.
After having solved that, I’m now at the Frappe login screen but cannot enter with the configured admin password.
1 Like
Oh wait, “Administrator” instead of “admin”
Ok, it now works!
So I can confirm it’s doable on nomad with external DB/redis services, even though it was a bit trickier than expected.
A few things may have been smoother if the usage of env vars vs flags would’ve been more consistent, especially now that the same base image is being used for all service instances. You may take a look at e.g. bunkerweb
and “multi-site” behaviour, which can be 100% controlled through env vars so there’s an idempotent setup/start behaviour.
1 Like
You can note it down as forum topic, it’ll be helpful for people using nomad.