Where do you host Strapi?

I’m very impressed with Strapi V4 and I’m currently using it for a new project. In my current setup, it seems like it would cost me $17 per month to host Strapi along with a postgres database.

Just curious, how much does it cost you?

1 Like

5 € a month

Zero per month using Railway with very little effort in the deployment process. That’s including a postgres DB BTW which is unusual on a free offering.

4 Likes

I agree on that, i just have it in a dokku on a VPS hosting more then just strapi with unlimited of the things I need.

Are you using free plan or development with credit card?

I’m using railway too, with full satisfaction and very reasonable fees.

I’ll check out Railway … sounds like a good deal!

1 Like

I just move to Railway and love it so far.

1 Like

Has anyone come across crashes on Railway?

I love it and use it for a few other apps – Has anyone else experienced overnight crashes like this:

[2022-03-15 12:35:58.174] debug: ⛔️ Server wasn't able to start properly.

[2022-03-15 12:35:58.174] error: select "t0"."id" from "admin_users" as "t0" limit $1 - Connection terminated unexpectedly

Error: select "t0"."id" from "admin_users" as "t0" limit $1 - Connection terminated unexpectedly

at Connection. (/app/node_modules/pg/lib/client.js:132:73)

Really struggling to find a solution for it – any help would be great!!

1 Like

Can you slso store images on the Railway servers or will assets be deleted like on Heroku?

Im not sure, never tried. It shouldn’t delete any files as on railway.app your app doesn’t sleep.

But it would be stupid to host files there as it would consume your bandwidth and its better to host on some bucket with cdn. Like s3, or buckblaze

edit: on buckblaze you have 10GB free and if you proxy it with cloudflare you dont pay for bandwith
here is tutorial how to setup BuckBlaze bucket with cloudflare CDN, also you can use Strapi AWS S3 to upload images/files in buckblaze bucket only thing you will need at moment is edit link on your frontend as for now strapi doesnt have cdn links.

this is my setup in plugins.js so that allows me to upload to BuckBlaze B2 bucket using AWS-S3 provider. at moment CDN parametar is not working when i deploy it as i customized it, and its not uploaded when i deploy it, be we all hope that Strapi will soon allow CDN for all upload providers.

upload: {
    config: {
      provider: 'aws-s3',
      providerOptions: {
        accessKeyId: process.env.C1_backblaze_keyID,
        secretAccessKey: process.env.C2_backblaze_applicationKey,
        region: process.env.C3_backblaze_region,
        params: {
           Bucket: process.env.C4_backblaze_keyName,
         },
        endpoint:process.env.C5_endpoint, //workings
        baseUrl: process.env.C6_CDN,
      },
    },
  },

EDIT 2: if you are using my setup like here on top. you can add custom plugin and in src/plugins/<your-plugin-name>/server/bootstrap.js add this:

'use strict';
module.exports = ({ strapi }) => {
  // bootstrap phase
  strapi.db.lifecycles.subscribe({
    models: ['plugin::upload.file'],

    // your lifecycle hooks

    //
    async beforeCreate(event) {
      const { params } = event;
      if(!!strapi.config.get('plugin.upload.providerOptions.baseUrl')){
        params.data.url="https://"+strapi.config.get('plugin.upload.providerOptions.baseUrl')+'/'+params.data.hash+params.data.ext
        if(!!params.data.formats){
          if(!!params.data.formats.thumbnail){
            params.data.formats.thumbnail.url="https://"+strapi.config.get('plugin.upload.providerOptions.baseUrl')+'/'+params.data.formats.thumbnail.hash+params.data.formats.thumbnail.ext
          }
          if(!!params.data.formats.large){
            params.data.formats.large.url="https://"+strapi.config.get('plugin.upload.providerOptions.baseUrl')+'/'+params.data.formats.large.hash+params.data.formats.large.ext
          }
          if(!!params.data.formats.medium){
            params.data.formats.medium.url="https://"+strapi.config.get('plugin.upload.providerOptions.baseUrl')+'/'+params.data.formats.medium.hash+params.data.formats.medium.ext
          }
          if(!!params.data.formats.small){
            params.data.formats.small.url="https://"+strapi.config.get('plugin.upload.providerOptions.baseUrl')+'/'+params.data.formats.small.hash+params.data.formats.small.ext
          }
        }
      }
    },
  }),
};

and you will have cdn link for your images. now only thing you need to do is add your cdn link in your security. LINK

2 Likes

Hi! Did you find a solution for this?

I am experiencing this, too.

Using Render.com with starter plan

C4_backblaze_keyName is a bit misleading… it should be the bucket name, as the parameters says. Got it working, many thanks!

Also is it possible to decide which URL should be in the database? I want to use a subdomain on my website rather than the Blackblaze one.

Is there any solution for this issue other than increase server capacity until it never happens any more? I host strapi on an render.com instance and this error randomly appears. Even on the local dev environment with docker this happens.
Locally and on render ist not that much user traffic, maybe two users at the same time. This can’t be too much.

Looking for some help

Static content like images/videos should go into an S3(-compatible) bucket (or something similar). This allows you to host Strapi in a high available (HA) setup (> 1 instance). If you are not familiar with infrastructure deployment try an ‘app platform’ that several different providers offer. Otherwise, Kubernetes is always a very flexible and scalable way to deploy containerized environments. Both are available at DigitalOcean.

Hope this helps!

parameter names are ones that i use.
Post is updated with new info, if you follow it and understand it you can have. upload to s3 bucket, and proxy throw cloudflare if you edited cloudflare transform rules like described in link provided in post.

In latest update if you add custom plugin you can have url edited on upload and you will have proxied url in database. it can be domain/subdomain depending how you edited cloudflare rules

I’ve used Digital Ocean and Linode to host Strapi with great success. They have managed databases, but if your db is small, you can host the db on the same virtual or dedicated hardware as Strapi.

1 Like

Did you try boosting your plan?

Yep – I’m on the developer plan and definitely paying for it, got 7 other projects running on it fine and only my two Strapi environments are the ones running into problems.

I’ll need more input from more database-minded people… but considering on playing with some of the connection parameters like connection timeouts (tcp_user_timeout) etc

Or switch the database out for a different provider and see if that solves it :man_shrugging:

Have you had any luck / experience similar / have a plan of attack?

I see, I said that because I think I already saw the error message from when I was on a development plan on Platform.sh, also found other people mentioning that on StackOverflow.