在 OpenShift 上安装

使用OpenShift Weblate模板,您可以在几秒钟内启动并运行您的个人Weblate实例。Weblate的所有依赖项都已经包含在内。PostgreSQL被设置为默认数据库,并且使用持久化卷声明。

你可以在 <https://github.com/WeblateOrg/openshift/> 找到模板。

安装

下面的示例假设您有一个正常运作的OpenShift v3.x环境,它已经安装``oc``客户端工具。请查看OpenShift文档中的说明。

Web 控制台

template.yml 复制原始内容,并将它们导入你的项目,然后在 OpenShift web 控制台使用 Create 按钮来新建你的应用。web 控制台将提示你模板使用的所有参数的值。

CLI

为了将 Weblate 模板上传到你当前项目的模板库中,使用后面的命令传递 template.yml 文件:

$ oc create -f https://raw.githubusercontent.com/WeblateOrg/openshift/main/template.yml \
   -n <PROJECT>

现在模板可以使用 CLI 的 web 控制台以供选择。

参数

The parameters that you can override are listed in the parameters section of the template. You can list them with the CLI by using the following command and specifying the file to be used:

$ oc process --parameters -f https://raw.githubusercontent.com/WeblateOrg/openshift/main/template.yml

# If the template is already uploaded
$ oc process --parameters -n <PROJECT> weblate

服务开通

还可以使用 CLI 来处理模板,并使用生成的配置来立即新建对象。

$ oc process -f https://raw.githubusercontent.com/WeblateOrg/openshift/main/template.yml \
    -p APPLICATION_NAME=weblate \
    -p WEBLATE_VERSION=4.3.1-1 \
    -p WEBLATE_SITE_DOMAIN=weblate.app-openshift.example.com \
    -p POSTGRESQL_IMAGE=docker-registry.default.svc:5000/openshift/postgresql:9.6 \
    -p REDIS_IMAGE=docker-registry.default.svc:5000/openshift/redis:3.2 \
    | oc create -f

在成功地迁移并部署特定的``WEBLATE_SITE_DOMAIN``参数后,Weblate 事件就应该可用了。

设置容器之后,您可以使用 WEBLATE_ADMIN_PASSWORD 中提供的密码以 管理员 用户身份登录,或者如果未设置密码,则使用首次启动时生成的随机密码。

要重置 管理员 密码,请在将``WEBLATE_ADMIN_PASSWORD``设置为相应的“Secret”中的新密码的情况下,重启容器。

消除

$ oc delete all -l app=<APPLICATION_NAME>
$ oc delete configmap -l app= <APPLICATION_NAME>
$ oc delete secret -l app=<APPLICATION_NAME>
# ATTTENTION! The following command is only optional and will permanently delete all of your data.
$ oc delete pvc -l app=<APPLICATION_NAME>

$ oc delete all -l app=weblate \
    && oc delete secret -l app=weblate \
    && oc delete configmap -l app=weblate \
    && oc delete pvc -l app=weblate

配置

通过处理模板,将新建各自的 ConfigMap ,并且可以用于定制 Weblate 映像。ConfigMap 直接作为环境变量挂载,并且在每次更改时触发新的部署。对于更多配置选项,环境变量的完成列表请参见 Docker 环境变量 for full list of environment variables。