<h1>Updating Craft on the production server</h1>
<p>Assuming the up-to-date composer file was committed and pushed to the repository:</p>
<pre><code>cd /path/to/repo

# Removes any changes that would block the pull and then pulls from master (or your branch name of choice)
git reset HEAD --hard
git pull origin master

composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader

# Depending on the actual server, reload the PHP FPM service to clear the cache
service php7.4-fpm reload

# This one does a backup by default
./craft migrate/all

./craft project-config/apply

# Watch out here, because probably not all caches should be cleared: Imagine all image transforms are gone, not great.
./craft clear-caches/all 
</code></pre>
<h1>Updating Craft in the development environment</h1>
<p>This part is covered by the docs: <a href="https://craftcms.com/docs/3.x/updating.html#updating-from-the-terminal" rel="nofollow noreferrer">Updating from the terminal</a></p>
<h1>To queue or not to queue</h1>
<p>In most cases it is not necessary to touch the queue system, since it relies on Control Panel visits. Here is some more info: <a href="https://craftcms.com/docs/3.x/extend/queue-jobs.html#to-queue-or-not-to-queue" rel="nofollow noreferrer">Queues</a></p>

CC BY-SA 4.0
2021-04-18T14:30:35.003Z
2021-04-18T14:30:35.003Z
Johannes
<p>I disable admin updates on production sites, and update Craft and its plugins by updating in the development environment, and then deploying to production using Git.</p>
<p>My basic process starts like this:</p>
<ol>
<li>Update Craft/Plugins in the development environment</li>
<li>Commit updated <code>composer.json</code> and <code>composer.lock</code></li>
<li>On production, pull changes from Git</li>
<li>Run <code>composer install</code></li>
</ol>
<p>What additional steps are necessary to ensure that the production site is updated correctly?</p>
<p>I'm aware that we still have to run:</p>
<ul>
<li><code>./craft project-config/apply</code></li>
<li><code>./craft migrate/up</code></li>
</ul>
<p>Should we also run these commands?</p>
<ul>
<li><code>./craft clear-caches/all</code></li>
<li><code>./craft queue/run</code></li>
</ul>
<p>Are there any other commands that should be run to help ensure a smooth update? Also, what is the correct order to run them in?</p>
<p>Thanks!</p>

<craft3><composer><deployment>
What is the correct way to update a production site with composer?
# What is the correct way to update a production site with composer?

(Asked by: username_0 on 2019-07-15)

I disable admin updates on production sites, and update Craft and its plugins by updating in the development environment, and then deploying to production using Git.

My basic process starts like this:

1. Update Craft/Plugins in the development environment
2. Commit updated `composer.json` and `composer.lock`
3. On production, pull changes from Git
4. Run `composer install`

What additional steps are necessary to ensure that the production site is updated correctly?

I'm aware that we still have to run:

* `./craft project-config/apply`
* `./craft migrate/up`

Should we also run these commands?

* `./craft clear-caches/all`
* `./craft queue/run`

Are there any other commands that should be run to help ensure a smooth update? Also, what is the correct order to run them in?

Thanks!

**Tags:** craft3, composer, deployment

---

## 1 answers

### Answer by username_1 on 2021-04-18. Score: 1

Updating Craft on the production server
Assuming the up-to-date composer file was committed and pushed to the repository:
cd /path/to/repo

# Removes any changes that would block the pull and then pulls from master (or your branch name of choice)
git reset HEAD --hard
git pull origin master

composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader

# Depending on the actual server, reload the PHP FPM service to clear the cache
service php7.4-fpm reload

# This one does a backup by default
./craft migrate/all

./craft project-config/apply

# Watch out here, because probably not all caches should be cleared: Imagine all image transforms are gone, not great.
./craft clear-caches/all 

Updating Craft in the development environment
This part is covered by the docs: Updating from the terminal
To queue or not to queue
In most cases it is not necessary to touch the queue system, since it relies on Control Panel visits. Here is some more info: Queues


---

