Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove need for restart of server when creating content. #1256

Closed
blaasvaer opened this issue May 23, 2018 · 17 comments
Closed

Remove need for restart of server when creating content. #1256

blaasvaer opened this issue May 23, 2018 · 17 comments
Assignees
Labels
issue: enhancement Issue suggesting an enhancement to an existing feature severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve

Comments

@blaasvaer
Copy link

blaasvaer commented May 23, 2018

Informations

  • Node.js version:
    9.0.0
  • npm version:
    6.0.1
  • Strapi version:
    3.0.0-alpha.12.2
  • Database:
    MongoDB v3.6.5
  • Operating system:
    Mac OS X Sierra
    What is the current behavior?
    The server restarts when I create a content type.

Steps to reproduce the problem
Create a content type.

What is the expected behavior?
I would expect the server to just keep running after creating a content type and an entry with a couple of fields.

Why would a whole server need to be restarted when only 'content' is created? Something seems wrong, from an architectural point of view …

Suggested solutions
Well, make is possible to dynamically create content types without requiring a server restart.

@lauriejim
Copy link
Contributor

Hello @blaasvaer , please follow the issue template so we can get a better understanding about the origin of your bug.
I will reopen your issue as soon as it follows the templating guidelines.
Thank you.

@blaasvaer
Copy link
Author

Added bug templating ...

@derrickmehaffy
Copy link
Member

@blaasvaer the server needs to restart because the content structure is not stored in the database but in files itself, which in order for those files to be loaded the application needs to restart.

They have moved many of the older options (specifically with permissions) over to the database so it doesn't need to restart. Generally when in development like this, the application shouldn't be used in production thus the restarting doesn't affect the progress. Your welcome to generate the APIs over the command line instead and start the server after that.

@lauriejim lauriejim reopened this May 23, 2018
@mnlbox
Copy link
Contributor

mnlbox commented May 24, 2018

I also think that if Strapi use an approach like Meteor framework it's better.
In Meteor you have hot reload and it's increase development speed a lot and have a build command that useful when we want to move project from development to production.

@lauriejim , @soupette , @Aurelsicoko Guys please see Meteor CLI and framework approach.

@lauriejim lauriejim added issue: enhancement Issue suggesting an enhancement to an existing feature severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve labels May 24, 2018
@Aurelsicoko
Copy link
Member

Our current architecture forces us to restart the server because of new files which are created when you're creating a new content-type. It's important for us to not move the models in the database. We could add an hot-reload feature though. We won't be able to guarantee it works 100% of the time but it could be a great approach to remove the server restart.

@blaasvaer
Copy link
Author

Well, no true dynamic system should ever need a restart when only »content« is manipulated in any way. That would be a faulty architecture. And Content Types in a Headless CMS should also just be considered »content«, as that's what it's all about. Content Types is what an administrator should be able to »administrate« …

@Aurelsicoko
Copy link
Member

We're not a Headless-CMS. You can use Strapi like that but the product is based on a framework with a similar architecture like Sails, Rails, etc. Creating a Content-Type means create a model at the framework level. It also means setting the new model in Mongoose or Bookshelf, make sure the relationships are correct, etc.

We have this architecture to keep Strapi flexible and customisable in any way. If you already have used others frameworks like Laravel, Rails or Symfony, the models are defined into files, not in the database. In Node.js (Koa) to update the route available and to be able to make CRUD actions on a Content-Type, we have to reload the middleware stack because it can't be updated on the fly. In other words, it means to restart the entire server. We're talking about 30s (max) when you create a new Content-Type, it's not so much but I can also understand this is frustrating.

We can find a workaround to this technical limitation but I'm not sure it's a good idea.

@blaasvaer
Copy link
Author

Well, in that case you know best. ; )

@Aurelsicoko
Copy link
Member

As I said, we could certainly add the hot-reload feature, if the restart is too long for the major part of the community 👍

@blaasvaer
Copy link
Author

blaasvaer commented May 24, 2018

And your intro video on the site gives exactly the impression of a Headless CMS ... and if it's to also be used as that, then a restart of the server for creating a Content Type is not really that cool ; ).

@blaasvaer
Copy link
Author

Well, have to see what the community wants then.

@Aurelsicoko
Copy link
Member

We're a "new kind" of software, we aim to define us as an "API-first backend solution". We have Headless-CMS capabilities and you can use the product like that, but some people are using us to develop the backend of their marketplaces, mobile apps, etc.

@blaasvaer
Copy link
Author

Kewl.

@derrickmehaffy
Copy link
Member

We're a "new kind" of software, we aim to define us as an "API-first backend solution". We have Headless-CMS capabilities and you can use the product like that, but some people are using us to develop the backend of their marketplaces, mobile apps, etc.

I am one of those who is not using this as a Headless-CMS, as a matter of fact I likely won't even have a frontend for the API, we are using Strapi like you would use similar software like Loopback. Hence the reason why I don't view the restarting as a big issue.

All of your content-types should be defined in the development environment, then tested in staging, and finally deployed to production. While in production those content types shouldn't be modified at all, thus the server will never need to "restart". Doing such changes in a production environment is not only bad practice (see "testing in production") but could be extremely damaging to the database, especially with Strapi geared towards power-users and new players in the game.

Not everyone is happy-go-lucky in their development process. That being said the start time with Strapi and using a SQL database like MySQL is quite long at the moment (anywhere from 20s to 60s), but @lauriejim is aware of the issue and knows that bookshelf needs some re-work.

@blaasvaer I suggest that if you have issues with how Strapi works, your welcome to fork the project and build it as you see fit, or you could be helpful and submit Pull Requests to help build on the framework. I feel as though your side comments are quite rude personally, and not -at all- helping anyone here, or the project as a whole.

@blaasvaer
Copy link
Author

blaasvaer commented May 24, 2018

@derrickmehaffy Excuse me, rude, how!? Have I stepped on some curling kids toes here or what's the case!?

@derrickmehaffy
Copy link
Member

@blaasvaer the issues section is not the place to discuss this, your welcome to PM me on the slack, and I would be more than willing to talk to you about it.

@blaasvaer
Copy link
Author

Oh, there comes the adult card. Nevermind, I'm not into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: enhancement Issue suggesting an enhancement to an existing feature severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve
Projects
None yet
Development

No branches or pull requests

5 participants