How to Install Strapi on Your Synology NAS

How to Install Strapi on Your Synology NAS

Strapi is an open-source, Node. js based, Headless CMS that saves developers a lot of development time while giving them the freedom to use their favorite tools and frameworks. Strapi also enables content editors to streamline content delivery (text, images, video, etc) across any devices. In this step by step guide I will show you how to install Strapi on your Synology NAS using Docker & Portainer.

💡Note: This guide works perfectly with the latest Strapi v4.8.2 release.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.

  • STEP 3

Make sure you have a synology.me Wildcard Certificate. Follow my guide to get a Wildcard Certificate. If you already have a synology.me Wildcard certificate, skip this STEP.

  • STEP 4

Go to Control Panel / Login Portal / Advanced Tab / click Reverse Proxy. Follow the instructions in the image below.

Strapi Synology NAS Set up 1

  • STEP 5

Now click the “Create” button. Follow the instructions in the image below.

Strapi Synology NAS Set up 2

  • STEP 6

After you click the Create button, the window below will open. Follow the instructions in the image below.

On the General area, set the Reverse Proxy Name description: type in Strapi. After that, add the following instructions:

Source:
Protocol: HTTPS
Hostname: strapi.yourname.synology.me
Port: 443

Check Enable HSTS

Destination:
Protocol: HTTP
Hostname: localhost
Port: 1337

Strapi Synology NAS Set up 3

  • STEP 7

On the Reverse Proxy Rules click the Custom Header tab. Click Create and then, from the drop-down menu, click WebSocket. After you click on WebSocket, two Header Names and two Values will be automatically added. Click Save. Follow the instructions in the image below.

Synology Proxy WebSocket

  • STEP 8

Go to Control Panel / Network / Connectivity tab/ Check Enable HTTP/2 then click Apply. Follow the instructions in the image below.

Strapi Synology NAS Set up 4

  • STEP 9

Go to Control Panel / Security / Advanced tab/ Check Enable HTTP Compression then click Apply. Follow the instructions in the image below.

Strapi Synology NAS Set up 5

  • STEP 10

Go to File Station and open the docker folder. Inside the docker folder, create one new folder and name it strapi. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Strapi Synology NAS Set up 6

  • STEP 11

Now create two new folders inside the strapi folder that you created at STEP 10 and name them data and db. Follow the instructions in the image below.
Note: Be careful enter only lowercase, not uppercase letters.

Strapi Synology NAS Set up 7

  • STEP 12

Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.

1 Synology Portainer Add Stack

  • STEP 13

In the Name field type in strapi. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

version: "3.9"
services:
  db:
    image: mariadb:jammy
    deploy:
      resources:
        limits:
          memory: 512M
    restart: always
    container_name: Strapi-DB
    hostname: strapi-db
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD-SHELL", "mysqladmin ping -P 3306 -prootpass | grep 'mysqld is alive' || exit 1"]
    environment:
      - TZ=Europe/Bucharest
      - MYSQL_ROOT_PASSWORD=rootpass
      - MYSQL_DATABASE=strapi
      - MYSQL_USER=strapiuser
      - MYSQL_PASSWORD=strapipass
    volumes:
      - /volume1/docker/strapi/db:/var/lib/mysql:rw

  strapi:
    image: naskio/strapi:latest
    deploy:
      resources:
        limits:
          memory: 1G
    restart: always
    container_name: Strapi
    hostname: strapi
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:1337/ || exit 1
    environment:
      DATABASE_CLIENT: mysql
      DATABASE_HOST: db
      DATABASE_PORT: 3306
      DATABASE_NAME: strapi
      DATABASE_USERNAME: strapiuser
      DATABASE_PASSWORD: strapipass
      DATABASE_SSL: false
      NODE_ENV: production
      JWT_SECRET: MariushostingMariushostingMari13
      #STRAPI_LICENSE: LicenseKey
    volumes:
      - /volume1/docker/strapi/data:/srv/app
    ports:
      - 1337:1337
    depends_on:
      db:
        condition: service_started

Note: Before you paste the code above in the Web editor area below, change the value for TZ. (Select your current Time Zone from this list.)
Note: Before you paste the code above in the Web editor area below, change the value for JWT_SECRET and add your own JWT_SECRET. MariushostingMariushostingMari13 is an example for a JWT_SECRET. You should invent your own Value. Add 32 random characters, both letters and numbers.
Note: If you want, you can also add your own Strapi License Key by removing the # in the code above. If you don’t have a Strapi License Key, then leave the code as it is with the #.

Strapi Synology NAS Set up 8 new2 2023

  • STEP 14

Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

Strapi Synology NAS Set up 9 new2 2023

  • STEP 15

If everything goes right, you will see this message at the top right of your screen: “Success Stack successfully deployed“.

Strapi Synology NAS Set up 10

  • STEP 16

Your Strapi instance will be orange with the Unhealthy State. The State will turn Healthy in approximately 5-10 minutes which is how long the Strapi installations takes. Refresh the browser page from time to time until you see the State turn green.

  • STEP 17

Once Strapi turns Healthy, you can proceed with this STEP. On the left sidebar in Portainer, click Containers. Identify your Strapi instance, then click on the little terminal icon. Follow the instructions in the image below.

Strapi Synology NAS Set up 11

  • STEP 18

After you click on the little terminal icon at STEP 17, a new page will open. Click Connect. Follow the instructions in the image below.

Strapi Synology NAS Set up 12

  • STEP 19

After you click Connect at STEP 18, a Console will open. Copy paste the code below and confirm by pressing Enter on your keyboard to start the installation process. Follow the instructions in the image below.

npm run build

Strapi Synology NAS Set up 13

  • STEP 20

Wait until the installation wizard is finished. After the installation is finished, you will see a message that says: “Admin UI built successfully“. Follow the instructions in the image below.

Strapi Synology NAS Set up 14

  • STEP 21

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 22

On the left sidebar in Portainer, click Containers. Identify your Strapi instance, select it then click Restart. Follow the instructions in the image below.

Strapi Synology NAS Set up 15

  • STEP 23

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 24

Now open your browser and type in your HTTPS/SSL certificate like this https://strapi.yourname.synology.me/admin that you have previously created at STEP 6. In my case it’s https://strapi.mariushosting.synology.me/admin If everything goes right, you will see the Strapi administrator creation page. Type in your First name and Last name, your Email address and your own Password. Confirm your Password then click Let’s start. Follow the instructions in the image below. Note: If you forget to add /admin after your synology.me DDNS you will not be able to create the administrator user.

Strapi Synology NAS Set up 16

  • STEP 25

Your Strapi Dashboard at a glance!

Strapi Synology NAS Set up 17

On the Left sidebar, if you click Settings then Users, you can see that you are the Super Admin.

Strapi Synology NAS Set up 18

Enjoy Strapi!

Note: Can I run Docker on my Synology NAS? See the supported models.
Note: Find out how to update the Strapi container with the latest image.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.
Note: Find out the Best NAS Models For Docker.
Note: Activate Gmail SMTP For Docker Containers.

This post was updated on Monday / March 20th, 2023 at 11:14 PM