[5 Mins Docker] A Free File List App for Multiple Cloud Storages - Alist (Replit) - NETSEC

Latest

Learning, Sharing, Creating

Cybersecurity Memo

Sunday, December 25, 2022

[5 Mins Docker] A Free File List App for Multiple Cloud Storages - Alist (Replit)

AList is a file list program that supports multiple storage, powered by Gin (back end) and Solidjs (front end). It is similar as some other programs I used before in this blog. You can find related posts regarding them, such as OnePoint, GoIndex, OneManager, FODI (Fast OneDrive Index), etc :

Unfortunately, most of those programs are not actively maintained although they are still working fine as long as you configured them correctly. AList is still actively developing at their Github site. I am really hoping the author found a good way to continue this Open Source project for a longer time. 


So far, based on my experience and testing for all of those Cloud Drive File Listing program, AList is best, OnePoint is second. Others are still having some critical function / feature missing. 

Some typical usages for AList:
  • Central Management For All Your Cloud Storages (Support multiple popular storage sites)
  • Centrlized Media Sharing Site (Media preview feature)
  • Replace Your NAS using RaiDrive to Mount it as local drive (WebDav feature)
  • Provide direct links for your images or videos. (Listing files and folders)

Related Sites for this AList project:
Related Posts:

Introduction

