75 Commits

Author SHA1 Message Date
f537fa581d Update testing env 2023-06-25 02:11:09 +02:00
9ae0a14cf0 Update testing env 2023-06-25 02:01:28 +02:00
538ee5b1c9 Update testing env 2023-06-25 01:58:12 +02:00
7deeecdb8b Update testing env 2023-06-25 01:56:55 +02:00
4ec00f2c3a Update testign env 2023-06-25 00:55:25 +02:00
d018ce7f0a Merge branch 'develop' into testing 2023-06-25 00:52:27 +02:00
ab2ec6717b Update env 2023-06-25 00:48:39 +02:00
6784028010 Update mikr.us env 2023-06-24 20:02:38 +02:00
a5cc8fd17e Update mikr.us env 2023-06-24 19:59:55 +02:00
faabe6ced7 Update mikr.us env 2023-06-24 19:55:55 +02:00
b29974e0ac Update mikr.us env 2023-06-24 19:55:37 +02:00
d8fa19d8ef Update mikr.us env 2023-06-24 19:38:36 +02:00
d0d6cc4612 Update mikr.us env 2023-06-24 19:26:38 +02:00
9e83f0f8d0 Update mikr.us env 2023-06-24 19:24:21 +02:00
4708096cb6 Update mikr.us env 2023-06-24 19:23:20 +02:00
c0a8a7aef1 Update mikr.us env 2023-06-24 19:22:03 +02:00
d118557e24 Update mikr.us env 2023-06-24 19:16:28 +02:00
2fc0c778dd Update mikr.us env 2023-06-24 18:54:00 +02:00
ebd6dcb5b4 Update mikr.us env 2023-06-24 18:50:09 +02:00
2a6f8691bb Update mikr.us env 2023-06-24 18:43:38 +02:00
29d4210228 Update mikr.us env 2023-06-24 18:42:19 +02:00
bbfb6e86f0 Update mikr.us env 2023-06-24 18:38:24 +02:00
3e13ce7ec1 Update mikr.us env 2023-06-24 18:35:16 +02:00
c1d56629f7 Update mikr.us env 2023-06-24 18:32:57 +02:00
1c1c2029d2 Update mikr.us env 2023-06-24 18:17:19 +02:00
db87d52012 Update mikr.us env 2023-06-24 17:54:28 +02:00
3e4a672e49 Update mikr.us env 2023-06-24 17:53:04 +02:00
b3f29f6de9 Update mikr.us env 2023-06-24 17:51:42 +02:00
40342ef3c8 Update mikr.us env 2023-06-24 17:50:38 +02:00
c2e907cee8 Update mikr.us env 2023-06-24 17:48:57 +02:00
f739036c44 Update mikr.us env 2023-06-24 17:47:44 +02:00
4120d789ff Update mikr.us env 2023-06-24 17:46:43 +02:00
e183d58f71 Update mikr.us env 2023-06-24 17:45:07 +02:00
583cfa7499 Update mikr.us env 2023-06-24 17:19:32 +02:00
d5390f35b2 dev.local env for MIKR.US test deploy 2023-06-24 16:38:06 +02:00
PB
09509d224f dev.local env for MIKR.US test deployt 2023-06-24 14:37:30 +00:00
d98cb70c02 Added mapping between host and consul dns server 2023-06-24 16:08:15 +02:00
7e5d3273d8 Update Makefile 2023-06-24 15:40:54 +02:00
6842fedccb Update README.md 2023-06-24 15:40:25 +02:00
b0afeb3b89 README.md update 2023-06-24 15:23:36 +02:00
574309d94c Added README.md 2023-06-24 14:04:12 +02:00
f6ea4db35e update 2023-06-24 12:44:28 +02:00
eed5458c0c Updated config files 2023-06-13 21:28:10 +02:00
59368f3660 added pricing service migrations 2023-06-13 21:03:44 +02:00
8fba43e14c Init testing branch 2023-06-13 17:07:05 +02:00
a3428542e7 Update 2023-06-01 21:54:00 +02:00
24378430de update 2023-05-24 14:28:20 +02:00
root
0213ecbadf keshop.bieda.it deploy fixes 2023-05-21 22:34:21 +00:00
6775eeafe6 sql init update 2023-05-22 00:18:08 +02:00
6467a60194 sql init update 2023-05-22 00:16:39 +02:00
3ab3c7f769 sql init update 2023-05-22 00:12:08 +02:00
0d2ff20557 Add init db sql file 2023-05-22 00:05:33 +02:00
f871d5e052 Update 2023-05-20 21:41:33 +02:00
08e6275c50 Added LICENSE 2023-03-30 22:15:45 +02:00
bd38c66fda Added base prometheus config + fast clean-up 2023-03-20 15:13:42 +01:00
6042f81c35 update 2022-12-25 23:21:27 +01:00
317d1a871b gateway command fix 2022-12-06 07:36:17 +01:00
5bd2f273a9 nginx example config update 2022-12-05 03:13:27 +01:00
17c64b31f5 fix 2022-12-05 01:39:24 +01:00
3db0fcf17b added sample nginx demo config 2022-12-05 01:38:51 +01:00
aa5b8bdadb fix 2022-12-05 00:23:18 +01:00
dbc67e44f2 fixes 2022-12-04 10:24:57 +01:00
68596649d4 fixes 2022-12-04 09:51:47 +01:00
80e8a2ac4e tls fixes 2022-12-04 07:19:55 +01:00
047888cf47 added empty directory for certificates(and keys) 2022-12-04 04:01:33 +01:00
f2efd1b141 added admin tools at main gateway entrypoint 2022-12-04 04:01:09 +01:00
958e04f81d env domain names fixes 2022-12-04 01:41:55 +01:00
b972b53d6b Added remove_dangling_images.sh script 2022-12-04 00:02:53 +01:00
b1d5d5c015 moved ports from dev to dev.local.dist stack config 2022-12-02 23:44:20 +01:00
45ce3d3e3c fixes 2022-12-02 22:03:33 +01:00
f9bf711ef6 fix 2022-12-02 14:17:09 +01:00
ea63c86bf8 Refactoring 2022-11-30 02:20:48 +01:00
55267a12e2 fix 2022-10-07 03:17:20 +02:00
2da3dd13d1 update 2022-10-06 20:40:27 +02:00
a811386ee3 Merge '[fix] Updated go version and project name in go.mod file' (#1) from bugfix/fix-go_mod-repair into develop
Reviewed-on: https://git.pbiernat.dev/egommerce/application/pulls/1
2022-06-19 11:35:28 +02:00
38 changed files with 1505 additions and 25 deletions

2
.gitignore vendored
View File

@@ -1 +1,3 @@
.idea/
#*.local.yml

15
.gitmodules vendored
View File

@@ -1,15 +0,0 @@
[submodule "services/basket"]
path = services/basket
url = git@git.pbiernat.dev:egommerce/basket-service.git
[submodule "services/catalog"]
path = services/catalog
url = git@git.pbiernat.dev:egommerce/catalog-service.git
[submodule "services/identity"]
path = services/identity
url = git@git.pbiernat.dev:egommerce/identity-service.git
[submodule "services/notification"]
path = services/notification
url = git@git.pbiernat.dev:egommerce/notification-service.git
[submodule "services/ordering"]
path = services/ordering
url = git@git.pbiernat.dev:egommerce/ordering-service.git

173
LICENSE.md Normal file
View File

@@ -0,0 +1,173 @@
# Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
**Using Creative Commons Public Licenses**
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
* __Considerations for licensors:__ Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. [More considerations for licensors](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensors).
* __Considerations for the public:__ By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensors permission is not necessary for any reasonfor example, because of any applicable exception or limitation to copyrightthen that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. [More considerations for the public](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensees).
## Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
### Section 1 Definitions.
a. __Adapted Material__ means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
b. __Adapter's License__ means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
c. __BY-NC-SA Compatible License__ means a license listed at [creativecommons.org/compatiblelicenses](http://creativecommons.org/compatiblelicenses), approved by Creative Commons as essentially the equivalent of this Public License.
d. __Copyright and Similar Rights__ means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
e. __Effective Technological Measures__ means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
f. __Exceptions and Limitations__ means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
g. __License Elements__ means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
h. __Licensed Material__ means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
i. __Licensed Rights__ means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
j. __Licensor__ means the individual(s) or entity(ies) granting rights under this Public License.
k. __NonCommercial__ means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
l. __Share__ means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
m. __Sui Generis Database Rights__ means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
n. __You__ means the individual or entity exercising the Licensed Rights under this Public License. __Your__ has a corresponding meaning.
### Section 2 Scope.
a. ___License grant.___
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
2. __Exceptions and Limitations.__ For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
3. __Term.__ The term of this Public License is specified in Section 6(a).
4. __Media and formats; technical modifications allowed.__ The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
5. __Downstream recipients.__
A. __Offer from the Licensor Licensed Material.__ Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
B. __Additional offer from the Licensor Adapted Material.__ Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapters License You apply.
C. __No downstream restrictions.__ You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
6. __No endorsement.__ Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
b. ___Other rights.___
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
### Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
a. ___Attribution.___
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed Material:
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
b. ___ShareAlike.___
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
1. The Adapters License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
### Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
### Section 5 Disclaimer of Warranties and Limitation of Liability.
a. __Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.__
b. __To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.__
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
### Section 6 Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
### Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
### Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
> Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at [creativecommons.org/policies](http://creativecommons.org/policies), Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
>
> Creative Commons may be contacted at creativecommons.org

View File

@@ -0,0 +1,7 @@
DEPLOY_DIR := ./deploy
up:
- sh ${DEPLOY_DIR}/start-stack.sh
down:
- docker stack rm egommerce

View File

@@ -1,3 +1,9 @@
# application
# Egommerce docker stack
Main application - includes all microservices
## RUNNING
# $ sh deploy/start-stack.sh
## MAINTENANCE
### If certificate doesn't work try to copy contents of the key file at the end of the cert file.

4
deploy/.env.local Normal file
View File

@@ -0,0 +1,4 @@
API_GATEWAY_PORT=40056
API_GATEWAY_UI_PORT=40057
API_REGISTRY_UI_PORT=40058
API_EVENTBUS_UI_PORT=40059

4
deploy/certs/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@@ -0,0 +1,2 @@
DROP TABLE IF EXISTS basket.basket_item;
DROP TABLE IF EXISTS basket.basket;

View File

@@ -0,0 +1,34 @@
CREATE TABLE IF NOT EXISTS basket.basket
(
id uuid NOT NULL DEFAULT gen_random_uuid(),
state character varying NOT NULL DEFAULT 'new',
created_at timestamp without time zone NOT NULL DEFAULT now(),
updated_at timestamp without time zone,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS basket.basket_item
(
id uuid NOT NULL DEFAULT gen_random_uuid(),
basket_id uuid NOT NULL,
product_id integer NOT NULL,
quantity integer NOT NULL DEFAULT 1,
price double precision NOT NULL DEFAULT 0.00;
created_at timestamp without time zone NOT NULL DEFAULT now(),
updated_at timestamp without time zone,
PRIMARY KEY (id)
);
ALTER TABLE IF EXISTS basket.basket_item
ADD CONSTRAINT basket_item_basket_fkey FOREIGN KEY (basket_id)
REFERENCES basket.basket (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID;
ALTER TABLE IF EXISTS basket.basket
OWNER to postgres;
ALTER TABLE IF EXISTS basket.basket_item
OWNER to postgres;
-- TODO ^^ PRIVILEGES...

View File

@@ -0,0 +1,2 @@
ALTER TABLE IF EXISTS basket.basket_item
DROP COLUMN price;

View File

@@ -0,0 +1,2 @@
ALTER TABLE IF EXISTS basket.basket_item
ADD COLUMN price double precision NOT NULL DEFAULT 0.00;

View File

@@ -0,0 +1 @@
DROP TABLE IF EXISTS catalog.product;

View File

@@ -0,0 +1,16 @@
CREATE TABLE catalog.product
(
id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
pid character varying NOT NULL,
name character varying NOT NULL,
price double precision NOT NULL,
created_at timestamp without time zone NOT NULL DEFAULT now(),
updated_at timestamp without time zone,
PRIMARY KEY (id)
);
ALTER TABLE IF EXISTS catalog.product
OWNER to postgres;
COMMENT ON COLUMN catalog.product.pid
IS 'Unique product ID. EAN, UPC etc...';

View File

@@ -0,0 +1 @@
DROP TABLE IF EXISTS identity.users;

View File

@@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS identity.users
(
id uuid NOT NULL DEFAULT gen_random_uuid(),
username character varying NOT NULL,
email character varying NOT NULL,
created_at timestamp without time zone NOT NULL DEFAULT now(),
updated_at timestamp without time zone,
PRIMARY KEY (id)
);
ALTER TABLE IF EXISTS identity.users
OWNER to postgres;

View File

@@ -0,0 +1,3 @@
CREATE USER egommerce;
CREATE DATABASE egommerce;
GRANT ALL PRIVILEGES ON DATABASE egommerce TO egommerce;

View File

@@ -0,0 +1,2 @@
DROP TABLE IF EXISTS ordering.order_item;
DROP TABLE IF EXISTS ordering."order";

View File

@@ -0,0 +1,34 @@
CREATE TABLE IF NOT EXISTS ordering."order"
(
id uuid NOT NULL DEFAULT gen_random_uuid(),
state character varying NOT NULL DEFAULT 'new',
created_at timestamp without time zone NOT NULL DEFAULT now(),
updated_at timestamp without time zone,
PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS ordering.order_item
(
id uuid NOT NULL DEFAULT gen_random_uuid(),
order_id uuid NOT NULL,
product_id integer NOT NULL,
quantity integer NOT NULL DEFAULT 1,
price double precision NOT NULL DEFAULT 0.00;
created_at timestamp without time zone NOT NULL DEFAULT now(),
updated_at timestamp without time zone,
PRIMARY KEY (id)
);
ALTER TABLE IF EXISTS ordering.order_item
ADD CONSTRAINT order_item_order_fkey FOREIGN KEY (order_id)
REFERENCES "ordering"."order" (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID;
ALTER TABLE IF EXISTS "ordering"."order"
OWNER to postgres;
ALTER TABLE IF EXISTS "ordering".order_item
OWNER to postgres;
-- TODO ^^ PRIVILEGES...

View File

@@ -0,0 +1 @@
DROP TABLE IF EXISTS pricing.price;

View File

@@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS pricing."price"
(
id uuid NOT NULL DEFAULT gen_random_uuid()
);
ALTER TABLE IF EXISTS "pricing"."price"
OWNER to postgres;
-- TODO ^^ PRIVILEGES...

View File

@@ -0,0 +1,157 @@
version: "3.9"
services:
api-gateway:
env_file: .env.local
environment:
- APP_DOMAIN=egommerce.local
# - APP_PORT=40056
ports:
- '40056:443'
- '40057:8080'
- '5672:5672'
api-registry:
command: ["-ui-content-path=/registry", "-log-level=DEBUG"]
environment:
- APP_DOMAIN=registry.egommerce.local
# - APP_PORT=40058
ports:
- '8300:8300'
- '40058:8500'
- '8600:8600/udp'
api-eventbus:
env_file: .env.local
environment:
- APP_DOMAIN=eventbus.egommerce.local
# - APP_PORT=40059
labels:
- traefik.enable=true
- traefik.tcp.routers.eventbus.rule=HostSNI(`*`)
- traefik.tcp.routers.eventbus.entrypoints=rabbitmq
- traefik.tcp.routers.eventbus.service=eventbus
- traefik.tcp.services.eventbus.loadbalancer.server.port=5672
ports:
- '40059:8084'
- '15672:15672'
api-cache:
env_file: .env.local
environment:
- APP_DOMAIN=redis.egommerce.local
command: ["redis-server", "/etc/redis.conf", "--requirepass", "12345678"]
ports:
- 6379:6379
api-logger:
env_file: .env.local
environment:
- APP_DOMAIN=logger.egommerce.local
ports:
- 24224:24224
# api-prometheus:
# environment:
# - APP_DOMAIN=prometheus.egommerce.local
# ports:
# - 9090:9090
# api-grafana:
# environment:
# - APP_DOMAIN=grafana.egommerce.local
# ports:
# - 3000:3000
postgres-db:
env_file: .env.local
environment:
- APP_DOMAIN=postgres.egommerce.local
ports:
- 5432:5432
mongo-db:
env_file: .env.local
environment:
- APP_DOMAIN=mongo.egommerce.local
ports:
- 27017:27017
identity-svc:
env_file: .env.local
environment:
- APP_DOMAIN=identity.api.egommerce.local
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
ports:
- 8080:80
basket-svc:
env_file: .env.local
environment:
- APP_DOMAIN=basket.api.egommerce.local
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
ports:
- 8001:80
catalog-svc:
env_file: .env.local
environment:
- APP_DOMAIN=catalog.api.egommerce.local
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
ports:
- 8002:80
order-svc:
env_file: .env.local
environment:
- APP_DOMAIN=order.api.egommerce.local
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
ports:
- 8003:80
pricing-svc:
env_file: .env.local
environment:
- APP_DOMAIN=pricing.api.egommerce.local
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
ports:
- 8004:80
# Workers (EventBus)
basket-worker:
env_file: .env.local
environment:
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
catalog-worker:
env_file: .env.local
environment:
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
pricing-worker:
env_file: .env.local
environment:
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
order-worker:
env_file: .env.local
environment:
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672

View File

@@ -0,0 +1,138 @@
version: "3.9"
services:
api-gateway:
image: git.pbiernat.dev/egommerce/api-gateway:dev
environment:
- APP_DOMAIN=api-gateway
api-registry:
image: git.pbiernat.dev/egommerce/api-registry:dev
environment:
- APP_DOMAIN=api-registry
- CONSUL_HTTP_TOKEN=devop
volumes:
- ./certs/api-registry:/consul/data/certs
api-eventbus:
image: git.pbiernat.dev/egommerce/api-eventbus:dev
environment:
- APP_DOMAIN=api-eventbus
# - RABBITMQ_NODENAME=api-eventbus
# - RABBITMQ_USE_LONGNAME=true
# - RABBITMQ_DEFAULT_USER = admin
# - RABBITMQ_DEFAULT_PASS = passw123
api-cache:
image: git.pbiernat.dev/egommerce/api-cache:dev
environment:
- PASSWORD=12345678
api-logger:
image: git.pbiernat.dev/egommerce/api-logger:dev
environment:
- APP_DOMAIN=api-logger
#api-prometheus:
# image: prom/prometheus:latest # FIXME: create private image(prod/dev)...
# environment:
# - APP_DOMAIN=prometheus.keshop.bieda.it
#api-grafana:
# image: grafana/grafana-oss:latest # FIXME: create private image(prod/dev)...
# environment:
# - APP_DOMAIN=grafana.keshop.bieda.it
postgres-db:
environment:
- APP_DOMAIN=postgres-db
- POSTGRES_PASSWORD=12345678
mongo-db:
environment:
- APP_DOMAIN=mongo-db
- MONGO_INITDB_ROOT_PASSWORD=12345678
# API micro-services
identity-svc:
image: git.pbiernat.dev/egommerce/identity-svc:dev
environment:
- APP_DOMAIN=identity-svc
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
volumes:
- ./certs/api-gateway:/certs
basket-svc:
image: git.pbiernat.dev/egommerce/basket-svc:dev
environment:
- APP_DOMAIN=basket-svc
- AUTH_HANDLER_URL=http://identity-svc/api/v1/traefik
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
volumes:
- ./certs/api-gateway:/certs
catalog-svc:
image: git.pbiernat.dev/egommerce/catalog-svc:dev
environment:
- APP_DOMAIN=catalog-svc
- AUTH_HANDLER_URL=http://identity-svc/api/v1/traefik
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
volumes:
- ./certs/api-gateway:/certs
pricing-svc:
image: git.pbiernat.dev/egommerce/pricing-svc:dev
environment:
- APP_DOMAIN=pricing-svc
- AUTH_HANDLER_URL=http://identity-svc/api/v1/traefik
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
volumes:
- ./certs/api-gateway:/certs
order-svc:
image: git.pbiernat.dev/egommerce/order-svc:dev
environment:
- APP_DOMAIN=order-svc
- AUTH_HANDLER_URL=http://identity-svc/api/v1/traefik
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
volumes:
- ./certs/api-gateway:/certs
# Workers (Eventbus)
basket-worker:
image: git.pbiernat.dev/egommerce/basket-worker:dev
environment:
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
catalog-worker:
image: git.pbiernat.dev/egommerce/catalog-worker:dev
environment:
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
pricing-worker:
image: git.pbiernat.dev/egommerce/pricing-worker:dev
environment:
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672
order-worker:
image: git.pbiernat.dev/egommerce/order-worker:dev
environment:
- DATABASE_URL=postgres://postgres:12345678@postgres-db:5432/egommerce
- MONGODB_URL=mongodb://mongodb:12345678@mongo-db:27017
- EVENTBUS_URL=amqp://guest:guest@api-eventbus:5672

392
deploy/egommerce-stack.yml Normal file
View File

@@ -0,0 +1,392 @@
version: "3.9"
services:
api-gateway:
image: git.pbiernat.dev/egommerce/api-gateway:latest
# command:
# - '--providers.consulcatalog.refreshinterval=5s'
# FIXME ^^ only on config option: static/env/cli must be selected
environment:
- APP_NAME=api-gateway
- APP_DOMAIN
- API_REGISTRY_REFRESH_INTERVAL=5s
volumes:
- ./certs/api-gateway:/etc/traefik/certs
- /var/run/docker.sock:/var/run/docker.sock
networks:
- api-gateway-network
- api-registry-network
- api-logger-network
api-registry:
image: git.pbiernat.dev/egommerce/api-registry:latest
environment:
- APP_NAME=api-registry
- APP_DOMAIN
- CONSUL_HTTP_TOKEN=VeryS3cr3tTok3N
volumes:
- registry_data:/consul/data
- ./certs/api-registry:/consul/data/certs
networks:
- api-registry-network
- api-logger-network
api-eventbus:
image: git.pbiernat.dev/egommerce/api-eventbus:latest
environment:
# - RABBITMQ_NODENAME=api-eventbus
- RABBITMQ_ERLANG_COOKIE=rabbitmq
- APP_NAME=api-eventbus
- APP_DOMAIN
volumes:
- eventbus_data:/var/lib/rabbitmq
- eventbus_logs:/var/log/rabbitmq
networks:
- api-gateway-network
- api-eventbus-network
- api-registry-network
- api-logger-network
api-cache:
image: git.pbiernat.dev/egommerce/api-cache:latest
environment:
- APP_NAME=api-cache
networks:
- api-cache-network
- api-logger-network
api-logger:
image: git.pbiernat.dev/egommerce/api-logger:latest
environment:
- APP_NAME=api-logger
- APP_DOMAIN
networks:
- api-logger-network
#api-prometheus:
# image: prom/prometheus:latest # FIXME: create private image(prod/dev)...
# user: root
# environment:
# - APP_NAME=api-prometheus
# - APP_DOMAIN
# volumes:
# - ./etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
# - /var/run/docker.sock:/var/run/docker.sock
# networks:
# - api-prometheus-network
#- api-grafana-network
# - api-gateway-network
# - api-registry-network
# - api-eventbus-network
# - api-cache-network
# - api-logger-network
# - basket-svc-network
# - basket-worker-network
# - catalog-svc-network
# - catalog-worker-network
# - identity-svc-network
# - order-svc-network
# - order-worker-network
# - pricing-svc-network
# - pricing-worker-network
#api-grafana:
# image: grafana/grafana-oss:latest # FIXME: create private image(prod/dev)...
# environment:
# - APP_NAME=api-grafana
# - APP_DOMAIN
# volumes:
# - grafana-db:/var/lib/grafana
# networks:
# - api-grafana-network
postgres-db:
image: postgres:14.1-alpine
environment:
- APP_NAME=postgres-db
- APP_DOMAIN
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD
volumes:
- postgres_data:/var/lib/postgresql/data
- ./db_migrations/init/:/docker-entrypoint-initdb.d/
networks:
- postgres-db-network
- api-logger-network
mongo-db:
image: mongo:5.0.14
environment:
- APP_NAME=mongo-db
- APP_DOMAIN
- MONGO_INITDB_ROOT_USERNAME=mongodb
- MONGO_INITDB_ROOT_PASSWORD
volumes:
- mongodb_data:/data/db
networks:
- mongodb-db-network
- api-logger-network
# API micro-services
identity-svc:
image: git.pbiernat.dev/egommerce/identity-svc:latest
environment:
- APP_NAME=identity-svc
- APP_PATH_PREFIX=/identity
- APP_DOMAIN
- APP_KV_NAMESPACE
- DATABASE_URL
- MONGODB_URL
- EVENTBUS_URL
volumes:
- ./db_migrations/identity-svc:/migrations
networks:
- identity-svc-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network
- postgres-db-network
- mongodb-db-network
basket-svc:
image: git.pbiernat.dev/egommerce/basket-svc:latest
environment:
- APP_NAME=basket-svc
- APP_PATH_PREFIX=/basket
- APP_DOMAIN
- APP_KV_NAMESPACE
- AUTH_HANDLER_URL
- DATABASE_URL
- MONGODB_URL
- EVENTBUS_URL
volumes:
- ./db_migrations/basket-svc:/migrations
networks:
- basket-svc-network
# - order-svc-network
# - pricing-svc-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network
- postgres-db-network
- mongodb-db-network
catalog-svc:
image: git.pbiernat.dev/egommerce/catalog-svc:latest
environment:
- APP_NAME=catalog-svc
- APP_PATH_PREFIX=/catalog
- APP_DOMAIN
- APP_KV_NAMESPACE
- AUTH_HANDLER_URL
- DATABASE_URL
- MONGODB_URL
- EVENTBUS_URL
volumes:
- ./db_migrations/catalog-svc:/migrations
networks:
- catalog-svc-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network
- postgres-db-network
- mongodb-db-network
pricing-svc:
image: git.pbiernat.dev/egommerce/pricing-svc:latest
environment:
- APP_NAME=pricing-svc
- APP_PATH_PREFIX=/pricing
- APP_DOMAIN
- APP_KV_NAMESPACE
- AUTH_HANDLER_URL
- DATABASE_URL
- MONGODB_URL
- EVENTBUS_URL
volumes:
- ./db_migrations/pricing-svc:/migrations
networks:
- pricing-svc-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network
- postgres-db-network
- mongodb-db-network
order-svc:
image: git.pbiernat.dev/egommerce/order-svc:latest
environment:
- APP_NAME=order-svc
- APP_PATH_PREFIX=/order
- APP_DOMAIN
- APP_KV_NAMESPACE
- AUTH_HANDLER_URL
- DATABASE_URL
- MONGODB_URL
- EVENTBUS_URL
volumes:
- ./db_migrations/order-svc:/migrations
networks:
- order-svc-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network
- postgres-db-network
- mongodb-db-network
# Workers (Eventbus)
basket-worker:
image: git.pbiernat.dev/egommerce/basket-worker:latest
environment:
- APP_NAME=basket-worker
- APP_KV_NAMESPACE
- DATABASE_URL
- MONGODB_URL
- EVENTBUS_URL
networks:
- basket-worker-network
- pricing-svc-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network
- postgres-db-network
- mongodb-db-network
catalog-worker:
image: git.pbiernat.dev/egommerce/catalog-worker:latest
environment:
- APP_NAME=catalog-worker
- DATABASE_URL
- MONGODB_URL
- EVENTBUS_URL
networks:
- catalog-worker-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network
- postgres-db-network
- mongodb-db-network
pricing-worker:
image: git.pbiernat.dev/egommerce/pricing-worker:latest
environment:
- APP_NAME=pricing-worker
- DATABASE_URL
- MONGODB_URL
- EVENTBUS_URL
networks:
- pricing-worker-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network
- postgres-db-network
- mongodb-db-network
order-worker:
image: git.pbiernat.dev/egommerce/order-worker:latest
environment:
- APP_NAME=order-worker
- DATABASE_URL
- MONGODB_URL
- EVENTBUS_URL
networks:
- order-worker-network
- basket-svc-network
- api-gateway-network
- api-registry-network
- api-eventbus-network
- api-logger-network
- postgres-db-network
- mongodb-db-network
volumes:
postgres_data: ~
mongodb_data: ~
registry_data: ~
eventbus_data: ~
eventbus_logs: ~
#grafana-db: ~
networks:
# Infrastructure networks
api-gateway-network:
driver: overlay
#internal: true
api-registry-network:
driver: overlay
#internal: true
api-eventbus-network:
driver: overlay
#internal: true
api-cache-network:
driver: overlay
#internal: true
api-logger-network:
driver: overlay
#internal: true
api-prometheus-network:
driver: overlay
#internal: true
#api-grafana-network:
# driver: overlay
# internal: true
postgres-db-network:
driver: overlay
#internal: true
mongodb-db-network:
driver: overlay
#internal: true
# Micro-services networks
identity-svc-network:
driver: overlay
#internal: true
basket-svc-network:
driver: overlay
#internal: true
catalog-svc-network:
driver: overlay
#internal: true
pricing-svc-network:
driver: overlay
#internal: true
order-svc-network:
driver: overlay
#internal: true
# Workers networks
basket-worker-network:
driver: overlay
#internal: true
catalog-worker-network:
driver: overlay
#internal: true
pricing-worker-network:
driver: overlay
#internal: true
order-worker-network:
driver: overlay
#internal: true

View File

@@ -0,0 +1,82 @@
global:
scrape_interval: 10s
evaluation_interval: 10s
# rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: docker
dockerswarm_sd_configs:
- host: unix:///var/run/docker.sock
role: tasks
relabel_configs:
- source_labels: [__meta_dockerswarm_service_name, __address__]
regex: egommerce_(api-eventbus|api-gateway);(.*):(.*)
action: replace
replacement: '$2:8084'
target_label: __address__
# - source_labels: [__meta_dockerswarm_service_name, __address__]
# regex: egommerce_api-gateway;(.*):(.*)
# action: replace
# replacement: '$1:8084'
# target_label: __address__
# Only keep containers that should be running.
- source_labels: [__meta_dockerswarm_service_label_com_docker_stack_namespace]
regex: egommerce
action: keep
- source_labels: [__meta_dockerswarm_task_desired_state]
regex: running
action: keep
# - source_labels: [__meta_dockerswarm_network_name]
# regex: ingress
# action: keep
- source_labels: [__meta_dockerswarm_service_name]
action: replace
replacement: '$1'
target_label: instance
# - source_labels: [__meta_dockerswarm_task_desired_state]
# regex: running
# action: keep
# - job_name: consul
# consul_sd_configs:
# - server: api-registry:8500
# services:
# - consul
# - basket-server
# - catalog-server
# - identity-svc
# - order-svc
# - pricing-svc
# - consul
# - job_name: rabbitmq
# consul_sd_configs:
# - server: api-registry:8500
# services:
# - api-eventbus
# relabel_configs:
# - source_labels: ['__meta_consul_service_address']
# replacement: '$1:8084'
# target_label: __address__
# - source_labels: ['__meta_consul_service_port']
# replacement: '8084'
# target_label: __meta_consul_service_port
# - job_name: 'api-gateway'
# static_configs:
# - targets: ['api-gateway:8084']
# - job_name: 'api-eventbus'
# static_configs:
# - targets: ['api-eventbus:8084']
# - job_name: 'catalog-svc'
# static_configs:
# - targets: ['catalog-svc:8084']

60
deploy/make-cert.sh Normal file
View File

@@ -0,0 +1,60 @@
# #!/bin/sh
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./cert/identity-svc-server.key -out ./cert/identity-svc-server.cert \
-addext "subjectAltName = DNS:identity-svc"
# ^^ GENERATE CERT FOR BACKEND SERVICE (on client side - in traefik - we dont need DNS domain... for now...)
# if [ -z "$SERVICE" ]; then echo "set SERVICE var"; exit 1; fi
# if [ -z "$CA_ROOT" ]; then echo "set CA_ROOT var"; exit 1; fi
# if [ -z "$DOMAIN" ]; then echo "set DOMAIN var"; exit 1; fi
# PASSWORD=V3ryS3cr3tP4ssw0rd
# # sample for registry server (with api-gateway-svc as a client) but using FDN...
# # keytool -genkey -alias api-registry-svc -dname cn=$DOMAIN -validity 365 -keystore tmp/api-registry-svc.p12 -keyalg RSA -keysize 2048 -storepass $PASSWORD -ext "SAN:c=DNS:registry.egommerce.local,IP:127.0.0.1"
# # keytool -genkey -alias myClientCertificate -dname cn=$DOMAIN -validity 365 -keystore tmp/myClientCertificate.p12 -keyalg RSA -keysize 2048 -storepass $PASSWORD -ext "SAN:c=DNS:registry.egommerce.local,IP:127.0.0.1"
# # keytool -export -alias myClientCertificate -file tmp/myClientCertificate.crt -keystore tmp/myClientCertificate.p12 -storepass $PASSWORD
# # keytool -export -alias api-registry-svc -file tmp/api-registry-svc.crt -keystore tmp/api-registry-svc.p12 -storepass $PASSWORD
# # keytool -import -alias myClientCertificate -file tmp/myClientCertificate.crt -keystore tmp/api-registry-svc.p12 -storepass $PASSWORD # aka myCertificate.p12
# # echo "Done."
# # exit 0
# if [ -d "$SERVICE" ]; then
# echo "$SERVICE directory exists... Quitting."
# exit 1;
# fi
# if [ ! -f "$SERVICE" ]; then
# mkdir -p $SERVICE
# fi
# echo "===================================================================="
# echo "Fake third-party chain generated. Now generating keystore.p12 ..."
# echo "===================================================================="
# # generate private keys (for server)
# keytool -genkeypair -alias $SERVICE -dname cn=$DOMAIN -validity 365 -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore "$SERVICE/keystore.p12" -keypass $PASSWORD -storepass $PASSWORD
# # generate a certificate for server signed by ca (root -> ca -> server)
# keytool -storetype PKCS12 -keystore "$SERVICE/keystore.p12" -storepass $PASSWORD -certreq -alias $SERVICE \
# | keytool -storetype PKCS12 -keystore "$CA_ROOT/ca.p12" -storepass $PASSWORD -gencert -alias ca -ext ku:c=dig,keyEnc -ext "SAN:c=DNS:$DOMAIN,IP:127.0.0.1" -ext eku=sa,ca -rfc > "$SERVICE/$SERVICE.pem"
# # import server cert chain into ${SERVICE}.p12
# keytool -storetype PKCS12 -keystore "$SERVICE/keystore.p12" -storepass $PASSWORD -importcert -trustcacerts -noprompt -alias root -file "$CA_ROOT/root.pem"
# keytool -storetype PKCS12 -keystore "$SERVICE/keystore.p12" -storepass $PASSWORD -importcert -alias ca -file "$CA_ROOT/ca.pem"
# keytool -storetype PKCS12 -keystore "$SERVICE/keystore.p12" -storepass $PASSWORD -importcert -alias $SERVICE -file "$SERVICE/$SERVICE.pem"
# # DEPRECATED - duplicated above section...
# # echo "================================================="
# # echo "Keystore generated. Now generating truststore ..."
# # echo "================================================="
# # import server cert chain into my-truststore.p12
# # keytool -storetype PKCS12 -keystore "$SERVICE/keystore.p12" -storepass $PASSWORD -importcert -trustcacerts -noprompt -alias root -file "$CA_ROOT/root.pem"
# # keytool -storetype PKCS12 -keystore "$SERVICE/keystore.p12" -storepass $PASSWORD -importcert -alias ca -file "$CA_ROOT/ca.pem"
# # keytool -storetype PKCS12 -keystore "$SERVICE/keystore.p12" -storepass $PASSWORD -importcert -alias $SERVICE -file "$SERVICE/$SERVICE.pem"

View File

@@ -0,0 +1,111 @@
upstream egommerce-api-gw {
server 127.0.0.1:40056;
}
upstream egommerce-api-gw-dashboard {
server 127.0.0.1:40057;
}
upstream egommerce-api-registry-ui {
server 127.0.0.1:40058;
}
upstream egommerce-api-eventbus-mngmt {
server 127.0.0.1:40059;
}
server {
listen [2a01:4f9:3a:2910::271]:20271 ssl;
ssl_certificate /home/keedosn/egommerce/deploy/certs/api-gateway/gateway.cert;
ssl_certificate_key /home/keedosn/egommerce/deploy/certs/api-gateway/gateway.key;
server_name keshop.bieda.it;
# Traefik redirects
location /dashboard {
if ($http_referer ~ (/gateway)) {
proxy_pass http://egommerce-api-gw-dashboard;
}
}
location /api {
if ($http_referer ~ (/gateway)) {
proxy_pass http://egommerce-api-gw-dashboard;
}
}
location /gateway/ {
proxy_pass http://egommerce-api-gw-dashboard/dashboard/;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
}
# Consul redirects
location /ui {
if ($http_referer ~ (/registry)) {
proxy_pass http://egommerce-api-registry-ui;
}
}
location /v1 {
if ($http_referer ~ (/registry)) {
proxy_pass http://egommerce-api-registry-ui;
}
}
location /registry {
proxy_pass http://egommerce-api-registry-ui;
proxy_http_version 1.1;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
}
# RabbitMQ Mngmt redirects
location /eventbus {
return 302 /eventbus/;
}
location ~* /eventbus/api/(.*?)/(.*) {
proxy_pass http://egommerce-api-eventbus-mngmt/api/$1/%2F/$2?$query_string;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~* /eventbus/(.*) {
rewrite ^/eventbus/(.*)$ /$1 break;
proxy_pass http://egommerce-api-eventbus-mngmt;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Pass all requests to the API Gateway
location / {
proxy_pass https://egommerce-api-gw;
proxy_http_version 1.1;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
}
error_log /var/log/nginx/keshop.bieda.it-error.log;
access_log /var/log/nginx/keshop.bieda.it-access.log combined;
}

125
deploy/nginx-vhost.dev.conf Normal file
View File

@@ -0,0 +1,125 @@
upstream egommerce-api-gw {
server 127.0.0.1:48443;
}
upstream egommerce-api-gw-dashboard {
server 127.0.0.1:48444;
}
upstream egommerce-api-registry-ui {
server 127.0.0.1:48445;
}
upstream egommerce-api-eventbus-mngmt {
server 127.0.0.1:48446;
}
server {
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/admin.egommerce.pbiernat.dev/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/admin.egommerce.pbiernat.dev/privkey.pem;
server_name admin.egommerce.pbiernat.dev;
# Traefik redirects
location /dashboard {
if ($http_referer ~ (/gateway)) {
proxy_pass http://egommerce-api-gw-dashboard;
}
}
location /api {
if ($http_referer ~ (/gateway)) {
proxy_pass http://egommerce-api-gw-dashboard;
}
}
location /gateway/ {
proxy_pass http://egommerce-api-gw-dashboard/dashboard/;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
}
# Consul redirects
location /ui {
if ($http_referer ~ (/registry)) {
proxy_pass http://egommerce-api-registry-ui;
}
}
location /v1 {
if ($http_referer ~ (/registry)) {
proxy_pass http://egommerce-api-registry-ui;
}
}
location /registry {
proxy_pass http://egommerce-api-registry-ui;
proxy_http_version 1.1;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
}
# RabbitMQ Mngmt redirects
location /eventbus {
return 302 /eventbus/;
}
location ~* /eventbus/api/(.*?)/(.*) {
proxy_pass http://egommerce-api-eventbus-mngmt/api/$1/%2F/$2?$query_string;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~* /eventbus/(.*) {
rewrite ^/eventbus/(.*)$ /$1 break;
proxy_pass http://egommerce-api-eventbus-mngmt;
proxy_http_version 1.1;
proxy_buffering off;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Pass all requests to the API Gateway
location / {
proxy_pass https://egommerce-api-gw;
proxy_http_version 1.1;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
}
error_log /var/log/nginx/admin-egommerce.pbiernat.dev-error.log;
access_log /var/log/nginx/admin-egommerce.pbiernat.dev-access.log combined;
}
#server {
# listen 443 ssl;
# ssl_certificate /etc/letsencrypt/live/egommerce.pbiernat.dev/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/egommerce.pbiernat.dev/privkey.pem;
#
# server_name egommerce.pbiernat.dev;
#
#
#
# error_log /var/log/nginx/egommerce.pbiernat.dev-error.log;
# access_log /var/log/nginx/egommerce.pbiernat.dev-access.log combined;
#}

View File

@@ -0,0 +1,109 @@
upstream egommerce-api-gw {
server 127.0.0.1:40056;
}
upstream egommerce-api-gw-dashboard {
server 127.0.0.1:40057;
}
upstream egommerce-api-registry-ui {
server 127.0.0.1:40058;
}
upstream egommerce-api-eventbus-mngmt {
server 127.0.0.1:40059;
}
server {
listen 443 ssl;
ssl_certificate /home/keedosn/workspace/golang/src/git.pbiernat.dev/egommerce/stack/deploy/certs/api-gateway/localhost.cert;
ssl_certificate_key /home/keedosn/workspace/golang/src/git.pbiernat.dev/egommerce/stack/deploy/certs/api-gateway/localhost.key;
server_name egommerce.local;
# Traefik redirects
location /dashboard {
if ($http_referer ~ (/gateway)) {
proxy_pass http://egommerce-api-gw-dashboard;
}
}
location /api {
if ($http_referer ~ (/gateway)) {
proxy_pass http://egommerce-api-gw-dashboard;
}
}
location /gateway/ {
proxy_pass http://egommerce-api-gw-dashboard/dashboard/;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
}
# Consul redirects
location /ui {
if ($http_referer ~ (/registry)) {
proxy_pass http://egommerce-api-registry-ui;
}
}
location /v1 {
if ($http_referer ~ (/registry)) {
proxy_pass http://egommerce-api-registry-ui;
}
}
location /registry {
proxy_pass http://egommerce-api-registry-ui;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
}
# RabbitMQ Mngmt redirects
location /eventbus {
return 302 /eventbus/;
}
location ~* /eventbus/api/(.*?)/(.*) {
proxy_pass http://egommerce-api-eventbus-mngmt/api/$1/%2F/$2?$query_string;
proxy_buffering off;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~* /eventbus/(.*) {
rewrite ^/eventbus/(.*)$ /$1 break;
proxy_pass http://egommerce-api-eventbus-mngmt;
proxy_buffering off;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Pass all requests to the API Gateway
location / {
proxy_pass https://egommerce-api-gw;
proxy_http_version 1.1;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 0;
}
error_log /var/log/nginx/egommerce.local-error.log;
access_log /var/log/nginx/egommerce.local-access.log combined;
}

View File

@@ -0,0 +1,3 @@
#!/bin/sh
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)

11
deploy/start-stack.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
# RUN IT FORM THE REPO ROOT DIR
echo "Starting egommerce stack..."
docker stack deploy --with-registry-auth \
--compose-file deploy/egommerce-stack.yml \
--compose-file deploy/egommerce-stack.dev.yml \
--compose-file deploy/egommerce-stack.dev.local.yml \
egommerce
echo "Done."

3
go.mod
View File

@@ -1,3 +0,0 @@
module git.pbiernat.dev/egommerce/application
go 1.18

Submodule services/basket deleted from c4134dc7a2

Submodule services/catalog deleted from cc115fb4c9