Streamlit to work on my Synology NAS

Thank you for letting me use your sharering service. :pray:
However, I was unable to create a fourth app, so I had to find another way.

I was able to get streamlit to work on my Synology NAS. :wink:

  • Own domain
  • SSL (Letā€™s Encrypt, automatically renewed for 3 months)
  • Unlimited apps added (within NAS memory)
  • Super energy saving ( 24H , 30w )

The current NAS memory is 16 gigs, so itā€™s running very comfortably.

For reference streamlit hello app will run until the end of May.
https://st.mac365.com/

Translated with www.DeepL.com/Translator (free version)

My NAS (model: Synology DiskStation DS918+ )
image

1 Like

@matzoka great stuff and very resourceful of you. I have a Synology too and would love to see your instructions on getting this running, please? I could help you put together a deployment guide and test the reproducibility.

Hi @asehmi.
I can help you if you like.

So, where should we start?

ps: Today, I used the same method to connect my Synology NAS to my Google Cloud , Compute Engine instance and it worked perfectly.

GCE Demo Site:
https://google.mac365.com/

I havenā€™t tried it yet, but Iā€™m sure Amazon EC2 can be done easily as well.

1 Like

Could you list the steps you followed to create and deploy the Streamlit site to your Synology NAS and expose it on a public domain?

I was able to connect to your st demo app, but not to the GCE demo.

I understand. It will take some time.

I created the following document because I wanted to refer to the settings later myself.

It may be difficult to understand.

Note that there are some SynologyNAS models that cannot install streamlit.

Please follow the instructions from 1 to 3 in the document to determine if your model does not support streamlit before proceeding to 4 and 5.

The problematic part was the symptom that numpy could not be installed correctly.

https://integralsoft.jp/streamlit/synology_settings.html

I readjusted the GCE based on other usersā€™ settings.
Maybe it will work correctly.
https://google.mac365.com/

Hey @matzoka, I donā€™t have a Synology but just chiming in to say I love your mindmap tutorial, I brainstorm and organize in mindmap but never thought of chronologically describing steps like you did. What software did you use? (Iā€™m not sure I can put this much details in freemindā€¦)

Have a nice day,
Fanilo

Hi @andfanilo.

Here is the software.

help documents:
https://onlinehelp.mindjet.com/help/MindManager/19/JA/mindmanager_help.htm

Have a nice day.
Matsuoka

1 Like

This worked! Nice deployments.

Fantastic. If you donā€™t mind can you post your .mmap file too so I can load it into my MindManager app?

Many thanks!

It has been uploaded here.
Please use it.
They are both the same, but if there is a problem, we will find another way.

https://integralsoft.jp/streamlit/synology_settings.mmap

https://integralsoft.jp/streamlit/synology_settings.zip

1 Like

Thank you!! And it opens fine in my 12 years old version of MMā€¦ you gotta love products with this kind of backwards compatibility.

2 Likes

Hi @asehmi

Iā€™m glad you were able to use the files.

I was able to synchronize the github repository with SynologyNAS today.

github Webhook
ā†“
SynologyNAS (Python http server)
ā†“
Execute git pull (shell)
ā†“
Sync streamlit app

Now I can finally move out of the share that I borrowed from streamlit.

1 Like

Very nice! Though I imagine for most people paying a few $$$ for a Streamlit share (when it is out of beta) or for Heroku, etc. will be much more convenient than setting up their own ā€œprivate cloudā€.

1 Like

Youā€™re right.
Itā€™s only for people who already have nas like synology.

Hi @matzoka,

Thank you for the map,

I encounter problems in installing streamlit on a synology DS220j,

calling pip install failed for backports.zoneinfo and argon2-cffi

For both of them I have the following error:

error: command '/usr/local/aarch64-unknown-linux-gnu/bin/aarch64-unknown-linux-gnu-wrap-gcc' failed with exit status 1

I will enjoy any idea you can share with me in order to fix this

Many thanks for your time

Hi @LeonDpl, thanks for reaching out.

I recently upgraded my Synology NAS from 6.0 to 7.0 and my pre-configured Python environment is no longer available.

I have now changed my policy and am using Synologyā€™s Virtual Machine Manager to run Ubuntu Server 20.04 to build my Python environment.

Therefore, Iā€™m not running Streamlit alone inside Synology NAS, but Iā€™m using the features of Synology NAS for other things like SSL, port forwarding, etc.

Iā€™m sorry I canā€™t help you.
I will try to set up an environment to use Python directly on Synology NAS when I get a chance.

Translated with www.DeepL.com/Translator (free version)

Quite an old thread, but I would like to leave my solution to make Streamlit working on a Docker container on a Synology NAS.

Things to do:

  • Register a DynDNS on your domain register
  • Enable the DynDNS at Synology > Control Panel > External Access > DDNS > ā€¦
  • Create a domain certificate, for example, at Letā€™s Encrypt, going to: Synology > Control Panel > Security > Certificate > Addā€¦
  • Set the certificate for your DynDNS domain, at: Synology > Control Panel > Security > Certificate > Settings ā€¦
  • Enable firewall for the Docker container, at Synology > Control Panel > Security > Firewall > Edit Rules > Create > ā€¦
  • Setup the reverse proxy, at: Synology > Control Panel > Login Portal > Advanced > Reverse Proxy > ā€¦
  • You can enable HSTS if you want at the Reverse Proxy
  • Enable the websocket at: Synology > Control Panel > Login Portal > Advanced > Reverse Proxy > Custom Header > Create > WebSocket > ā€¦
  • Setup the Docker container at the ā€œContainer Managerā€ app inside Synology. You can use the docker-compose.yml, and create a ā€œProjectā€.

As example, these are my files:

Dockerfile

# app/Dockerfile

FROM python:3.12-slim

WORKDIR /app

RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    software-properties-common \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install -r requirements.txt

VOLUME ["/app"]

EXPOSE 8501

HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

ENTRYPOINT ["streamlit", "run", "main.py", "--server.port=8501", "--server. Address=0.0.0.0"]

docker-compose.yml

version: '3.8'

services:
  streamlit_app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: app
    hostname: app
    ports:
      - 8501:8501
    volumes:
      - type: bind
        source: /volume1/docker/app
        target: /app
    environment:
      - TZ=Europe/London

networks:
  default:
    ipam: 
      driver: default
      config:
        - subnet: "172.1.0.0/16"
          gateway: "172.1.0.1"

Some screenshots of the process:

More information at:

2 Likes