Skip to content

Commit 44e4624

Browse files
authored
Object Storage documentation (#100)
1 parent f987bf1 commit 44e4624

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

docs/advanced-setups.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,94 @@ You can use their Marketplace to [install Lychee](https://www.alwaysdata.com/en/
200200

201201
See their pricing [here](https://www.alwaysdata.com/en/).
202202

203+
## Implementing Object Storage
204+
205+
An S3-compatible object storage solution is designed to store, manage, and access unstructured data in the cloud.
206+
207+
Under Object Storage, files (also called objects) are stored in flat data structures (referred to as buckets) alongside their own rich metadata.
208+
209+
Due to the nature of Object Storage, it does not require the use of a Compute Instance. Instead, Object Storage gives each object a unique URL with which you can access the data.
210+
211+
### Limitations
212+
- Upload file size limit: 5 GB
213+
- All recursive tasks including (search, find, ls, etc.) have poor performance due to network latency
214+
215+
### S3 Object Storage Setup
216+
217+
The instructions in this guide are based on CentOS/Fedora/RHEL family, but it is easy to replicate the commands into any other distro.
218+
219+
220+
**Install s3fs FUSE-base file system**
221+
222+
s3fs allows Linux and other OS's to mount an S3 bucket via FUSE (Filesystem in Userspace).
223+
224+
s3fs makes you operate files and directories in S3 bucket like a local file system.
225+
226+
[s3fs-fuse - Instructions from developer](https://github.com/s3fs-fuse/s3fs-fuse)
227+
228+
```
229+
sudo dnf install s3fs-fuse
230+
sudo echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > /etc/passwd-s3fs
231+
sudo chmod 600 /etc/passwd-s3fs
232+
```
233+
234+
**Configure SELinux to allow access to the new filesystem**
235+
236+
```
237+
setsebool -P httpd_use_fusefs 1
238+
```
239+
240+
**Setup a permanent mounting point**
241+
242+
Create S3 Object mount point:
243+
244+
```
245+
sudo mkdir /mnt/bucket
246+
```
247+
248+
Edit fstab to create a new mount on boot:
249+
250+
```
251+
Add the following line to: /etc/fstab
252+
253+
<bucket> /mnt/bucket fuse.s3fs _netdev, allow_other, enable_noobj_cache, url=<s3_endpoint>, use_cache="", passwd_file=/etc/passwd-s3fs, mp_umask=0002 0 0
254+
```
255+
256+
Example:
257+
<bucket> mybucket (name used in your cloud provider)
258+
<s3_endpoint> https://eu-central-1.linodeobjects.com
259+
260+
Parameters are explained below:
261+
allow_other Allow other users to access the bucket
262+
mp_umask Mask permissions for mount point
263+
enable_noobj_cache Performance improvement - Enable when bucket is exclusively used by s3fs
264+
use_cache="" Disabled
265+
use_cache=/var/cache/s3fs Enabled (to be used with care, because the cache can grow out of control. Also, I haven't noticed much difference using it)
266+
267+
268+
Reboot your server to confirm S3 Object Storage is mounted correctly.
269+
270+
Create Lychee's mount point:
271+
272+
```
273+
sudo mkdir /mnt/bucket/uploads
274+
```
275+
276+
### Create and run Lychee container
277+
From now on, Lychee will see the Object Storage mount transparently like any other mount. The container's volume `/uploads` needs to point to the new created mount:
278+
279+
```
280+
sudo podman run --rm -d --name myphotos -v /mnt/bucket/uploads:/uploads -e PUID=33 -e PGID=1000 ... docker.io/lycheeorg/lychee
281+
```
282+
283+
### Configure .ENV
284+
To avoid latency when clicking Diagnostics, my suggestion is to disable BasicPermissionCheck. Otherwise, depending on the number of photos in your gallery, this task can take hours.
285+
286+
```/var/lib/containers/storage/volumes/lychee-conf/_data/.env
287+
SKIP_DIAGNOSTICS_CHECKS=BasicPermissionCheck
288+
```
289+
290+
### Limitations to be considered
291+
As explained before, recursive tasks are penalised in Object Storage, so if you have an existing bucket and the container runs for the first time, it will take long time to review and set the permissions in your mount. Depending on the number of photos, it can take several hours.
292+
203293
</div>

0 commit comments

Comments
 (0)