[5 Minutes Docker Series] Deploy A Free File List App for Multiple Cloud Storages – Alist – 51 Security


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

Support Multiple Storages

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

Monitoring Usage

  • Remove Docker and Related folders
  • docker stop <Docker Name> # stop the docker but not remove anything. 
  • docker rm -f <Docker Name>  # remove speficic container, but will not delete mapped volumes
  • rm -rf /root/data/docker_data/<Docker Mapped Volumns>  # remove all mapped volumes

Restrick Log File Size:

  • journalctl –vacuum-size=100M
  • Limit it to 25M:

nano /etc/systemd/journald.conf
SystemMaxUse=25M
systemctl restart systemd-journald.service

Enable IPv6 and Limit Log File Size (Ubuntu)

Add customized self defined IPv6 address segment to enable container’s IPv6 fucntion. And limit log file’s size and numbers in case log file to fill all hard drive’s space. 

cat > /etc/docker/daemon.json << EOF
{
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "20m",
        "max-file": "3"
    },
    "ipv6": true,
    "fixed-cidr-v6": "fd00:dead:beef:c0::/80",
    "eixperimental":true,
    "ip6tables":true
}
EOF


Restart Docker service:

systemctl restart docker

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

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

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 

Fly.io Deploy Alist

Install FlyCTL#

macOS:  curl -L https://fly.io/install.sh | sh

Linux : curl -L https://fly.io/install.sh | sh

Windows : powershell -Command “iwr https://fly.io/install.ps1 -useb | iex”

Register and Login#

fly.io requires credit card binding

# Sign up
flyctl auth signup

# Login
flyctl auth login

After logging in, you can start deploying the application.

Create an Application#

git clone https://github.com/moeyy01/alist-fly
cd alist-fly
flyctl launch

The app name alist-fly might have been taken. You will be prompted to change name in the web ui. I changed to 51alist:

Before deploying, create a 1GB permanent storage:

# Create a 1G persistent storage space (minimum unit 1)
flyctl volumes create data --size 1 --app APP_NAME

Replace APP_NAME with the name of the app you just created.
After creating, add the following at the bottom of the fly.toml configuration file:

[mounts]
destination = "/opt/alist/data"
source = "data"

After adding, check if the internal_port in the configuration file is 5244. Once checked, you can deploy by entering flyctl deploy.

Wait for the deployment to complete. After the deployment is complete, you can go to the official website control panel to view it, or enter flyctl open to open the website.

Note: 

PS C:\Users\john> mkdir alist-fly

    Directory: C:\Users\john

Mode                 LastWriteTime         Length Name
—-                 ————-         —— —-
d—–         6/22/2024   6:12 PM                alist-fly

PS C:\Users\john> cd .\alist-fly\
PS C:\Users\john\alist-fly> notepad fly.toml

PS C:\Users\john\alist-fly> flyctl launch
? Would you like to copy its configuration to the new app? No
Scanning source codecopy its configuration to the new app? (y/N) n
Could not find a Dockerfile, nor detect a runtime or framework from source code. Continuing with a blank app.
Creating app in C:\Users\john\alist-fly
We’re about to launch your app on Fly.io. Here’s what you’re getting:
Organization: Johnny Netsec          (fly launch defaults to the personal org)
Name:         <unspecified>          (must be specified in UI)
Region:       Toronto, Canada        (this is the fastest region for you)
App Machines: shared-cpu-1x, 1GB RAM (most apps need about 1GB of RAM)
Postgres:     <none>                 (not requested)
Redis:        <none>                 (not requested)
Tigris:       <none>                 (not requested)

The following problems must be fixed in the Launch UI:
 * app name alist-fly is already taken
   each Fly.io app must have a unique name
? Would you like to continue in the web UI? Yes
Opening https://fly.io/cli/launch/6d7173716e7a72657664717532666865347378736a6d6a697879356d7977367a …
Waiting for launch data… Done
Created app ’51alist’ in organization ‘personal’
Admin URL: https://fly.io/apps/51alist
Hostname: 51alist.fly.dev
Wrote config file fly.toml
PS C:\Users\john\alist-fly> flyctl volumes create data –size 1 –app 51alist
Warning! Every volume is pinned to a specific physical host. You should create two or more volumes per application to av? Do you still want to use the volumes feature? Yes
Some regions require a Launch plan or higher (bom, fra).
See https://fly.io/plans to set up a plan.
? Select region: Toronto, Canada (yyz)
                  ID: vol_re2z83975nq2k71r
                Name: data
                 App: 51alist
              Region: yyz
                Zone: cc37
             Size GB: 1
           Encrypted: true
          Created at: 22 Jun 24 22:19 UTC
  Snapshot retention: 5
 Scheduled snapshots: true

PS C:\Users\john\alist-fly> flyctl deploy
==> Verifying app config
Validating C:\Users\john\alist-fly\fly.toml
✓ Configuration is valid
–> Verified app config
==> Building image
Searching for image ‘xhofe/alist:latest’ remotely…
image found: img_rlw04nnnr63z4z2y
Watch your deployment at https://fly.io/apps/51alist/monitoring
Provisioning ips for 51alist
  Dedicated ipv6: 2a09:8280:1::3a:2c02:0
  Shared ipv4: 66.241.124.4
  Add a dedicated ipv4 with: fly ips allocate-v4
This deployment will:
 * create 1 “app” machine
No machines in group app, launching a new machine
Finished launching new machines
——-
 ✔ Machine 2874de9f049148 [app] update finished: success
——-
Checking DNS configuration for 51alist.fly.dev
Visit your newly deployed app at https://51alist.fly.dev/
PS C:\Users\john\alist-fly>

Notepad fly.toml

# fly.toml app configuration file generated for moeyy-alist on 2023-05-11T21:53:14+08:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = “51alist”
kill_signal = “SIGINT”
kill_timeout = 5
primary_region = “yyz”
processes = []
[build]
 image = “xhofe/alist:latest”
[env]
[experimental]
  auto_rollback = true
[[services]]
  http_checks = []
  internal_port = 5244
  min_machines_running = 0
  processes = [“app”]
  protocol = “tcp”
  script_checks = []
  # [services.concurrency]
  #   hard_limit = 25
  #   soft_limit = 20
  #   type = “connections”
  [[services.ports]]
    force_https = true
    handlers = [“http”]
    port = 80
  [[services.ports]]
    handlers = [“tls”, “http”]
    port = 443
  [[services.tcp_checks]]
    grace_period = “1s”
    interval = “15s”
    restart_limit = 0
    timeout = “2s”
  [mounts]
    destination = “/opt/alist/data”
    source = “data”

Check Password:

PaaS To Deploy Alist

The initial password refer to logs.

Koyeb

Render

Railway(Dont try this, it will be banned)

Easy to use but easy to violate ToS too.

Heroku(Not free)

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:

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:

Issues

So far, following issu has been found and looking for a solution:


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *