Skip to content

[新服务]fly.io使用部署next-terminal+宝塔远程mysql

介绍或总结

  • 远程部署docker
  • serverless

介绍fly.io

Price/Fee/Cost

注册或使用

brew install superfly/tap/flyctl
flyctl auth signup
fly login
# 本地
git clone https://github.com/dushixiang/next-terminal.git && cd next-terminal && wget -O fly.toml https://od.liusy.eu.org/e5/config/terminal.toml && mkdir -p web/build && wget https://od.liusy.eu.org/e5/config/build.zip && unzip -d web/build build.zip && rm build.zip

# 修改 fly.toml
vim fly.toml
 
 
flyctl launch # 问是否修改一些设施,比如app-name
# will ask whether to fly deploy # 部署
flyctl status
# fly.toml file generated for nt2021 on 2021-10-16T02:48:36+08:00

app = "your-unique-appname"

[env]
  DB = "mysql"
  MYSQL_DATABASE = "next_term_flyio"
  MYSQL_HOSTNAME = "mysql.remoteserver.com"
  MYSQL_PASSWORD = "password"
  MYSQL_PORT = "3306"
  MYSQL_USERNAME = "next_term_flyio"

[[services]]
  internal_port = 8088
  protocol = "tcp"

  [[services.ports]]
    handlers = ["http"]
    port = "80"

  [[services.ports]]
    handlers = ["tls", "http"]
    port = "443"
mysql -u root -p'password' -h mysql.remoteserver.com -P 3306 -D next_term_flyio

(optional) 自定义域名

  • 建立 mysql.xxx.com => real mysql server

网页自定义域名

测试 – appname.fly.dev

测试 – 自定义域名

一些fly.io的技巧

fly status

Leave a Reply

Your email address will not be published.