Can we separate / install separately the DB (Postgre)

  • Database: Postgre

can we separate / install separately the DB (Postgre)? DB is on another server. If possible, how can I do that?

Of course you can do that.

Install Postgre on another server and add the connection details/credentials to ./config/database.js file.


module.exports = ({ env }) => ({
  defaultConnection: 'default',
  connections: {
    default: {
      connector: 'bookshelf',
      settings: {
        client: 'postgres', //that's important
        host: env('DATABASE_HOST', ''), //ip of the server with postgres
        port:'DATABASE_PORT', 5432), 
        database: env('DATABASE_NAME', 'strapi'),
        username: env('DATABASE_USERNAME', 'strapi'),
        password: env('DATABASE_PASSWORD', 'strapi'),
        schema: env('DATABASE_SCHEMA', 'public'), // Not Required
        ssl: {
          rejectUnauthorized: env.bool('DATABASE_SSL_SELF', false), // For self-signed certificates
      options: {
        ssl: env.bool('DATABASE_SSL', false),

But in this case you will need to expose the 5432 port. Since by default it can’t be accessed from external resources.