
Halo, kalau kamu merasa tulisan saya ngebantu kamu, kamu bisa ucapkan terima kasih lewat saweria
If you feel this website help you, you can donate at saweria
- Before You Follow This Tutorial
-
You already installed docker on your server.
-
You already installed & configured s3cmd .
-
In this case, I using DO Spaces and I already create Spaces access keys .
-
I will only setup S3 as storage backend in this tutorial, you can tried to setup another storage backend (samba, sftp, Dropbox, etc ) by yourself.
-
Filestash has well-documented documentation , please read it if you got some problem before/after install it.
Setup Filestash
- Create docker-compose.yml file, fill with
version: '3.7'
services:
filestash:
container_name: filestash-ctr
image: machines/filestash
restart: always
# use this if you already setup domain, reverse proxy, ssl for this app
# environment:
# - APPLICATION_URL=https://ourapp.com
ports:
- "8334:8334"
#persisent volume
#https://github.com/mickael-kerjean/filestash/issues/113
volumes:
- filestash-vol:/app/data/
networks:
- filestash-net
volumes:
filestash-vol:
networks:
filestash-net:
-
Run that using
docker-compose up -d
-
Open admin url in browser, yourIP:8334
First, It Will Ask You To Setup Admin Password
It was better if you setup reverse proxy & ssl on this app, so your input will be encrypted
Please Setup SSL, It Was Easy Though
-
Now we will be redirected to storage backend
Just Fill Some Form
The Form That I Fill, Will Not Appear In Here
So, if you fill everything on storage backend page, the user will just have to click connect at they will connected to our DigitalOcean Spaces/S3 Bucket & it was unsafe of course
-
Try to login with our DigitalOcean Spaces (you can logoff from admin console or open new filestash app in private browser)
Login Using Spaces Keys
-
Now you can use file manager to upload, delete, rename or share your Spaces file
Login Using Spaces Keys
- Some Problem You Might Have
-
Cannot login into file manager with error “Not Allowed”
When Check Logs
How to solve that
Just Domain
-
You want user just click “connect” button at login to make login easier.
Yes, you can do that. To secure your login page, you can setup basic_auth at nginx, harden it with fail2ban to make it more secure
-
All file uploaded to filestash become private, I want make it public
There is no menu to make our file public or private in filestash, but file that uploaded will become private.
To make our uploaded file automatically become public, we can use s3cmd
a. First, create some S3 rule, name it makeitpublic
{ "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "*", "Action": [ "s3:GetObject" ], "Resource": [ "arn:aws:s3:::YourBucket/*" ] } ] }
b. Then apply it using
s3cmd setpolicy makeitpublic s3://YourBucket
c. Try to upload again
-
I want filestash to show Digital Spaces link not filestash app link.
No you can’t do it. But, if you use nginx as reverse proxy, you can rewrite specific extension and redirect that from filestash url to DO CDN url
#write extension you want to redirect to DO CDN location ~* \.(mp4|apk|mp3|jpg|png) { rewrite ^(.*) https://yourspaces.cdn.digitaloceanspaces.com/$1 last; }
It’s still read with filestash domain, but it will redirected to DO spaces url.
-
Restrict user to specific bucket/spaces.
You can’t restrict user to specific S3 bucket/DO spaces when using filestash.
But you can use sftpgo for this purpose, and it was awesome!
References:
AWS - S3 Setting permissions for website access
Serverfault - nginx rewrite how to redirect extension