Self-hosting on Gandi | Questions about Strapi and MySQL

System Information
  • Strapi Version: V4
  • Operating System: Mac
  • Database: MySQL
  • Node Version: 16


I have a Strapi backend project with NextJS frontend. I am planning on self-hosting my application on the French web hosting platform. I chose to have my backend’s DB in MySQL due to it’s wide support on hosting platforms. I have not yet purchased a web hosting deal with Gandi because I have a few questions and ponders:

Strapi is a NodeJS application, correct right? It’s 100% Javascript so I should be looking at how Gandi handles hosting on NodeJS applications, like this guide here:

But here where things get even more curious. The popular CMS Ghost has a guide on Gandi: Deploy a Ghost Blog on Web Hosting: Step-by-Step Guide | Web Hosting - Tutorials | Gandi Documentation — Gandi Documentation documentation

I feel like I could go with the NodeJS tutorial and setup the MySQL connection like it provides in the NodeJS guide, but I was wondering if anyone who would happen to be in the know. Is there something vital I am missing that’s exclusive to the Strapi Platform? Like a missing piece that could break or make my Gandi option.

Thanks in advance.

Hi Otso!

FYI I’ve been using Strapi for about 5 days, but I set it up on a DigitalOcean machine with these parameters: 2 GB Memory / 25 GB Disk / Ubuntu 18.04.3 (LTS) x64.

Here are the Strapi requirements from GitHub: GitHub - strapi/strapi: 🚀 Strapi is the leading open-source headless CMS. It’s 100% JavaScript, fully customizable and developer-first.

So until the host is capable of running at least Node 14.x, you should be good to go, and some db (check the GitHub link) from the past 4-5 years, you should be good to go!


I’m continuing this thread because I have a pondering question. Gandi requires a server.js on the root file:

In the instructions here:

const strapi = require('@strapi/strapi');
strapi(/* {...} */).start();

I am pondering what is the strapi() function suppose to hold on itself for arguments? Is the commented object there just as an demonstration or what is it suppose to contain?

I was also wondering do I need this mySQL index.js file that the documentation recommends?

var http = require('http'),
    mysql = require('mysql');

var mysql_conn = mysql.createConnection({
  socketPath: '/srv/run/mysqld/mysqld.sock',
  database: 'default_db',
  user: 'root',
  password: ''

var test_mysql_conn = function(callback) {
  mysql_conn.connect(function(err) {
    if (err) {
      if (callback) callback("NOT WORKING");
    } else {
      if (callback) callback("OK");

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.write('Hello Node.js!\n');
  test_mysql_conn(function(mysql_status) {
    res.write('MySQL connection: ' + mysql_status + '\n');

You probably want to put the configuration values into config/database.ts or config/{env}/{environemtnName}/database.ts if you use different environments.

See Database configuration.