Skip to content

Define configuration per environment within hiera

This allows to reuse the same configuration declaration (especially vagrant which uses the "staging" environment).

And not having to declare one especially for the vagrant nodes.

Note: I considered renaming the location from "vagrant" to "local" as "local" sounds more like a location than "vagrant" (which is more an implementation detail on how we implement local vms). But I did not act on this, if we agree on that, i'll do it in other diffs (that impacts the Vagrantfile as well).

Related to !227 (closed)#inline-27284 discussion Related to T2606

Test Plan

No impact on current staging or environment nodes (tested with octocatalog-diff, one node per environment/location: production/azure, production/sesi, staging/sesi) [2]:

$ bin/octocatalog-diff --octocatalog-diff-args --no-truncate-details --to staging deposit.internal.staging.swh.network --environment staging
Found host deposit.internal.staging.swh.network
Cloning into '/tmp/swh-ocd.zKhPzTa9/environments/production/data/private'...
done.
Cloning into '/tmp/swh-ocd.zKhPzTa9/environments/staging/data/private'...
done.
*** Running octocatalog-diff on host deposit.internal.staging.swh.network
I, [2020-10-05T21:13:32.628602 #1691]  INFO -- : Catalogs compiled for deposit.internal.staging.swh.network
I, [2020-10-05T21:13:34.013628 #1691]  INFO -- : Diffs computed for deposit.internal.staging.swh.network
I, [2020-10-05T21:13:34.013675 #1691]  INFO -- : No differences
*** End octocatalog-diff on deposit.internal.staging.swh.network

$ bin/octocatalog-diff --octocatalog-diff-args --no-truncate-details --to staging uffizi
Found host uffizi.softwareheritage.org
Cloning into '/tmp/swh-ocd.uNXp4Prw/environments/production/data/private'...
done.
Cloning into '/tmp/swh-ocd.uNXp4Prw/environments/staging/data/private'...
done.
*** Running octocatalog-diff on host uffizi.softwareheritage.org
I, [2020-10-05T21:21:07.437352 #8051]  INFO -- : Catalogs compiled for uffizi.softwareheritage.org
I, [2020-10-05T21:21:08.585806 #8051]  INFO -- : Diffs computed for uffizi.softwareheritage.org
I, [2020-10-05T21:21:08.585849 #8051]  INFO -- : No differences
*** End octocatalog-diff on uffizi.softwareheritage.org

$ bin/octocatalog-diff --octocatalog-diff-args --no-truncate-details --to staging worker01.euwest.azure --environment production
Found host worker01.euwest.azure.internal.softwareheritage.org
Cloning into '/tmp/swh-ocd.dC3bcIdf/environments/production/data/private'...
done.
Cloning into '/tmp/swh-ocd.dC3bcIdf/environments/staging/data/private'...
done.
*** Running octocatalog-diff on host worker01.euwest.azure.internal.softwareheritage.org
I, [2020-10-06T09:37:24.671548 #2774]  INFO -- : Catalogs compiled for worker01.euwest.azure.internal.softwareheritage.org
I, [2020-10-06T09:37:25.583898 #2774]  INFO -- : Diffs computed for worker01.euwest.azure.internal.softwareheritage.org
I, [2020-10-06T09:37:25.583937 #2774]  INFO -- : No differences
*** End octocatalog-diff on worker01.euwest.azure.internal.softwareheritage.org

Then provision a staging vm and check its configuration is now referring to the actual staging nodes (without this diff, it's using production nodes for swh services for example...) [1]:

$ vagrant up staging-webapp

Check /etc/softwareheritage/web/web.yml which now presents the internal.staging.swh.network url for swh services and no longer the production ones.

  • [1] providing we change the Vagrantfile to actually declare the use of the hiera.yaml ~> D4148

  • [2] providing we change octocatalog-diff so it provides the environment ~> D4149


Migrated from D4147 (view on Phabricator)

Merge request reports