Installing from source
======================

config.ymlで\ ``install_from_source``
を設定することにより、Gitリポジトリからビルドおよびインストールする拡張機能のリストを定義できます。

.. code:: yaml

   cluster_vars:
     install_from_source:
       - name: ext
         git_repository_url: https://repo.example.com/ext.git
         git_repository_ref: dev/example

       - name: otherext
         git_repository_url: ssh://repo.example.com/otherext.git
         git_repository_ref: master
         source_directory: /opt/postgres/src/otherext
         build_directory: /opt/postgres/build/otherext
         build_commands:
           - "make -f /opt/postgres/src/otherext/Makefile install"
         build_environment:
           VAR: value

TPAはリストされている順序で拡張機能を1つずつビルドおよびインストールするため、正しい順序で言及することにより、別の拡張機能（
pglogical やBDRなど）をビルドできます。

各エントリは、ビルドする\ ``name`` 、\ ``git_repository_url``
、および\ ``git_repository_ref`` （デフォルト：\ ``master``
）を指定する必要があります。 :ref:`SSH agent forwarding or an HTTPS username/password <Git credentials>` を使用できます

Gitリポジトリに対して認証します。上記のように\ ``source_directory``
、\ ``build_directory`` 、\ ``build_environment``
、および\ ``build_commands`` も設定します。

繰り返しデプロイを行うときにビルドディレクトリを再利用するには、
``tpaexec deploy … --skip-tags build-clean`` を実行します。
（それ以外の場合、ビルドを開始する前に古いビルドディレクトリが空になります。）
 :ref:`ローカルソースディレクトリ <ローカルソースディレクトリ>` を構成することもできます。

開発ビルドをスピードアップします。

ソースビルドを実行するたびに、Postgresが再起動されます。

依存関係をビルドする
--------------------

ソースからビルドしている場合、TPAは基本的なPostgresビルドの依存関係がインストールされていることを保証します。追加のパッケージが必要な場合は、
 :ref:`TPAパッケージのインストール <TPAパッケージのインストール>`  に記載してください。例

.. code:: yaml

   cluster_vars:
     packages:
       common:
       - golang-1.16
