在 OpenShift 中安裝

使用OpenShift Weblate模板,您可以在幾秒鐘內啟動並執行您的個人Weblate實例。 Weblate的所有相依項都已經包含在內。 PostgreSQL被設定為預設資料庫,並且使用持久化卷聲明。

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

安裝

The following examples assume you have a working OpenShift v3.x environment, with oc client tool installed. Please check the OpenShift documentation for instructions.

The template.yml is suited for running all components in OpenShift. There is also template-external-postgresql.yml which does not start a PostgreSQL server and allows you to configure external PostgreSQL server.

Web 控制台

Copy the raw content from template.yml and import them into your project, then use the Create button in the OpenShift web console to create your application. The web console will prompt you for the values for all of the parameters used by the template.

CLI

為了將 Weblate 模板上傳到您目前項目的模板庫中,使用後面的命令傳遞 template.yml 文件:

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

現在模板可以使用 CLI 的 web 主控台以供選擇。

參數值

模板的 parameters 部分列出了您可以覆蓋的參數。您可以通過使用後面的命令並指定要使用的文件通過 CLI 列出它們:

$ 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

Provisioning

還可以使用 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

The Weblate instance should be available after successful migration and deployment at the specified WEBLATE_SITE_DOMAIN parameter.

設定容器之後,您可以使用 WEBLATE_ADMIN_PASSWORD 中提供的密碼以 管理員 使用者身份登入,或者如果未設定密碼,則使用首次啟動時產生的隨機密碼。

To reset admin password, restart the container with WEBLATE_ADMIN_PASSWORD set to new password in the respective Secret.

Eliminate

$ oc delete all -l app=<APPLICATION_NAME>
$ oc delete configmap -l app= <APPLICATION_NAME>
$ oc delete secret -l app=<APPLICATION_NAME>
# ATTENTION! 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。