Weblate のアップグレード

Docker イメージのアップグレード

The official Weblate Docker image (see Docker を使用したインストール) integrates all upgrade steps. Typically, no manual interaction is needed beyond pulling the latest (or at least newer) version.

一般的なアップグレード方法

Always look for new changes to ソフトウェア要件 before upgrading. Once all requirements are installed or upgraded, ensure your settings.py matches the changes in the configuration (consult settings_example.py for correct values).

Always check Version-specific instructions before upgrading. If you are skipping any version(s), be sure to follow instructions for all versions you are skipping during such upgrade. It's sometimes better to upgrade gradually to an intermediate version to ensure a smooth migration. Upgrading across multiple releases should work, but is not as well tested as single version upgrades!

注釈

Always back up the full database before upgrading, so that you can roll back the database if the upgrade fails, see Weblate のバックアップと移動.

  1. Stop the WSGI and Celery processes to avoid old processes running while upgrading. Otherwise incompatible changes in the database might occur.

  2. Upgrade Weblate

    pip によるインストール方法:

    pip install -U "Weblate[all]==version"
    

    または、最新のリリース バージョンを入手するだけの場合:

    pip install -U "Weblate[all]"
    

    すべてのオプションの依存関係をインストールせずに、インストールする方法:

    pip install -U Weblate
    

    Using Git checkout, you need to fetch new source code and update your installation:

    cd weblate-src
    git pull
    # Update Weblate inside your virtualenv
    . ~/weblate-env/bin/pip install -e '.[all]'
    # Install dependencies directly when not using virtualenv
    pip install --upgrade -e .
    # Install optional dependencies directly when not using virtualenv
    pip install --upgrade -e '.[all]'
    
  3. New Weblate releases might have new Python の依存関係, check if they cover the features you want.

  4. Upgrade the configuration file by following either settings_example.py, or Version-specific instructions.

  5. Upgrade the database:

    weblate migrate --noinput
    
  6. 更新された静的ファイルを収集する(参照: 実行サーバー および 静的ファイルの提供):

    weblate collectstatic --noinput --clear
    
  7. JavaScript ファイルと CSS ファイルを圧縮する(省略可能、参照: クライアント アセットの圧縮):

    weblate compress
    
  8. If you are running an installation from Git, you should also regenerate locale files every time you upgrade. You can do this by invoking:

    weblate compilemessages
    
  9. 設定が正常であるかを確認する(参照: 運用環境の設定):

    weblate check --deploy
    
  10. Restart the Celery worker (see Celery を使用するバックグラウンド タスク).

Version-specific instructions

バージョン 5.0 で変更: バージョン固有の指示は、リリースノートに含まれるようになりました。参照: Weblate 5.7

古いメジャー バージョンからのアップグレード

メジャーバージョン間のアップグレードには対応していません。初めのメジャーリリースの最新のパッチレベルにアップグレードしてください。この手順を省いたアップグレードには対応していませんので、中断します。

  • もし、2.x リリースからアップグレードする場合は、必ず最初に 3.0.1 にアップグレードしてください。

  • もし、3.x リリースからアップグレードする場合は、必ず最初に 4.0.4 にアップグレードしてください。

  • もし、4.x リリースからアップグレードする場合は、必ず最初に 5.0.2 にアップグレードしてください。

他のデータベースから PostgreSQL に移行

If you are not running Weblate with a different database than PostgreSQL, consider migrating to PostgreSQL for better performance by doing the following steps. Remember to stop both, the web and Celery servers beforehand, otherwise you might end up with inconsistent data.

PostgreSQL でデータベースの作成

It is usually a good idea to run Weblate in a separate database, and a separate user account:

# If PostgreSQL was not installed before, set the main password
sudo -u postgres psql postgres -c "\password postgres"

# Create a database user called "weblate"
sudo -u postgres createuser -D -P weblate

# Create the database "weblate" owned by "weblate"
sudo -u postgres createdb -E UTF8 -O weblate weblate

pgloader を使用した PostgreSQL への移行

The pgloader is a generic migration tool to migrate data to PostgreSQL. You can use it to migrate your Weblate database.

  1. Adjust your settings.py to use PostgreSQL as database.

  2. PostgreSQL データベース内のスキーマを移行する:

    weblate migrate
    weblate sqlflush | weblate dbshell
    

3. Run the pgloader to transfer the data. The following script can be used to migrate the database, but you might want to learn more about pgloader to better understand what it does, and tweak it to match your setup:

LOAD DATABASE
     FROM      mysql://weblate:password@localhost/weblate
     INTO postgresql://weblate:password@localhost/weblate

WITH include no drop, truncate, create no tables, create no indexes, no foreign keys, disable triggers, reset sequences, data only

ALTER SCHEMA 'weblate' RENAME TO 'public'
;

Pootle から移行

As Weblate was originally written as a replacement for Pootle, it is supported to migrate the user accounts from it. You can dump the users from Pootle and import them using importusers.