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.
Please Support My work by Making a Donation.
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.
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.
Go to Control Panel / Login Portal / Advanced Tab / click Reverse Proxy. Follow the instructions in the image below.
Now click the “Create” button. Follow the instructions in the image below.
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:
Check Enable HSTS
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.
Go to Control Panel / Network / Connectivity tab/ Check Enable HTTP/2 then click Apply. Follow the instructions in the image below.
Go to Control Panel / Security / Advanced tab/ Check Enable HTTP Compression then click Apply. Follow the instructions in the image below.
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.
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.
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.
In the Name field type in strapi. Follow the instructions in the image below.
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 #.
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.
If everything goes right, you will see this message at the top right of your screen: “Success Stack successfully deployed“.
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.
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.
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.
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
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.
Go back to STEP 1 or you will deal with karma 🙂.
On the left sidebar in Portainer, click Containers. Identify your Strapi instance, select it then click Restart. Follow the instructions in the image below.
Go back to STEP 1 or you will deal with karma 🙂.
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.
Your Strapi Dashboard at a glance!
On the Left sidebar, if you click Settings then Users, you can see that you are the Super Admin.
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