3 min read

How to Update Directus?

It's important to keep Directus up to date. Each new version fixes bugs or issues that have been discovered since the last version and sometimes includes new exciting features.

It's important to keep Directus up to date. Each new version fixes bugs or issues that have been discovered since the last version. Sometimes, a new version can contain new features that enrich your data and your user experience. In this article I will cover how you can update Directus to the latest version. This assumes you know how to access your Server and use the command line.

To update Directus, you must first navigate to your project folder. Once there, execute the update command using the same user as the project folder's owner. Lastly, check for any Database schema changes. Restart Directus for the changes to show.

If you haven't already, make sure to make a backup of your project before updating.

How to Backup Directus
Updating Directus can sometimes break your project, especially if you have custom extensions. Use this article to backup your project and keep your data safe.

Step 1: Navigate to your Project Folder

Your Project folder is the folder that Directus is installed. Inside you should see an extensions folder, node_modules folder, uploads folder and a few files.

๐Ÿ’ก
Windows Only: Open the NodeJS console

Change the current directory to your project folder.

LINUX
cd /path/to/your/directus/project

WINDOWS
dir C:\path\to\your\directus\project

Step 2: Update Directus

Use NPM, you need to run the update command. The project will recognize the command and retrieve the latest version from the internet.

๐Ÿ’ก
Linux Only: Check the folder owner using ls -l

Run the following command:

LINUX
sudo -u www npm update

WINDOWS
npm update

Ignore any deprecation warnings. Directus are responsible for addressing these warnings. For those who don't know, deprecation is when a version of the software is no longer maintained by the creator. If any security issue or bugs are found, it won't be patched. This usually happens when a new version is released and it's not feasible to maintain multiple versions.

Step 3: Database Migrations

Sometimes a new update will require changes to the database structure. Every update contributes towards the migration library. Whenever you move from one version to another, the required database changes need to be executed using the following command.

npx directus database migrate:latest

Step 4: Restart Directus

The final step is to restart Directus. This process will differ depend on how you installed Directus on the server. For example:

LINUX SERVICE
sudo systemctl restart directus

Or in Windows, open the services window and find your Directus service. Right click, then click restart.

Or, open your process manager and restart Directus.

Step 5: Schedule Time to Check for Updates

It's worth adding a reminder to your calendar at least once a month to check the Directus Github repo for any changes. Each new release will outline what has changed.

Releases ยท directus/directus
Open-Source Data Platform ๐Ÿฐ โ€” Directus wraps any SQL database with a real-time GraphQL+REST API and an intuitive app for non-technical users. - directus/directus

Conclusion

You can now upgrade Directus and keep your system secure. Be sure to check the github repo at least once a month for any changes.

By continuing to use our website, you consent to use essential cookies. We also use optional tracking cookies which help us gather statistics to improve our services. Do you consent to these cookies?

I Consent Do not track