Force database creation in install script?

Actually it appears I do not actually have ERPNext installed, just Frappe/Bench?

I have no Setup > Settings > Show or Hide Modules…
https://frappe.github.io/erpnext/user/manual/en/setting-up/settings/module-settings.html

But frappe-bench/sites/apps.txt shows:
frappe erpnext

I must be missing something simple?

You need to install it to your site

bench --site sitename install-app erpnext

Thanks rmheta!

Thought for sure I had that step taken care of. When I run that command now I get:

Installing erpnext...
ERPNext can only be installed on a fresh site where the setup wizard is not completed
You can reinstall this site (after saving your data) using: bench --site [sitename] reinstall

So I guess I have to remove the site, recreate it and run this command?

Yup, a:

bench drop-site sitename
bench new-site sitename
bench --site sitename install-app erpnext
bench use sitename

And I’m in business. Thanks again for the help guys! :slight_smile:

Hmmm… now I have a giant “E” icon that obscures many of the icons on the desktop. I seem to recall a less/css error during my setup process, perhaps this is it?

edit:
Yup, that would be it. As noted above:

10:20:19 watch.1 | ParseError: Unrecognised input in /home/frappe/frappe-bench/apps/erpnext/erpnext/public/less/erpnext.less on line 135, column 14: 10:20:19 watch.1 | 134 .erpnext-icon { 10:20:19 watch.1 | 135 width: 24px;ack 10:20:19 watch.1 | 136 margin-right: 0px; 10:20:19 watch.1 |

frappe-bench/sites/assets/erpnext/css/erpnext.css is zero bytes.

I guess I’ll have to figure out how to translate that less file into a css file myself.

bench [--site sitename] reinstall
bench [--site sitename] install-app erpnext

can you try building it again? bench update should build it.
Or
bench build

Thanks revant_one! I just manually built the file, as there was only a single variable used in it anyway.

New problem… what does this mean?

Error: ENOENT, stat '/home/frappe/frappe-bench/index.html'

This is what I get when I look at http://127.0.0.1:9000 (the socket.io server).

As seen in the browser while at /desk:

GET https://*sitename*/socket.io/?EIO=3&transport=polling&t=1469815147633-31 404 (Not Found)

I suspect my apache proxy directives are inadequate for socketio as-is, looks like I will need to add the headers as specified in the nginx config…

I have been over my apache configuration six ways to Sunday, and I know I am hitting everything that Frappe/Bench/ERPNext expects.

Current config (still testing, USER=frappe user, SITENAME=domain):

ProxyPreserveHost Off
ProxyAddHeaders Off
ProxyTimeout 120
ProxyPass "/.well-known/" "!"
ProxyPass "/AutoDiscover/" "!"
ProxyPass "/mail/" "!"
ProxyPass "/cgi-bin/" "!"
ProxyPass "/assets/" "!"
ProxyPass "/files/" "!"
ProxyPass "/socket.io"  "http://127.0.0.1:9000"
<Location "/socket.io">
RequestHeader set Upgrade "HTTP/1.1"
RequestHeader set Connection "Upgrade"
RequestHeader set X-Frappe-Site-Name "SITENAME"
RequestHeader set Origin "https://SITENAME"
RequestHeader set Host "SITENAME"
#ProxyPass "http://127.0.0.1:9000"
</Location>
Alias "/assets" "/home/USER/frappe-bench/sites/assets"
<Directory /home/USER/frappe-bench/sites/assets>
Options FollowSymLinks
Require all granted
</Directory>
Alias "/files" "/home/USER/frappe-bench/sites/SITENAME/public/files"
<Directory /home/USER/frappe-bench/sites/SITENAME/public/files>
Options FollowSymLinks
Require all granted
</Directory>
ProxyPass "/"  "http://127.0.0.1:8000/"
<Location "/">
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Frappe-Site-Name "SITENAME"
RequestHeader set Host "SITENAME"
#ProxyPass "http://127.0.0.1:8000/"
</Location>
#ProxyPassReverse "/socket.io/"  "http://127.0.0.1:9000/"
#ProxyPassReverse "/"  "http://127.0.0.1:8000/"

So I thought I’d take a look at the code. And I find this in /home/USER/frappe-bench/apps/frappe/socketio.js early in the file as the first function called after http.listen:

// test route
app.get('/', function(req, res){
  res.sendfile('index.html');
});

Well now that matches the error I am getting, this file is not present in /home/USER/frappe-bench/apps/frappe/. Now obviously I am not the one who designed this, but that just seems wrong to me. I would assume that these ajax calls to /socket.io are intended to return data presumably in json format, not simply send an index.html file (which happens to not exist).

Has anyone else checked the javascript console of a browser connected to a copy of the latest versions of Frappe/Bench/ERPNext? Do you see similar 404 errors?

edit: well I thought why not just give it what it wants? so I created a simple /home/frappe/frappe-bench/index.html file:

<html>
<head></head>
<body>
<p>frappe-bench</p>
</body>
</html>

And the error is gone. But I am left wondering, is socketio.js really doing the job it was intended to do, or is it just sending an html file instead of actual polling data?

edit2: well I had a look, and sure enough, socketio.js is doing exactly that, just sending a simple html file, no actual data. and now that it is not hitting an error about the missing html file and retrying on an interval, the browser is calling for that “polling” data every few milliseconds and queueing up the requests, quickly saturating cpu usage on the client.

So after all this effort to get socketio/redis running, it is not actually doing anything! Wow.

It is starting to look to me like ERPNext is nowhere near ready for primetime.

edit 3: I’ll give it one more chance, and try commenting out the call to send index.html in socketio.js and see what I get.

edit 4: nope - no joy, commenting out that code bomb and restarting supervisord, the error that /socket.io spits out now is like Cannot GET /?EIO=3&transport=polling&t=1470083271385-2. So it really is not doing anything useful at all.

1 Like

Interesting findings, maybe we should have another thread for this?

FYI, This is my currently working Apache configuration (Apache 2.4 with Let’s encrpyt SSL).

Socket.io was the main problem, finally I found a way to make it work (transport=polling requests to /socket.io must be http, all other requests to /socket.io must be websocket).

<VirtualHost *:443>
        ServerAdmin erpnext@example.com
        ServerName erpnext.example.com

        DocumentRoot /home/frappe/frappe-bench/sites/erpnext.example.com/

        ProxyPreserveHost On
        ProxyRequests Off
        ProxyTimeout 120
        ProxyPass "/.well-known/" "!"
        ProxyPass "/AutoDiscover/" "!"
        ProxyPass "/mail/" "!"
        ProxyPass "/cgi-bin/" "!"
        ProxyPass "/assets/" "!"
        ProxyPass "/files/" "!"
        
        RewriteEngine On
        RewriteCond %{REQUEST_URI}  ^/socket.io               [NC]
        RewriteCond %{QUERY_STRING} transport=polling         [NC]
        RewriteRule /(.*) http://localhost:9000/socket.io/$1  [P,L]
        RequestHeader set Host "erpnext.example.com"
        RequestHeader set X-Frappe-Site-Name "erpnext.example.com"
        ProxyPass "/socket.io" "ws://localhost:9000/socket.io/"
        ProxyPassReverse "/socket.io" "ws://localhost:9000/socket.io/"
        <Location "/socket.io">
            RequestHeader set X-Frappe-Site-Name "erpnext.example.com"
        </Location>

        Alias "/assets" "/home/frappe/frappe-bench/sites/assets"
        <Directory /home/frappe/frappe-bench/sites/assets>
            Options FollowSymLinks
            Require all granted
        </Directory>
        Alias "/files" "/home/frappe/frappe-bench/sites/erpnext.example.com/public/files"
        <Directory /home/frappe/frappe-bench/sites/erpnext.example.com/public/files>
            Options FollowSymLinks
            Require all granted
        </Directory>
        ProxyPass "/"  "http://localhost:8000/"
        ProxyPassReverse "/"  "http://localhost:8000/"
        <Location "/">
            RequestHeader set X-Frappe-Site-Name "erpnext.example.com"
        </Location>

        SSLCertificateFile /etc/letsencrypt/live/erpnext.example.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/erpnext.example.com/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>