|
| 1 | +--- |
| 2 | +title: |
| 3 | + en: Koyeb |
| 4 | + zh-CN: 使用 Koyeb |
| 5 | +icon: iconfont icon-module |
| 6 | +top: 42 |
| 7 | +categories: |
| 8 | + - guide |
| 9 | + - installation |
| 10 | +--- |
| 11 | + |
| 12 | +::: zh-CN |
| 13 | +::: tip |
| 14 | +[Koyeb免费方案](https://www.koyeb.com/pricing#features)包含: |
| 15 | + |
| 16 | +- 1个WebService (500MB内存,地区可选德国🇩🇪或美国🇺🇸) |
| 17 | +- ~~1个Postgres~~(Koyeb的免费数据库每月只提供5小时额度,本教程将使用[Supabase免费方案](https://supabase.com/pricing)代替) |
| 18 | + |
| 19 | +::: |
| 20 | + |
| 21 | +::: en |
| 22 | +::: tip |
| 23 | +The [Koyeb free plan](https://www.koyeb.com/pricing#features) includes: |
| 24 | + |
| 25 | +- 1 Web Service (500 MB RAM, regions: Germany 🇩🇪 or United States 🇺🇸) |
| 26 | +- ~~1 Postgres~~ (Koyeb's free database only provides 5 hours per month; this guide uses the [Supabase free plan](https://supabase.com/pricing) instead) |
| 27 | + |
| 28 | +::: |
| 29 | + |
| 30 | +## Deployment Overview { lang="en" } |
| 31 | + |
| 32 | +::: en |
| 33 | + |
| 34 | +- Create a database on Supabase to persist OpenList configuration data |
| 35 | +- Deploy the OpenList application on Koyeb |
| 36 | + |
| 37 | +::: |
| 38 | + |
| 39 | +## 部署概览 { lang="zh-CN" } |
| 40 | + |
| 41 | +::: zh-CN |
| 42 | + |
| 43 | +- 在Supabase中创建一个数据库用于保存openlist的配置数据 |
| 44 | +- 在Koyeb中部署openlist应用 |
| 45 | + |
| 46 | +::: |
| 47 | + |
| 48 | +## Prerequisites { lang="en" } |
| 49 | + |
| 50 | +::: en |
| 51 | + |
| 52 | +- A [Supabase account](https://supabase.com/dashboard) (click to sign up) |
| 53 | +- A [Koyeb account](https://app.koyeb.com/auth/signup) (click to sign up) |
| 54 | + |
| 55 | +::: |
| 56 | + |
| 57 | +## 部署前准备 { lang="zh-CN" } |
| 58 | + |
| 59 | +::: zh-CN |
| 60 | + |
| 61 | +- 一个[Supabase账户](https://supabase.com/dashboard)(点击注册登录) |
| 62 | +- 一个[Koyeb账户](https://app.koyeb.com/auth/signup)(点击注册登录) |
| 63 | + |
| 64 | +::: |
| 65 | + |
| 66 | +### Create the Database { lang="en" } |
| 67 | + |
| 68 | +::: en |
| 69 | +Sign in to [Supabase](https://supabase.com/dashboard). |
| 70 | + |
| 71 | +1. Create a new project. |
| 72 | +2. In **New project**, set the **Database password** and save it. Select **Central EU (Frankfurt)** as the region. |
| 73 | + > Choose a region close to your Koyeb server — **Frankfurt** or **Washington D.C** is recommended. |
| 74 | +3. Open the new project and click the **Connect** button to find the DB_HOST. |
| 75 | +  |
| 76 | + |
| 77 | +::: |
| 78 | + |
| 79 | +### 创建数据库 { lang="zh-CN" } |
| 80 | + |
| 81 | +::: zh-CN |
| 82 | +登录[Supabase](https://supabase.com/dashboard) |
| 83 | + |
| 84 | +1. 创建一个新项目 |
| 85 | +2. New project中设置 **Database password** 并记好,Region选择**Central EU(Frankfurt)**。 |
| 86 | + > 建议选择与Koyeb服务器接近的Region,**Frankfurt**或**Washington D.C** |
| 87 | +3. 进入新建的project点击**Connect**按钮可查看DB_HOST |
| 88 | +  |
| 89 | + |
| 90 | +::: |
| 91 | + |
| 92 | +## Create the Service { lang="en" } |
| 93 | + |
| 94 | +::: en |
| 95 | + |
| 96 | +1. Sign in to the [Koyeb console](https://app.koyeb.com/) and click **Create App**. |
| 97 | +2. Select **Docker** under Web service. |
| 98 | +3. Set **Image** to `openlistteam/openlist:latest` and click **Next**. |
| 99 | +4. Choose the **Free** instance under **CPU Eco 🌱** and click **Next**. |
| 100 | + |
| 101 | +::: |
| 102 | + |
| 103 | +## 创建服务 { lang="zh-CN" } |
| 104 | + |
| 105 | +::: zh-CN |
| 106 | + |
| 107 | +1. 登录 [Koyeb 控制台](https://app.koyeb.com/),点击 **Create App**。 |
| 108 | +2. 选择Web service中的 **Docker**。 |
| 109 | +3. 将 **Image** 设置为 `openlistteam/openlist:latest`,点击**Next**。 |
| 110 | +4. 选择**CPU Eco 🌱**中的**Free**服务器点击**Next** |
| 111 | + |
| 112 | +::: |
| 113 | + |
| 114 | +### Configure Deployment { lang="en" } |
| 115 | + |
| 116 | +::: en |
| 117 | + |
| 118 | +1. Enable the **Override** toggle next to **Command**. |
| 119 | +2. Enter `./openlist server --config /tmp/config.json` in the input box. |
| 120 | + ::: warning |
| 121 | + You must specify the config file path; otherwise you will get the error: the current user does not have write and/or execute permissions on the `./data` directory (`/opt/openlist/data`). |
| 122 | + ::: |
| 123 | + |
| 124 | +### 设置Deployment { lang="zh-CN" } |
| 125 | + |
| 126 | +::: zh-CN |
| 127 | + |
| 128 | +1. 打开**Command**后的**Override**开关 |
| 129 | +2. 在框中输入 `./openlist server --config /tmp/config.json` |
| 130 | + ::: warning |
| 131 | + 必须指定openlist的配置文件地址,不然会导致 错误:当前用户没有 ./data 目录(/opt/openlist/data)的写和/或执行权限。 |
| 132 | + ::: |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | +### Set up Environment Variables and Files { lang="en" } |
| 137 | + |
| 138 | +#### Add environment variables { lang="en" } |
| 139 | + |
| 140 | +::: en |
| 141 | +| Key | Value | Purpose | |
| 142 | +| ------------------------- | ---------------------------------- | ----------------------------------------------------------------------- | |
| 143 | +| `TZ` | `Asia/Shanghai` (or any timezone) | Set the container timezone | |
| 144 | +| `UMASK` | `022` | https://en.wikipedia.org/wiki/Umask | |
| 145 | +| `OPENLIST_ADMIN_PASSWORD` | Initial admin password | Strongly recommended; otherwise a random password is generated on every restart | |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | +::: |
| 150 | + |
| 151 | +#### Add configuration file { lang="en" } |
| 152 | + |
| 153 | +::: en |
| 154 | +Switch to the `Files` tab, click **Add file**, and set **Path** to `/tmp/config.json` (matching the path specified in the Command). |
| 155 | + |
| 156 | +Enter the following in **File content**: |
| 157 | + |
| 158 | +```json |
| 159 | +{ |
| 160 | + "force": false, |
| 161 | + "jwt_secret": "random_generated", |
| 162 | + "database": { |
| 163 | + "type": "postgres", |
| 164 | + "host": "replace_with_your_DB_HOST", |
| 165 | + "port": 5432, |
| 166 | + "user": "postgres", |
| 167 | + "password": "replace_with_your_database_password", |
| 168 | + "name": "postgres", |
| 169 | + "db_file": "", |
| 170 | + "table_prefix": "x_", |
| 171 | + "ssl_mode": "require", |
| 172 | + "dsn": "" |
| 173 | + }, |
| 174 | + "scheme": { |
| 175 | + "address": "0.0.0.0", |
| 176 | + "http_port": 5244 |
| 177 | + }, |
| 178 | + "temp_dir": "/tmp/temp", |
| 179 | + "bleve_dir": "/tmp/bleve", |
| 180 | + "log": { |
| 181 | + "enable": false |
| 182 | + } |
| 183 | +} |
| 184 | +``` |
| 185 | + |
| 186 | + |
| 187 | + |
| 188 | +::: |
| 189 | + |
| 190 | +### 设置 Environment variables and files { lang="zh-CN" } |
| 191 | + |
| 192 | +#### 添加环境变量 { lang="zh-CN" } |
| 193 | + |
| 194 | +::: zh-CN |
| 195 | +| Key | Value | 用途 | |
| 196 | +| ------------------------- | ----------------------------- | ------------------------------------------ | |
| 197 | +| `TZ` | `Asia/Shanghai`(或任意时区) | 设置容器时区 | |
| 198 | +| `UMASK` | `022` | https://en.wikipedia.org/wiki/Umask | |
| 199 | +| `OPENLIST_ADMIN_PASSWORD` | admin的起始密码 | 强烈建议设置,不然每次服务重启都会随机生成 | |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | +::: |
| 204 | + |
| 205 | +#### 添加配置文件 { lang="zh-CN" } |
| 206 | + |
| 207 | +::: zh-CN |
| 208 | +切换到`Files`,点击**Add file**,将**Path**设置为`/tmp/config.json`(与Command中指定的一致) |
| 209 | + |
| 210 | +**File content**中填入: |
| 211 | + |
| 212 | +```json |
| 213 | +{ |
| 214 | + "force": false, |
| 215 | + "jwt_secret": "random_generated", |
| 216 | + "database": { |
| 217 | + "type": "postgres", |
| 218 | + "host": "这里替换为你的DB_HOST", |
| 219 | + "port": 5432, |
| 220 | + "user": "postgres", |
| 221 | + "password": "这里替换为你的数据库密码", |
| 222 | + "name": "postgres", |
| 223 | + "db_file": "", |
| 224 | + "table_prefix": "x_", |
| 225 | + "ssl_mode": "require", |
| 226 | + "dsn": "" |
| 227 | + }, |
| 228 | + "scheme": { |
| 229 | + "address": "0.0.0.0", |
| 230 | + "http_port": 5244 |
| 231 | + }, |
| 232 | + "temp_dir": "/tmp/temp", |
| 233 | + "bleve_dir": "/tmp/bleve", |
| 234 | + "log": { |
| 235 | + "enable": false |
| 236 | + } |
| 237 | +} |
| 238 | +``` |
| 239 | + |
| 240 | + |
| 241 | + |
| 242 | +::: |
| 243 | + |
| 244 | +### Configure Ports { lang="en" } |
| 245 | + |
| 246 | +::: en |
| 247 | +Change the **Port** to `5244`. |
| 248 | + |
| 249 | +::: |
| 250 | + |
| 251 | +### 设置Ports { lang="zh-CN" } |
| 252 | + |
| 253 | +::: zh-CN |
| 254 | +将**Port**改为`5244` |
| 255 | + |
| 256 | +::: |
| 257 | + |
| 258 | +## Deploy and Verify { lang="en" } |
| 259 | + |
| 260 | +::: en |
| 261 | + |
| 262 | +1. Review the summary and click **Save and deploy**. |
| 263 | +2. After a short wait you should see OpenList initialization messages in the LOG panel. |
| 264 | +3. Once deployment is complete, click the link provided by Koyeb to access OpenList. |
| 265 | + |
| 266 | + |
| 267 | + |
| 268 | +::: |
| 269 | + |
| 270 | +## 部署与验证 { lang="zh-CN" } |
| 271 | + |
| 272 | +::: zh-CN |
| 273 | + |
| 274 | +1. 核对摘要信息后点击 **Save and deploy**。 |
| 275 | +2. 稍等一会就能在LOG窗口中看到 OpenList 的初始化信息。 |
| 276 | +3. 如果没有其它问题,部署完成之后即可点击Koyeb给的链接访问openlist了。 |
| 277 | + |
| 278 | + |
| 279 | + |
| 280 | +::: |
| 281 | + |
| 282 | +## Updates and Maintenance { lang="en" } |
| 283 | + |
| 284 | +::: en |
| 285 | + |
| 286 | +- **Updates**: Go to the Service detail page. If the image is set to `latest`, simply click **Redeploy** when a new version is available. |
| 287 | +- **Logs**: View real-time logs on the Service detail page, or click **Details** under Scaling. |
| 288 | + |
| 289 | +::: |
| 290 | + |
| 291 | +## 更新与维护 { lang="zh-CN" } |
| 292 | + |
| 293 | +::: zh-CN |
| 294 | + |
| 295 | +- **更新**:进入Service详情页,如果之前设置的镜像为latest,当有新版本时手动点击**Redeploy**即可更新版本 |
| 296 | +- **日志**:在Service详情页查看实时日志,或在Scaling中点击**Details**。 |
| 297 | + |
| 298 | +::: |
0 commit comments