<sub>(2024/10/03)</sub>
#docker #minIO #obsidian #obsidian_plugins #synology
## Intro
Excitingly, [since version 0.23.0](https://github.com/vrtmrz/obsidian-livesync/blob/main/updates_old.md), you can now integrate the Self-hosted Live Sync Obsidian extension with S3 object storage. Moving away from CouchDB to S3 is my preference so I decided to self-hosting a minIO container on my Synology. Unfortunately, most of the guides online that tell you how to implement minIO for your Synology are outdated which resulted in me having data rentention issues with my minIO container.
The issue I had with my minIO container was that the container itself ran just fine but no data was being stored on my Synology. If my minIO container was restarted, all the data I thought that was being stored in my minIO S3 buckets was lost and the Synology folder I was using was empty as well.
Upon further investigation, the following error message kept appearing in my container's logs which told me that I had storage issues:
```
INFO: Formatting 1st pool, 1 set(s), 1 drives per set.
2
INFO: WARNING: Host local has more than 0 drives of set. A host failure will result in data becoming unavailable.
3
MinIO Object Storage Server
```
Luckily for me, [the official documentation](https://min.io/docs/minio/container/operations/install-deploy-manage/deploy-minio-single-node-single-drive.html) helped guide me to success as the solution for my data retention issues was that I had to modify the deployment of my minIO container which I have shared below.
## How To
My environment consists of my Synology utilizing Portainer to manage my containers.
### Deploy Portainer
I highly recommend using Portainer to manage and deploy your containers on your Synology (instead of Container Manager) but you can skip this step if you are comfortable with the command line (we will be using a docker compose file). [Here is a quick guide on how to install Portainer on your Synology. ](https://www.portainer.io/blog/how-to-install-portainer-on-a-synology-nas)
### Create New Folders (on your Synology)
Secondly, make a new folder on your docker shared folder called `minIO` and then create a subfolder called `data`:
* My path for example is `/volume1/docker/storage/minio` because I like having an additional sub-folder to store all of my container data instead of putting it in the root of `docker`
![[minio-2.png]]
### Create New .env File
Third, create an empty `.env` file, paste and modify the following template values below (change the default user/password, everything else you can leave) and then save it to the newly created `minio` folder.
For more environmental variables please check [the following link.]([environment variables](https://min.io/docs/minio/linux/reference/minio-server/settings.html#minio-server-environment-variables "(in MinIO Documentation for Linux)")
```
# MINIO_ROOT_USER and MINIO_ROOT_PASSWORD sets the root account for the MinIO server.
# This user has unrestricted permissions to perform S3 and administrative API operations on any resource in the deployment.
# Omit to use the default values 'minioadmin:minioadmin'.
# MinIO recommends setting non-default values as a best practice, regardless of environment
MINIO_ROOT_USER=myminioadmin
MINIO_ROOT_PASSWORD=minio-secret-key-change-me
# MINIO_VOLUMES sets the storage volume or path to use for the MinIO server.
MINIO_VOLUMES="/mnt/data"
# MINIO_OPTS sets any additional commandline options to pass to the MinIO server.
# For example, `--console-address :9090` sets the MinIO Console listen port
MINIO_OPTS="--console-address :9090"
```
### Deploy minIO
Finally, here is my docker compose file we will use in Portainer. Create a new stack and label it minio, and then paste the following code into the text editor (change the volumes values below based on your own `data` folder and `config.env` file paths that were created in the previous steps):
* I changed the default web console port from `9000` to `9001` as port `9000` was already in use on my system
* I also changed the console from from `9001` to `9090`
* Make sure to update the various `volumes` paths with your own paths
```
services:
minio:
image: quay.io/minio/minio:latest
command: server --console-address ":9090"
environment:
- "MINIO_CONFIG_ENV_FILE=/etc/config.env"
ports:
- 9001:9000
- 9090:9090
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
volumes:
- /volume1/docker/[YOUR MINIO FOLDER]/data:/mnt/data
- /volume1/docker/[YOUR MINIO FOLDER]/.env:/etc/config.env
```
Deploy the following compose file as a stack to Portainer and then you will have a login page if successful!
* The default login page for your minIO container would be `http://[SYNOLOGYIP]:9001
![[minio-4.png]]
![[minio-3.png]]
Also another check to confirm if your installation is successful, is if the the `data` folder you created in step 2 contains data after creating a S3 bucket and populating it with content:
![[minio-5.png]]