3
0
corteza/federation

== Development setup for origin and destination nodes

Add the appropriate .env files
[source,bash]
----
$ cp .env federation/etc/.env.orig
$ cp .env federation/etc/.env.dest
----

Change the DB_DSN in each of the files
----
.env.orig: DB_DSN=corteza:rootcorteza@tcp(db_origin:3306)/corteza?collation=utf8mb4_general_ci
.env.dest: DB_DSN=corteza:rootcorteza@tcp(db_destination:3306)/corteza?collation=utf8mb4_general_ci
----

Run the nodes
[source,bash]
----
$ docker-compose -f federation/etc/docker-compose.yml up -d node_origin
$ docker-compose -f federation/etc/docker-compose.yml up -d node_destination
----

== Setup db (postgres)

Add db dsn to .env
[source,bash]
----
DB_DSN=postgres+debug://docker:docker@localhost:5432/corteza?sslmode=disable
----

Start the postgres db
[source,bash]
----
$ docker-compose up -db pg
----

== Status

=== Node pairing

=== Structure sync

.TODO
* [ ] Finish endpoints below
* [ ] Add structure sync service (the syncing process)
* [ ] Handle acl

.List of endpoints
* [x] Show exposed module
* [x] Remove exposed module
* [x] Shared module details
* [x] List of shared/exposed modules
* [ ] Add module as exposed - same as add module to federation
* [ ] Add mappings to module
* [ ] Show module mappings
* [ ] Update fields on exposed module


Show exposed module::
[source,bash]
----
$ curl -X GET "$BASE_URL/federation/nodes/$NODE_ID/modules/$MODULE_ID/exposed"
----

Remove exposed module::
[source,bash]
----
$ curl -X DELETE "$BASE_URL/federation/nodes/$NODE_ID/modules/$MODULE_ID/exposed"
----

Shared module details::
[source,bash]
----
$ curl -X GET "$BASE_URL/federation/nodes/$NODE_ID/modules/$MODULE_ID/shared"
----

List of shared/exposed modules::
[source,bash]
----
$ curl -X GET "$BASE_URL/federation/nodes/$NODE_ID/modules?exposed=1"
$ curl -X GET "$BASE_URL/federation/nodes/$NODE_ID/modules?shared=1"
----

Add module as exposed - same as add module to federation::
[source,bash]
----
curl -X PUT "$BASE_URL/federation/nodes/$NODE_ID/modules"
----

Add mappings to module::
[source,bash]
----
curl -X PUT "$BASE_URL/federation/nodes/$NODE_ID/modules/$MODULE_ID/mapped"
----

Show module mappings::
[source,bash]
----
curl -X GET "$BASE_URL/federation/nodes/$NODE_ID/modules/$MODULE_ID/mapped"
----

Update fields on exposed module::
[source,bash]
----
curl -X PUT "$BASE_URL/federation/nodes/$NODE_ID/modules/$MODULE_ID/exposed"
----