This file list program, Alist,  supports multiple storage, and supports web browsing and webdav, powered by gin and Solidjs
Features:
  •  Easy to deploy and out-of-the-box
  •  File preview (PDF, markdown, code, plain text, ...)
  •  Image preview in gallery mode
  •  Video and audio preview, support lyrics and subtitles (More formats supported, such as MKV, MP4, etc)
  •  Office documents preview (docx, pptx, xlsx, ...)
  •  README.md preview rendering
  •  File permalink copy and direct file download
  •  Dark mode
  •  I18n
  •  Protected routes (password protection and authentication)
  •  WebDav (see https://alist.nn.ci/guide/webdav.html for details)
  •  Docker Deploy
  •  Cloudflare workers proxy
  •  File/Folder package download
  •  Web upload(Can allow visitors to upload), delete, mkdir, rename, move and copy
  •  Offline download
  •  Copy files between two storage
There might be more cloud storage supported already, please visit Github page to get latest list.




Self Hosted Docker Installation Pre-requirements

Free resources you might need to complete this docker project:


Pre-installed services:

  • Docker, 
    • apt update
    • apt install docker.io
    • apt install docker-compose
    • apt upgrade docker.io
    • mkdir /root/data/docker_data/<docker_name>
  • Docker-Compose (Using Ubuntu OS for the commands)
    • Docker-compose down
    • Optional command : use following command to backup your Docker data. You might need to change your folder name based on your docker configuraiton
      • cp -r /root/data/docker_data/<docker_name> /root/data/docker_data_backup/<docker_name>
    • docker-compose pull
    • docker-compose up -d
    • docker image prune
  • Portainer (Optional)
    • docker volume create portainer_data
    • docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
  • Install some applications: apt install wget curl sudo vim git (Optional)
  • aapanel with Nginx (Optional)
  • Nginx Proxy Manager (Optional)
  • Install screen (Optional)
    • Install screen (Depends on the Linux Distribution if it came pre installed or not) : yum install screen
    • Initiate a Screen : screen or  screen -S <screen name> <command to execute>
    • Detach from the screen : "CTRL+A,D" not "CTRL+A+D"
    • List all the screen currently working : screen -ls
    • Reattach to a screen : screen  -r  <session number> or screen -r <screen name>
    • Kill specific screen: screen -X -S <screen name> quit
    • Kill all screens : pkill screen



Docker Run to Deploy

Usage

stable version

docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 --name="alist" xhofe/alist:latest

beta version (not recommended)

docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 --name="alist" xhofe/alist:main


Initial password refer to logs.

Use the following command after running the above command:

docker logs alist
# or
docker exec -it alist ./alist password

Noets: 
Docker Hub site:
  • https://hub.docker.com/r/xhofe/alist

Docker Run AList from https://labs.play-with-docker.com/





Login to Alist with the admin username and the found password from logs:




AList Manage backend:

You can change your AList App's logo, favicon, home icon and home container style:


Supported Preview File Type:
  • Audio types: mp3,flac,ogg,m4a,wav,opus
  • Video types: mp4,mkv,avi,mov,rmvb,webm,flv
  • Image types: jpg,tiff,jpeg,png,gif,bmp,svg,ico,swf,webp
  • Documents: doc,docx,xls,xlsx,ppt,pptx, pdf



Portainer Deployment

All are straighforward settings. For image, you can use stable one:xhofe/alist:latest or  Dev one: xhofe/alist:main




The initial password can directly get it by clicking Container list page's log icon:



Deploy it in Replit.com

Warning: Replit has blacklist alist program and it will not allow to install in replit environment anymore. Here is a workaround to use it. 

Even with this workaround, your saved storage data might still face a lost risk. 

1. login into https://replit.com/ 

2. create a new Repl, using template bash

3. Change the content in main.sh file to following 

Basically, change alist name to something different such as a , in my this example:

./a server

4. From shell console, type following commands:
wget https://gd.51sec.org/0:/Program/a.tar.gz
tar -zxvf a.gz
./a server
5. from the console output, find the password



6. Open the website using the url . Login using the admin and password you found from previous step



7. Use your own domain and https certs

8. Use uptimerobot to moniter it for keeping it not sleeping 


PaaS To Deploy Alist

The initial password refer to logs.
Notes: 
There are some issues for Heroku deployment. Here is one FAQ post mentions some issues:  https://elements.heroku.com/buttons/cqchenqin/alist-heroku

Free Database for PaaS Deployment

You may need to use another remote MySQL database as instance restarts will lose data. Recommended Free MySQL Databases:


Add Storages


Local 


More please check my another post for advanced usage of AList:


Windows Deployment

Downloand Windows Package from Release page:

  • https://github.com/alist-org/alist/releases

Run from command line to start AList:


C:\Users\admin>cd \alist-windows-amd64

C:\alist-windows-amd64>dir
 Volume in drive C has no label.
 Volume Serial Number is BC7D-56BE

 Directory of C:\alist-windows-amd64

12/27/2022  10:59 PM    <DIR>          .
12/27/2022  10:59 PM    <DIR>          ..
11/22/2022  09:01 AM        11,446,272 alist.exe
               1 File(s)     11,446,272 bytes
               2 Dir(s)  155,723,272,192 bytes free

C:\alist-windows-amd64>alist
A file list program that supports multiple storage,
built with love by Xhofe and friends in Go/Solid.js.
Complete documentation is available at https://alist.nn.ci/

Usage:
  alist [command]

Available Commands:
  admin       Show admin user's info
  cancel2fa   Delete 2FA of admin user
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  lang        Generate language json file
  restart     Restart alist server by daemon/pid file
  server      Start the server at the specified address
  start       Silent start alist server with `--force-bin-dir`
  stop        Stop alist server by daemon/pid file
  version     Show current version of AList

Flags:
      --data string     config file (default "data")
      --debug           start with debug mode
      --dev             start with dev mode
      --force-bin-dir   Force to use the directory where the binary file is located as data directory
  -h, --help            help for alist
      --no-prefix       disable env prefix

Use "alist [command] --help" for more information about a command.

C:\alist-windows-amd64>alist server
INFO[2022-12-27 22:59:34] reading config file: data\config.json
INFO[2022-12-27 22:59:34] config file not exists, creating default config file
INFO[2022-12-27 22:59:34] load config from env with prefix: ALIST_
INFO[2022-12-27 22:59:34] init logrus...
INFO[2022-12-27 22:59:34] Successfully created the admin user and the initial password is: i3OvsBbu
INFO[2022-12-27 22:59:39] Aria2 not ready.
INFO[2022-12-27 22:59:39] start server @ 0.0.0.0:5244
You will be prompted to allow firewall to access alist.exe file.

Unfortunately , directlly use your browse to access 0.0.0.0:5244 wont work. 

But using http://127.0.0.1:5244/ works



To make "alist.exe server" command run when system reboots, you can add following startup code into start up folder (shell:startup).
Startup Code:
Set ws = CreateObject("Wscript.Shell")
ws.run "alist.exe server",vbhide

Note: https://www.bilibili.com/video/BV1ut4y1u7SM/


Videos

 Using Docker Run to Deploy:

Using Portainer to Deploy & Deploy into Windows



Online AList Sites

 
Some collected AList sites as demo:
  • https://store.vvhan.com/
  • My Demo: https://alist.51sec.org   Just in case you are interesting on how it looks like after logged in, here is a sharing folder 's read access only account:user: testuser1   pass: TestUser1!
  • list.51sec.org - Deployed into Replit

Issues

So far, following issu has been found and looking for a solution:
  •  PDF preview issue

No comments:

Post a Comment