How to deploy a cluster with TPAexec using satellite repositories

Edgar Silva Leitão
Edgar Silva Leitão

This approach is used to deploy a cluster using the customer's own repositories (satellites), such as Nexus repositories, for example.

The idea is to use TPAexec to disable any EDB or local repository and add a new repository during the deployment with the assistance of a hook file. You can find the steps to accomplish this below.

The steps below use a PGD 5 cluster as an example, but this approach also applies for any architecture and any version.

1- Create a simple PGD5 cluster in a Docker platform for test:

tpaexec configure ~/mycluster \
  --architecture PGD-Always-ON \
  --platform docker \
  --edb-postgres-advanced 15 \
  --redwood \
  --location-names dc1 \
  --pgd-proxy-routing global \
  --keyring legacy \
  --no-git

2- Create a directory named hooks inside the cluster directory:

mkdir -p ~/mycluster/hooks

3- Inside the hooks directory, create a file called post-repo.yml with the following content:

- name: Remove EDB repository for x86_64
  yum_repository:
    name: enterprisedb-standard-x86_64
    file: enterprisedb-standard
    state: absent

- name: Remove EDB repository for noarch
  yum_repository:
    name: enterprisedb-standard-noarch
    file: enterprisedb-standard
    state: absent

- name: Remove TPAexec local repo
  yum_repository:
    name: tpa-local-repo
    file: tpa-local-repo.repo
    state: absent

- name: Add my-repo repository for x86_64
  yum_repository:
    name: my-repo-x86_64
    file: my-repo
    baseurl: <MY-REPO_URL_HERE>
    gpgcheck: no
    description: my-repo

- name: Add my-repo repository for noarch
  yum_repository:
    name: my-repo-noarch
    file: my-repo
    baseurl: <MY-REPO_URL_HERE>
    gpgcheck: no
    description: my-repo

Replacing:

  • my-repo with the name of your repository;
  • <MY-REPO_URL_HERE> with the exact URL to access your repository.

The example above is a hook file that triggers right after the installation of the EDB repositories on the target machines.

You can use this file to add or disable any repository. However, ensure that the EDB repositories are configured in the config.yml file just to start the deployment process. The hook above will then disable the EDB repositories on your system.

Additionally, you can leave the yum_repositories parameter with an empty array in the config.yml file if the satellite repository already contains the necessary packages from repositories like EPEL.

cluster_vars:
...
   edb_repositories:
   - standard
   yum_repositories: []
...

3- Run tpaexec provision and tpaexec deploy.

This approach will ensure that the satellite repositories configured in the hook file will be added and used to deploy the cluster, and disable any other not desired repository in the target machine.

If needed, at any moment these repositories disabled by the hook file can be enabled back manually.

Was this article helpful?

0 out of 0 found this helpful