在 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

開通

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

終止

$ 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。