Deploying on ubuntu cloud computing

System Information
  • Strapi Version: 3.5.1
  • Operating System: ubuntu 20.4
  • Database: postgres
  • Node Version: 14.16
  • NPM Version: 7.6

So I have ubuntu 20.4 on a cloud computer with postgres setup. I want to deploy strapi in production on it but I’m stuck on how to connect the postgres db to strapi and run it in production (maybe i’m just overthinking it).

Do I follow the same steps as setting up strapi on google gcloud where all the connection info goes in app.yaml?

Do I then push it to github and then pull it on my cloud computer, run npm install, and then run strapi production command?

I’m just having a hard time wrapping my head around it and been trying to google it as much as I can.

any tips on this?

Create file:
config/database.js
For MySQL you can write (for Postgress you need another config):

module.exports = ({ env }) => ({
  defaultConnection: 'default',
  connections: {
    default: {
      connector: 'bookshelf',
      settings: {
        client: 'mysql',
        host: env('DATABASE_HOST', '127.0.0.1'),
        port: env.int('DATABASE_PORT', 3306),
        database: env('DATABASE_NAME', 'strapi3'),
        username: env('DATABASE_USERNAME', 'root'),
        password: env('DATABASE_PASSWORD', 'root'),
        ssl: env.bool('DATABASE_SSL', false),
      },
      options: {}
    },
  },
});

To set up Strapi with a Postgres database on Ubuntu 20.4, you can follow the same steps as setting up Strapi on Google Cloud. All the connection information for the Postgres database will go in the app.yaml file. Once you have everything set up in the app.yaml file, you can push it to GitHub and then pull it down on your cloud computer. Once you have the code on your computer, run the npm install command to install all the dependencies for Strapi. After that, you can run the Strapi production command to start the server. This is how the guys from a London IT company helped me to solve this question.

To answer your question, the general steps would be to follow the same steps as setting up strapi on Google GCloud where all the connection info goes in app.yaml. Then you can push it to Github and pull it on your cloud computer. After that, you can run npm install and then run the strapi production command. The best way to confirm that the setup is correct is to test it out and make sure it works as intended. If it works, then you know you set it up correctly. If not, get in touch for a cloud consultancy, and the guys from there will help! Good luck!