如何在Fly.io部署typecho

本文最后更新于 2024年4月3日 上午

使用项目

https://github.com/ttys3/typecho-docker

准备工作

  • 注册FLY.IO
    用以部署typecho

安装flyctl

Install flyctl
以WINDOWS为例

1
pwsh -Command "iwr https://fly.io/install.ps1 -useb | iex"

其他系统请参照官方

新建APP

初始化

1
flyctl launch

按照提示选择会生成一个FLY.TOML文件

编辑FLY.TOML

添加以下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# fly.toml app configuration file generated for gotos on 2023-08-12T19:36:14+08:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "typecho"
primary_region = "hkg"

[experimental]
vm = true

[build]
image = "80x86/typecho:latest"

[env]
PHP_MAX_EXECUTION_TIME = 600
PHP_TZ = "Asia/Shanghai"

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

[http_service]
internal_port = 80
force_https = true
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1
processes = ["app"]

添加持久卷

1
flyctl volumes create typecho_data --region hkg --size 1

部署

1
flyctl deploy

演示地址

https://avnvu.fly.dev/