api-platform / docs

API Platform documentation
https://api-platform.com/docs/
166 stars 1.08k forks source link

Recommended way to update to latest version #1303

Open sushicodeur opened 5 years ago

sushicodeur commented 5 years ago

Hello,

I installed Api Platform a few month ago, and it look like I'm two version behind the latest one.

I'd like to update to the latest version but didn't found docs on this.

issue api-platform/api-platform#465 states "you are on your own", which is maybe still the case :)

So updating to latest version consists of a bunch of composer update / yarn upgrade commands ? Or is there a more recommended way of doing so ?

What about docker-compose.yml files ? I don't understand well what quay.io does, is there a way to tell docker to take a given version or is it always up to date ?

Thank you

maxhelias commented 5 years ago

This is only my opinion but here is how I do.

  1. I would add this repository as a second remote named "upstream".
  2. Get all "upstream" to rebase it on your update branch (fetch + rebase).
  3. Updating all dependencies (composer & yarn).
  4. Check the Symfony recipe for the API with this command : composer sync-recipes --force
  5. Rebuild all image docker. Before removing the docker cache from the project with this command : docker-compose down --rmi all --remove-orphans (WARNING : Not use the -v flag to keep your database locally) and docker-compose up -d.
  6. And run your unit test for check the BC

I may have forgotten steps, I wrote this message from my memory

maxhelias commented 5 years ago

You can also use the update-deps.sh file 😉

dunglas commented 5 years ago

This script is not provided in the default archive, but maybe should we add it. In this case we should run the composer command directly in a Docker container to be sure that the user don’t have to install PHP on the host.

teohhanhui commented 5 years ago

There is no easy solution to something like this. Once you create a project based on this project (think of it as a template), it's your code now. Anything could change in this project (and in your project), so there's no generic way of providing updates.

mattdillon100 commented 5 years ago

The script shared by @dunglas is a small part of the solution to this issue. However, I partially agree with @teohhanhui; any code that you write within your project becomes your own and you will be responsible for fixing bugs caused by upgrading. This will cause more issues than it will fix so the script should not be included.

All that said, there does need to be a way to upgrade the vendor code of the platform, if not for features, definitely for security.

I believe the solution to this issue is not a script, but documentation.

By comparison, Laravel provides some fantastic documentation around upgrading, including letting you know what you may need to fix in your own code.

This should be fairly easily achieved with the API part of the platform since most deprecations will be symfony based. The difficult parts will be the frontend and the Docker parts. I believe that frontend should really be handled more by the developer rather than the API Platform team but this is just my opinion.

Hopefully, as a developer's project grows, they will begin splitting the codebase and infrastructure into their own entities and decoupling. This removes a lot of the problems listed above as the developer will be forced to take more ownership of the project.

To wrap this up: We should have better docs around upgrading the API service including depreciations and a link to Symfony upgrade docs for the correct version. Also, I would love to see documentation around upgrades in the Docker container, caching, DB, and other infrastructure changes.