现在注册fly.io账号需要绑定信用卡并验证(扣款10刀以下随机金额)后方可免费试用三个256MB内存的服务,每个1GB大小,最多3G的持久化存储

分类限额说明
VM: shared-cpu每个月 2340 小时可以全天候运行 3 个 256 MB 内存的共享 CPU 的 VM
Volumes3GB提供 3GB 永久存储
Bandwidth160 GB/每月亚洲、印度30G,美国、欧洲100G的outbound流量
Anycast IPs无限的 IPv6, 每个应用一个 IPv4每一个额外的 IPv4 地址需要额外每个月 $2
Certificates10 个活跃的证书最多 10 个证书

获取FLY_API_TOKEN 或在本地执行flyctl auth token查看

Linux安装

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

移动到/usr/bin目录下

cp /root/.fly/bin/flyctl /usr/bin

登陆fly.io

 flyctl auth login

复制提示里面的网址在浏览器中打开完成登陆

部署Bitwarden

使用 SQLite 数据库安装 Vaultwarden。但是您需要为数据库创建卷

flyctl volumes create vaultwarden_data -a APP_NAME -s 1

在 Fly 上启动创建应用

flyctl launch

重新编辑fly.toml

nano fly.toml

完整示范如下

app = "APP_NAME"
# primary_region = 'sjc' 区域
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[build]
image = "vaultwarden/server:latest"

[env]
SIGNUPS_ALLOWED=true 
# disable after initial setup
INVITATIONS_ALLOWED=true
SHOW_PASSWORD_HINT=false
# WEBSOCKET_ENABLED=true # Required to use websockets
# DOMAIN='https://[DOMAIN]'
ADMIN_TOKEN='some-super-admin-token'
# SMTP_HOST='smtp.gmail.com'
# SMTP_PORT=587
# SMTP_SECURITY='starttls'
# SMTP_USERNAME='mail@gmail.com'
# SMTP_PASSWORD='superpass'
# YUBICO_CLIENT_ID='[OPTIONAL]'
# YUBICO_SECRET_KEY='[OPTIONAL]'

[mounts]
source="vaultwarden_data"
destination="/data"

[experimental]
allowed_public_ports = []
auto_rollback = true

[[services]]
http_checks = []
internal_port = 80
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"

其中ADMIN_TOKEN的值可以通过运行

docker run --rm -it vaultwarden/server /vaultwarden hash

加密web管理员的密码

重新部署

flyctl deploy

部署Alist

创建存储

flyctl volumes create alist_data -a APP_NAME -s 1

重新编辑fly.toml

app = 'APP_NAME'
primary_region = 'sjc'

[http_service]
  internal_port = 80
  force_https = true
  auto_stop_machines = 'stop'
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

[[vm]]
  size = 'shared-cpu-1x'


[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 = "alist_data"

重新部署

flyctl deploy

部署完成后会随机生成密码,密码在日志中查看,点击左侧的Live Logs搜索password便能看到密码,用户名是admin

绑定域名

进入应用APP => Certificates => Add certificate => 填入域名 => 添加解析

删除app

flyctl apps destroy <app-name>

一旦您销毁了某个应用,您将无法再访问其中的任何部分,并且也不会再为其中的任何部分向您收费。这包括 Fly Machines、Fly Volumes、IP 地址、机密、Docker 镜像等。

更多使用教程请参考官方文档Fly Docs