PM2 Install

We run n8n on pm2 now on u16 running MySQL and our custom ecosystem file. I’m trying to install on a new server using pm2 and MariaDB. I can get n8n to run after installed however when I restart using the same exact ecosystem file from our other server I get:

0|n8n | Editor is now accessible via:
0|n8n | http://localhost:5678/
0|n8n | User survey updated successfully
0|n8n |
0|n8n | Stopping n8n…
0|n8n | Initializing n8n process

0|n8n | Initializing n8n process
0|n8n | Last session crashed
PM2 | App [n8n:0] exited with code [1] via signal [SIGINT]
PM2 | App [n8n:0] starting in -fork mode-
PM2 | App [n8n:0] online
0|n8n | Initializing n8n process
0|n8n | Last session crashed

The only difference is this server is u20, also tried u22 with the same errors. MySQL seems to be fine as i can access it with the credentials in the config file. I tried to mirror it as much as I could from the old server. Node version is 16 same as old server. We are using the latest release of n8n.

module.exports = {
apps : [{
name : “n8n”,
env: {
N8N_HOST:“n8n.domain.com”,
N8N_BASIC_AUTH_ACTIVE:false,
N8N_BASIC_AUTH_USER:“user account”,
N8N_BASIC_AUTH_PASSWORD:“not used”,
DB_TYPE:“mariadb”,
DB_MYSQLDB_DATABASE:“n8n”,
DB_MYSQLDB_HOST:“localhost”,
DB_MYSQLDB_PORT:“3306”,
DB_MYSQLDB_USER:“root”,
DB_MYSQLDB_PASSWORD:“Supersecret”,
N8N_PROTOCOL:“https”,
NODE_ENV:“production”,
WEBHOOK_TUNNEL_URL:“https://n8n.domain.com/”,
EXECUTIONS_DATA_PRUNE:“true”,
EXECUTIONS_DATA_MAX_AGE:“700”,
GENERIC_TIMEZONE:“America/Chicago”,
WORKFLOWS_DEFAULT_NAME:“New Project”,
NODE_FUNCTION_ALLOW_EXTERNAL:“uuid,moment,lodash”,
N8N_EMAIL_MODE:“smtp”,
N8N_SMTP_HOST:“smtp.postmarkapp.com”,
N8N_SMTP_PORT:587,
N8N_SMTP_USER:“username”,
N8N_SMTP_PASS:“super secret”,
N8N_SMTP_SENDER:"[email protected]",
N8N_SMTP_SSL:“false”,
}
}]
}

Hey @bschnitker,

Welcome to the community :tada:

I would suggest trying the same config outside of PM2 to see if that changes anything but if I had to take a guess I would say the issue is probably with the database settings, As a quick test you could remove those from the file and if it starts up we know that is the problem.

I removed the database settings and it did start. Its so odd as I even cleared the database and started blank with the same results. The credentials all seem to work as well.

Hey @bschnitker,

It could be that for some reason through PM2 localhost is not a valid host, Try using an IP instead.

So i tried via hostname etc it didn’t work, so i went down the rabbit hole of creating a new user for MySQL that isn’t root and it worked.

1 Like

I wonder if maybe root wasn’t allowed to log in from the location or something, the database logs would likely show more but using a root account for a database is generally considered a bad practice anyway so you are likely to be better off now :slight_smile:

Its possible, and very true on the root part. I was really trying to get it installed again as i hadn’t installed it in a long time, for proof of concept mostly.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.