MERGE TWO REPOSITORIES INTO A SHARED DATASTORE
This guide shows you how to merge two independent solo repositories into a shared datastore so they can reference each other's data.
Prerequisites
- Two existing Swamp repositories, each with its own data
- An S3 or GCS bucket to serve as the shared backend (or a shared filesystem path)
Set up the shared backend
Create the S3 bucket if it does not exist. Then configure both repositories to use it.
In repository A:
$ swamp datastore setup extension @swamp/s3-datastore \
--namespace infra \
--config '{"bucket":"shared-bucket","prefix":"swamp","region":"us-east-1"}'This migrates repository A's existing local data to S3 under the infra
namespace.
In repository B:
$ swamp datastore setup extension @swamp/s3-datastore \
--namespace compute \
--skip-migration \
--config '{"bucket":"shared-bucket","prefix":"swamp","region":"us-east-1"}'Use --skip-migration for the second repository to avoid pushing its data
before you are ready. Each repository's data is scoped under its namespace from
the start.
Push repository B's data
Now that repository B has a namespace, push its local data to S3:
$ swamp datastore sync --pushVerify
From either repository:
$ swamp datastore namespace listBoth namespaces appear. Each repository can now reference the other's data using the namespace prefix syntax:
globalArguments:
vpc_id: "${{ data.latest('infra:my-vpc', 'result').attributes.vpcId }}"