Development setup added
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -11,4 +11,5 @@ profile.coverprofile
|
||||
/var
|
||||
/TODO
|
||||
/gin-bin
|
||||
/.vscode
|
||||
/.vscode
|
||||
/federation/etc/.env*
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
== Development setup for origin and destination nodes
|
||||
|
||||
Add the appropriate .env files
|
||||
[source,bash]
|
||||
----
|
||||
$ cp .env federation/etc/{.env.orig,.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
|
||||
----
|
||||
|
||||
Add testing migrations
|
||||
[source,bash]
|
||||
----
|
||||
$ docker-compose -f federation/etc/docker-compose.yml run db_origin mysql -u corteza -prootcorteza corteza -h localhost --port 3306 < federation/migration_federation_origin.sql
|
||||
$ docker-compose -f federation/etc/docker-compose.yml run db_destination mysql -u corteza -prootcorteza corteza -h localhost --port 3307 < federation/migration_federation_destination.sql
|
||||
----
|
||||
|
||||
== Setup db (postgres)
|
||||
|
||||
Add db dsn to .env
|
||||
@@ -12,13 +40,6 @@ Start the postgres db
|
||||
$ docker-compose up -db pg
|
||||
----
|
||||
|
||||
Add testing migrations
|
||||
[source,bash]
|
||||
----
|
||||
$ docker exec -i corteza-server_pg_1 psql -U docker corteza < federation/migration_federation_origin.sql
|
||||
$ docker exec -i corteza-server_pg_1 psql -U docker corteza < federation/migration_federation_destination.sql
|
||||
----
|
||||
|
||||
== Status
|
||||
|
||||
=== Node pairing
|
||||
|
||||
57
federation/etc/docker-compose.yml
Normal file
57
federation/etc/docker-compose.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
version: "3"
|
||||
services:
|
||||
db_origin:
|
||||
image: percona:8.0
|
||||
container_name: db_origin
|
||||
restart: on-failure
|
||||
environment:
|
||||
MYSQL_DATABASE: corteza
|
||||
MYSQL_USER: corteza
|
||||
MYSQL_PASSWORD: rootcorteza
|
||||
MYSQL_ROOT_PASSWORD: rootcorteza
|
||||
volumes:
|
||||
- "../../data/db_origin:/var/lib/mysql"
|
||||
ports:
|
||||
- 3306:3306
|
||||
|
||||
db_destination:
|
||||
image: percona:8.0
|
||||
container_name: db_destination
|
||||
restart: on-failure
|
||||
environment:
|
||||
MYSQL_DATABASE: corteza
|
||||
MYSQL_USER: corteza
|
||||
MYSQL_PASSWORD: rootcorteza
|
||||
MYSQL_ROOT_PASSWORD: rootcorteza
|
||||
volumes:
|
||||
- "../../data/db_destination:/var/lib/mysql"
|
||||
ports:
|
||||
- 3307:3306
|
||||
|
||||
node_origin:
|
||||
image: golang
|
||||
container_name: node_origin
|
||||
entrypoint: [ make, watch ]
|
||||
depends_on: [ db_origin ]
|
||||
volumes:
|
||||
- "../../:/app"
|
||||
- "./.env.orig:/app/.env"
|
||||
working_dir: /app
|
||||
restart: on-failure
|
||||
ports:
|
||||
- 8084:8084
|
||||
|
||||
node_destination:
|
||||
image: golang
|
||||
container_name: node_destination
|
||||
entrypoint: [ make, watch ]
|
||||
depends_on: [ db_destination ]
|
||||
volumes:
|
||||
- "../../:/app"
|
||||
- "./.env.dest:/app/.env"
|
||||
working_dir: /app
|
||||
restart: on-failure
|
||||
ports:
|
||||
- 8085:8084
|
||||
|
||||
|
||||
@@ -43,9 +43,14 @@ CREATE TABLE IF NOT EXISTS federation_node
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
||||
TRUNCATE TABLE federation_node;
|
||||
TRUNCATE TABLE federation_module_shared;
|
||||
TRUNCATE TABLE federation_module_exposed;
|
||||
TRUNCATE TABLE federation_module_mapping;
|
||||
|
||||
INSERT INTO federation_node values ('276342359342989555', 'Node Origin (somewhere else)', 'paired', 'synced', now(), 'synced', now());
|
||||
|
||||
INSERT INTO federation_module_shared (id, handle, name, rel_node, xref_module, fields)
|
||||
VALUES
|
||||
(206342359342988000, 'Pricebook_on_origin_somewhere_else', 'Pricebook on some other origin (somewhere else)', 276342359342989555, 196342359342989000, NULL)
|
||||
(206342359342988000, 'Pricebook_on_origin_somewhere_else', 'Pricebook on some other origin (somewhere else)', 276342359342989555, 196342359342989000, '[]')
|
||||
;
|
||||
|
||||
@@ -43,14 +43,19 @@ CREATE TABLE IF NOT EXISTS federation_node
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
||||
TRUNCATE TABLE federation_node;
|
||||
TRUNCATE TABLE federation_module_shared;
|
||||
TRUNCATE TABLE federation_module_exposed;
|
||||
TRUNCATE TABLE federation_module_mapping;
|
||||
|
||||
INSERT INTO federation_node values ('276342359342989444', 'Node Destination (somewhere else)', 'paired', 'synced', now(), 'synced', now());
|
||||
|
||||
INSERT INTO federation_module_exposed (id, rel_node, rel_compose_module, fields)
|
||||
VALUES
|
||||
(196342359342989000, 276342359342989444, 196342359342989413, NULL)
|
||||
(196342359342989000, 276342359342989444, 196342359342989413, '[]')
|
||||
;
|
||||
|
||||
INSERT INTO federation_module_shared (id, handle, name, rel_node, xref_module, fields)
|
||||
VALUES
|
||||
(196342359342988000, 'Pricebook_on_origin_somewhere_else', 'Pricebook on some other origin (somewhere else)', 276342359342989444, 123456789012345678, NULL)
|
||||
(196342359342988000, 'Pricebook_on_origin_somewhere_else', 'Pricebook on some other origin (somewhere else)', 276342359342989444, 123456789012345678, '[]')
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user